package ai.equity.salt.openai.model;

import ai.equity.salt.openai.OpenAiProperties;
import dev.langchain4j.model.openai.OpenAiChatModel;
import dev.langchain4j.model.openai.OpenAiLanguageModel;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import static dev.langchain4j.model.openai.OpenAiModelName.GPT_3_5_TURBO_1106;

@Component
@RequiredArgsConstructor
public class OpenAiModelFactory {

    private final OpenAiProperties properties;

    public OpenAiLanguageModel create() {
        return OpenAiLanguageModel.builder()
                .apiKey(properties.key())
                .logRequests(true)
                .logResponses(true)
                .build();
    }
    public OpenAiChatModel createDefaultChatModel() {
        return OpenAiChatModel.builder()
                .modelName(GPT_3_5_TURBO_1106)
                .apiKey(properties.key())
                .maxTokens(1024)
                .temperature(0.0)
                .topP(0.0)
                .logRequests(true)
                .logResponses(true)
                .build();
    }
}

dev.langchain4j.model.openai.OpenAiLanguageModel.builder dev.langchain4j.model.openai.OpenAiChatModel.builder
[((540, 707), 'dev.langchain4j.model.openai.OpenAiLanguageModel.builder'), ((540, 682), 'dev.langchain4j.model.openai.OpenAiLanguageModel.builder'), ((540, 646), 'dev.langchain4j.model.openai.OpenAiLanguageModel.builder'), ((540, 611), 'dev.langchain4j.model.openai.OpenAiLanguageModel.builder'), ((784, 1088), 'dev.langchain4j.model.openai.OpenAiChatModel.builder'), ((784, 1063), 'dev.langchain4j.model.openai.OpenAiChatModel.builder'), ((784, 1027), 'dev.langchain4j.model.openai.OpenAiChatModel.builder'), ((784, 992), 'dev.langchain4j.model.openai.OpenAiChatModel.builder'), ((784, 965), 'dev.langchain4j.model.openai.OpenAiChatModel.builder'), ((784, 931), 'dev.langchain4j.model.openai.OpenAiChatModel.builder'), ((784, 898), 'dev.langchain4j.model.openai.OpenAiChatModel.builder'), ((784, 856), 'dev.langchain4j.model.openai.OpenAiChatModel.builder')]