|
@@ -32,7 +32,6 @@ export class AnthropicHandler implements ApiHandler, SingleCompletionHandler {
|
|
|
const cacheControl: CacheControlEphemeral = { type: "ephemeral" }
|
|
const cacheControl: CacheControlEphemeral = { type: "ephemeral" }
|
|
|
let { id: modelId, info: modelInfo } = this.getModel()
|
|
let { id: modelId, info: modelInfo } = this.getModel()
|
|
|
const maxTokens = modelInfo.maxTokens || 8192
|
|
const maxTokens = modelInfo.maxTokens || 8192
|
|
|
- const budgetTokens = this.options.anthropicThinking ?? Math.min(maxTokens - 1, 8192)
|
|
|
|
|
let temperature = this.options.modelTemperature ?? ANTHROPIC_DEFAULT_TEMPERATURE
|
|
let temperature = this.options.modelTemperature ?? ANTHROPIC_DEFAULT_TEMPERATURE
|
|
|
let thinking: BetaThinkingConfigParam | undefined = undefined
|
|
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.
|
|
// `claude-3-7-sonnet-20250219` model with a thinking budget.
|
|
|
// We can handle this more elegantly in the future.
|
|
// We can handle this more elegantly in the future.
|
|
|
modelId = "claude-3-7-sonnet-20250219"
|
|
modelId = "claude-3-7-sonnet-20250219"
|
|
|
|
|
+ const budgetTokens = this.options.anthropicThinking ?? Math.max(maxTokens * 0.8, 1024)
|
|
|
thinking = { type: "enabled", budget_tokens: budgetTokens }
|
|
thinking = { type: "enabled", budget_tokens: budgetTokens }
|
|
|
temperature = 1.0
|
|
temperature = 1.0
|
|
|
}
|
|
}
|