Capabilities 返回 Moonshot 的能力
()
| 55 | |
| 56 | // Capabilities 返回 Moonshot 的能力 |
| 57 | func (p *MoonshotProvider) Capabilities() ProviderCapabilities { |
| 58 | model := p.Config().Model |
| 59 | supportsReasoning := isThinkingModel(model) |
| 60 | |
| 61 | caps := ProviderCapabilities{ |
| 62 | SupportToolCalling: true, |
| 63 | SupportSystemPrompt: true, |
| 64 | SupportStreaming: true, |
| 65 | SupportVision: false, |
| 66 | SupportAudio: false, |
| 67 | SupportReasoning: supportsReasoning, // K2 模型支持 reasoning |
| 68 | SupportPromptCache: false, |
| 69 | SupportJSONMode: true, |
| 70 | SupportFunctionCall: true, |
| 71 | MaxTokens: 128000, // 默认 128K |
| 72 | ToolCallingFormat: "openai", |
| 73 | } |
| 74 | |
| 75 | // 根据模型调整 MaxTokens |
| 76 | switch model { |
| 77 | case "moonshot-v1-32k": |
| 78 | caps.MaxTokens = 32000 |
| 79 | case "moonshot-v1-128k": |
| 80 | caps.MaxTokens = 128000 |
| 81 | case "kimi-k2-thinking": |
| 82 | caps.MaxTokens = 32000 // K2 thinking 模型 |
| 83 | } |
| 84 | |
| 85 | return caps |
| 86 | } |
| 87 | |
| 88 | // MoonshotFactory Moonshot 工厂 |
| 89 | type MoonshotFactory struct{} |