package com.johnsosoka.selfdiscover.config;

import dev.langchain4j.model.chat.ChatLanguageModel;
import dev.langchain4j.model.openai.OpenAiChatModel;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * This class configures the language model used by the chat agents.
 */
@Configuration
public class LanguageModelConfig {

    @Value("${openai.api-key}")
    String apiKey;

    @Bean
    public ChatLanguageModel chatLanguageModel() {
        return OpenAiChatModel.builder()
                .apiKey(apiKey)
                .build();
    }

}

[((580, 662), 'dev.langchain4j.model.openai.OpenAiChatModel.builder'), ((580, 637), 'dev.langchain4j.model.openai.OpenAiChatModel.builder')]