package ch.phoenixtechnologies.lc4j.openai.runtime.config;

import dev.langchain4j.model.embedding.EmbeddingModel;
import dev.langchain4j.model.openai.OpenAiEmbeddingModel;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.inject.Produces;

@ApplicationScoped
public class CustomEmbeddingModelProducer {
    private final CustomEmbeddingModelConfig config;

    public CustomEmbeddingModelProducer(CustomEmbeddingModelConfig config) {
        this.config = config;
    }

    @Produces
    public EmbeddingModel getModel() {
        return OpenAiEmbeddingModel.builder()
                .apiKey(config.apiKey())
                .baseUrl(config.baseUrl())
                .modelName(config.modelName())
                .logRequests(config.logRequests())
                .logResponses(config.logResponses())
                // .dimensions(config.dimensions())
                .build();
    }
}
