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

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} 实现类
 *
 * 1. API 文档：<a href="https://docs.siliconflow.cn/cn/api-reference/chat-completions/chat-completions">API 文档</a>
 *
 * @author fansili
 */
@Slf4j
public class SiliconFlowChatModel implements ChatLanguageModel {

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

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

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

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