Non-thinking sonnet has 8192 max tokens (#1860)

This commit is contained in:
Matt Rubens 2025-03-21 00:24:57 -04:00 committed by GitHub
parent 000df18503
commit 95ba760daf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 8 additions and 14 deletions

View file

@ -218,7 +218,7 @@ describe("AnthropicHandler", () => {
})
const result = handler.getModel()
expect(result.maxTokens).toBe(16_384)
expect(result.maxTokens).toBe(8192)
expect(result.thinking).toBeUndefined()
expect(result.temperature).toBe(0)
})

View file

@ -309,7 +309,7 @@ describe("VertexHandler", () => {
},
],
generationConfig: {
maxOutputTokens: 16384,
maxOutputTokens: 8192,
temperature: 0,
},
})
@ -914,7 +914,7 @@ describe("VertexHandler", () => {
})
const result = handler.getModel()
expect(result.maxTokens).toBe(16_384)
expect(result.maxTokens).toBe(8192)
expect(result.thinking).toBeUndefined()
expect(result.temperature).toBe(0)
})

View file

@ -217,9 +217,6 @@ export async function getGlamaModels() {
}
switch (rawModel.id) {
case rawModel.id.startsWith("anthropic/claude-3-7-sonnet"):
modelInfo.maxTokens = 16384
break
case rawModel.id.startsWith("anthropic/"):
modelInfo.maxTokens = 8192
break

View file

@ -261,7 +261,7 @@ export async function getOpenRouterModels(options?: ApiHandlerOptions) {
modelInfo.supportsPromptCache = true
modelInfo.cacheWritesPrice = 3.75
modelInfo.cacheReadsPrice = 0.3
modelInfo.maxTokens = rawModel.id === "anthropic/claude-3.7-sonnet:thinking" ? 128_000 : 16_384
modelInfo.maxTokens = rawModel.id === "anthropic/claude-3.7-sonnet:thinking" ? 128_000 : 8192
break
case rawModel.id.startsWith("anthropic/claude-3.5-sonnet-20240620"):
modelInfo.supportsPromptCache = true

View file

@ -211,9 +211,6 @@ export async function getUnboundModels() {
}
switch (true) {
case modelId.startsWith("anthropic/claude-3-7-sonnet"):
modelInfo.maxTokens = 16384
break
case modelId.startsWith("anthropic/"):
modelInfo.maxTokens = 8192
break

View file

@ -174,7 +174,7 @@ export const anthropicModels = {
thinking: true,
},
"claude-3-7-sonnet-20250219": {
maxTokens: 16_384,
maxTokens: 8192,
contextWindow: 200_000,
supportsImages: true,
supportsComputerUse: true,
@ -667,7 +667,7 @@ export const vertexModels = {
thinking: true,
},
"claude-3-7-sonnet@20250219": {
maxTokens: 16_384,
maxTokens: 8192,
contextWindow: 200_000,
supportsImages: true,
supportsComputerUse: true,

View file

@ -75,7 +75,7 @@ async function getOpenRouterProvidersForModel(modelId: string) {
modelInfo.supportsPromptCache = true
modelInfo.cacheWritesPrice = 3.75
modelInfo.cacheReadsPrice = 0.3
modelInfo.maxTokens = id === "anthropic/claude-3.7-sonnet:thinking" ? 64_000 : 16_384
modelInfo.maxTokens = id === "anthropic/claude-3.7-sonnet:thinking" ? 64_000 : 8192
break
case modelId.startsWith("anthropic/claude-3.5-sonnet-20240620"):
modelInfo.supportsPromptCache = true

View file

@ -15,7 +15,7 @@ describe("Model utility functions", () => {
/**
* Testing the specific fix in commit cc79178f:
* For thinking models, use apiConfig.modelMaxTokens if available,
* otherwise fall back to 16_384 (not modelInfo.maxTokens)
* otherwise fall back to 8192 (not modelInfo.maxTokens)
*/
it("should return apiConfig.modelMaxTokens for thinking models when provided", () => {