package com.yanzhu.module.ai.framework.ai.core.model.gemini;

import dev.langchain4j.model.chat.ChatLanguageModel;
import dev.langchain4j.data.message.AiMessage;
import dev.langchain4j.data.message.ChatMessage;
import dev.langchain4j.model.output.Response;
import lombok.extern.slf4j.Slf4j;

import java.util.List;

/**
 * 谷歌 Gemini {@link ChatLanguageModel} 实现类，基于 Google AI Studio 提供的 OpenAI 兼容方案
 *
 * @author 研筑科技
 */
@Slf4j
public class GeminiChatModel implements ChatLanguageModel {

    public static final String BASE_URL = "https://generativelanguage.googleapis.com/v1beta/openai/";

    public static final String MODEL_DEFAULT = "gemini-2.5-flash";

    /**
     * 实际的聊天语言模型实现
     */
    private final ChatLanguageModel chatLanguageModel;

    public GeminiChatModel(ChatLanguageModel chatLanguageModel) {
        this.chatLanguageModel = chatLanguageModel;
    }

    @Override
    public Response<AiMessage> generate(List<ChatMessage> messages) {
        return chatLanguageModel.generate(messages);
    }

    public String modelName() {
        return "gemini";
    }
}
