Capabilities 返回 OpenAI 的能力
()
| 58 | |
| 59 | // Capabilities 返回 OpenAI 的能力 |
| 60 | func (p *OpenAIProvider) Capabilities() ProviderCapabilities { |
| 61 | caps := ProviderCapabilities{ |
| 62 | SupportToolCalling: true, |
| 63 | SupportSystemPrompt: true, |
| 64 | SupportStreaming: true, |
| 65 | SupportVision: true, |
| 66 | SupportAudio: true, |
| 67 | SupportReasoning: true, // o1/o3 模型 |
| 68 | SupportPromptCache: true, |
| 69 | SupportJSONMode: true, |
| 70 | SupportFunctionCall: true, |
| 71 | MaxTokens: 128000, |
| 72 | ToolCallingFormat: "openai", |
| 73 | ReasoningTokensIncluded: true, |
| 74 | CacheMinTokens: 1024, // Prompt Caching 最小 token 数 |
| 75 | } |
| 76 | |
| 77 | // 根据模型调整能力 |
| 78 | model := p.Config().Model |
| 79 | if isReasoningModel(model) { |
| 80 | // 推理模型不支持某些功能 |
| 81 | caps.SupportToolCalling = false |
| 82 | caps.SupportVision = false |
| 83 | caps.MaxTokens = 100000 // o1 模型限制 |
| 84 | } |
| 85 | |
| 86 | return caps |
| 87 | } |
| 88 | |
| 89 | // isReasoningModel 检查是否是推理模型 |
| 90 | func isReasoningModel(model string) bool { |