mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-07 08:26:51 +00:00
Fix budgetTokens
This commit is contained in:
parent
8971e47b96
commit
33fd3bd6b3
2 changed files with 4 additions and 6 deletions
|
|
@ -32,7 +32,6 @@ export class AnthropicHandler implements ApiHandler, SingleCompletionHandler {
|
|||
const cacheControl: CacheControlEphemeral = { type: "ephemeral" }
|
||||
let { id: modelId, info: modelInfo } = this.getModel()
|
||||
const maxTokens = modelInfo.maxTokens || 8192
|
||||
const budgetTokens = this.options.anthropicThinking ?? Math.min(maxTokens - 1, 8192)
|
||||
let temperature = this.options.modelTemperature ?? ANTHROPIC_DEFAULT_TEMPERATURE
|
||||
let thinking: BetaThinkingConfigParam | undefined = undefined
|
||||
|
||||
|
|
@ -42,6 +41,7 @@ export class AnthropicHandler implements ApiHandler, SingleCompletionHandler {
|
|||
// `claude-3-7-sonnet-20250219` model with a thinking budget.
|
||||
// We can handle this more elegantly in the future.
|
||||
modelId = "claude-3-7-sonnet-20250219"
|
||||
const budgetTokens = this.options.anthropicThinking ?? Math.max(maxTokens * 0.8, 1024)
|
||||
thinking = { type: "enabled", budget_tokens: budgetTokens }
|
||||
temperature = 1.0
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,13 +109,11 @@ export class OpenRouterHandler implements ApiHandler, SingleCompletionHandler {
|
|||
}
|
||||
|
||||
let temperature = this.options.modelTemperature ?? defaultTemperature
|
||||
|
||||
const maxTokens = modelInfo.maxTokens
|
||||
const budgetTokens = this.options.anthropicThinking ?? Math.min((maxTokens ?? 8192) - 1, 8192)
|
||||
let thinking: BetaThinkingConfigParam | undefined = undefined
|
||||
|
||||
// Anthropic "Thinking" models require a temperature of 1.0.
|
||||
if (modelInfo.thinking) {
|
||||
const maxTokens = modelInfo.maxTokens || 8192
|
||||
const budgetTokens = this.options.anthropicThinking ?? Math.max(maxTokens * 0.8, 1024)
|
||||
thinking = { type: "enabled", budget_tokens: budgetTokens }
|
||||
temperature = 1.0
|
||||
}
|
||||
|
|
@ -125,7 +123,7 @@ export class OpenRouterHandler implements ApiHandler, SingleCompletionHandler {
|
|||
|
||||
const completionParams: OpenRouterChatCompletionParams = {
|
||||
model: modelId,
|
||||
max_tokens: maxTokens,
|
||||
max_tokens: modelInfo.maxTokens,
|
||||
temperature,
|
||||
thinking, // OpenRouter is temporarily supporting this.
|
||||
top_p: topP,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue