| | |
| | | import org.springframework.ai.chat.model.ChatModel; |
| | | import org.springframework.ai.embedding.EmbeddingModel; |
| | | import org.springframework.ai.vectorstore.VectorStore; |
| | | import java.time.Duration; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | */ |
| | | public interface AiModelFactory { |
| | | |
| | | ChatModel getOrCreateChatModel(AiPlatformEnum platform, String apiKey, String url, String model); |
| | | /** |
| | | * 获取(或创建并缓存)Chat 模型 |
| | | * |
| | | * @param temperature 采样温度,null 表示用默认值 |
| | | * @param maxTokens 单次回复最大 token 数,null 表示沿用模型默认值 |
| | | * @param timeout 单次调用超时 |
| | | */ |
| | | ChatModel getOrCreateChatModel(AiPlatformEnum platform, String apiKey, String url, String model, |
| | | Double temperature, Integer maxTokens, Duration timeout); |
| | | |
| | | ChatModel getDefaultChatModel(AiPlatformEnum platform); |
| | | |