大模型配置
参数说明
名称 | 描述 |
LLMType | 大模型类型,只要是符合 OpenAI API 协议的大模型,都填写 openai。 |
Model | 具体的模型名称,例如 gpt-4o。 |
APIKey | 大模型的 APIKey。 |
APIUrl | 大模型的 APIUrl。 |
Streaming | 是否流式传输。 |
SystemPrompt | 提示词。 |
Timeout | 超时时间,默认为 3 秒(单位:秒)。 |
History | 设置 LLM 的上下文轮次,默认值:0(不提供上下文管理),最大值:50(提供最近 50 轮的上下文管理)。 |
MetaInfo | 自定义参数,会放在请求的 body 中透传给大模型。 |
LLMConfig 配置示例
说明:
只要是符合
OpenAI API 协议的大模型,我们都可以支持,LLMType 填写 openai,其他参数根据实际情况填写即可。OpenAI
"LLMConfig": {"LLMType": "openai","Model":"gpt-4o","APIKey":"api-key","APIUrl":"https://api.openai.com/v1/chat/completions","Streaming": true,"SystemPrompt": "你是一个个人助手","Timeout": 3.0,"History": 5,"MetaInfo": {}}
Gemini
LLMConfig: "{"APIKey":"a...","APIUrl":"https://xxx/chat/completions","LLMType":"openai","Model":"gemini-2.0-flash","Streaming":true,"SystemPrompt":""}"
Minimax
LLMConfig: "{"APIKey":"a...","APIUrl":"https://xxx/chat/completions","LLMType":"openai","Model":"MiniMax-M2.5","Streaming":true,"SystemPrompt":""}"
混元
"LLMConfig":{"LLMType": "openai","Model": "hunyuan-standard", // hunyuan-turbo、hunyuan-standard"APIKey": "hunyuan-apikey","APIUrl": "https://hunyuan.cloud.tencent.com/openai/v1/chat/completions","Streaming": true,"History": 10,"MetaInfo": {}}
Dify
LLMConfig: "{"LLMType":"dify","APIKey":"app.....","APIUrl":"https://xxx/v1/chat-messages","Streaming":true,"Inputs":{},"User":"xxx","ConversationId":""}"
Coze
LLMConfig: "{"APIKey":"...","APIUrl":"https://xxx/v3/chat?conversation_id=xx","BotId":"xxx","LLMType":"coze","Streaming":true,"UserId":"xx","conversation_id":"xxx",}"
大模型的请求
此外我们会在 http header 中增加多个参数来辅助用户支持更复杂的逻辑:
X-Task-Id: <task_id_value> // 此任务的 id,X-Rquest-Id: <request_id> // 此次请求的id, 重试会携带相同的requestIdX-Sdk-App-Id: SdkAppIdX-User-Id:UserIdX-Room-Id:RoomIdX-Room-Id-Type: "0" // "0"表示数字房间号 "1"表示字符串房间号