mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-12 23:01:21 +00:00
fix: resolve moonshotai/kimi-k2-instruct max_tokens limit issue
- Update moonshotai/kimi-k2-instruct maxTokens from 8192 to 16384 to match API limit - Add validation in BaseOpenAiCompatibleProvider to ensure max_tokens never exceeds model limits - Prevent 400 error when users set modelMaxTokens above API constraints Fixes #5729
This commit is contained in:
parent
8a3dcfb593
commit
740c580c16
2 changed files with 7 additions and 2 deletions
|
|
@ -89,7 +89,7 @@ export const groqModels = {
|
|||
description: "DeepSeek R1 Distill Llama 70B model, 128K context.",
|
||||
},
|
||||
"moonshotai/kimi-k2-instruct": {
|
||||
maxTokens: 8192,
|
||||
maxTokens: 16384,
|
||||
contextWindow: 131072,
|
||||
supportsImages: false,
|
||||
supportsPromptCache: false,
|
||||
|
|
|
|||
|
|
@ -69,11 +69,16 @@ export abstract class BaseOpenAiCompatibleProvider<ModelName extends string>
|
|||
): ApiStream {
|
||||
const {
|
||||
id: model,
|
||||
info: { maxTokens: max_tokens },
|
||||
info: { maxTokens: modelMaxTokens },
|
||||
} = this.getModel()
|
||||
|
||||
const temperature = this.options.modelTemperature ?? this.defaultTemperature
|
||||
|
||||
// Ensure max_tokens doesn't exceed the model's configured limit
|
||||
// Users can override with modelMaxTokens, but it should not exceed the model's actual API limit
|
||||
const userMaxTokens = this.options.modelMaxTokens
|
||||
const max_tokens = userMaxTokens ? Math.min(userMaxTokens, modelMaxTokens) : modelMaxTokens
|
||||
|
||||
const params: OpenAI.Chat.Completions.ChatCompletionCreateParamsStreaming = {
|
||||
model,
|
||||
max_tokens,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue