Skip to content

Commit 9c563d2

Browse files
committed
fix: unknown model error add max tokens for missing anthropic models
chore: release add claude-3-5-sonnet-latest to getDefaultMaxTokens
1 parent 9074900 commit 9c563d2

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

.changeset/few-swans-reply.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'token.js': patch
3+
---
4+
5+
fix unknown model error add max tokens for missing anthropic models

src/handlers/anthropic.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -341,9 +341,19 @@ export const getDefaultMaxTokens = (model: string): number => {
341341
model === 'claude-instant-1.2'
342342
) {
343343
return 4096
344-
} else {
345-
throw new InputError(`Unknown model: ${model}`)
346344
}
345+
346+
if (
347+
model === 'claude-3-5-sonnet-latest' ||
348+
model === 'claude-3-5-sonnet-20241022' ||
349+
model === 'claude-3-7-sonnet-latest' ||
350+
model === 'claude-3-7-sonnet-20250219' ||
351+
model === 'claude-3-5-haiku-20241022'
352+
) {
353+
return 8192
354+
}
355+
356+
throw new InputError(`Unknown model: ${model}`)
347357
}
348358

349359
export const convertMessages = async (

0 commit comments

Comments
 (0)