Fix rounding of max tokens (#6808)

This commit is contained in:
Matt Rubens 2025-08-07 10:11:01 -04:00 committed by GitHub
parent 212297755f
commit 518c558d56
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -92,7 +92,7 @@ export const getModelMaxOutputTokens = ({
// If model has explicit maxTokens, clamp it to 20% of the context window
if (model.maxTokens) {
return Math.min(model.maxTokens, model.contextWindow * 0.2)
return Math.min(model.maxTokens, Math.ceil(model.contextWindow * 0.2))
}
// For non-Anthropic formats without explicit maxTokens, return undefined