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

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;

/**
 * 百川 {@link ChatLanguageModel} 实现类
 *
 * @author 研筑科技
 */
@Slf4j
public class BaiChuanChatModel implements ChatLanguageModel {

    public static final String BASE_URL = "https://api.baichuan-ai.com";

    public static final String MODEL_DEFAULT = "Baichuan4-Turbo";

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

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

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

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