Fix Issue #8413 max_output_tokens in openrouter/anthropic/claude-3.7-sonnet doesn't work correctly (#8415)

This commit is contained in:
Polly 2025-05-10 16:29:39 +08:00 committed by GitHub
parent ade059bfba
commit 90aab29bc0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -459,7 +459,6 @@ export enum I18nKey {
CONVERSATION$DOWNLOAD_ERROR = "CONVERSATION$DOWNLOAD_ERROR",
CONVERSATION$UPDATED = "CONVERSATION$UPDATED",
CONVERSATION$TOTAL_COST = "CONVERSATION$TOTAL_COST",
CONVERSATION$TOKENS_USED = "CONVERSATION$TOKENS_USED",
CONVERSATION$INPUT = "CONVERSATION$INPUT",
CONVERSATION$OUTPUT = "CONVERSATION$OUTPUT",
CONVERSATION$TOTAL = "CONVERSATION$TOTAL",

View File

@ -473,7 +473,10 @@ class LLM(RetryMixin, DebugMixin):
self.model_info['max_tokens'], int
):
self.config.max_output_tokens = self.model_info['max_tokens']
if 'claude-3-7-sonnet' in self.config.model:
if any(
model in self.config.model
for model in ['claude-3-7-sonnet', 'claude-3.7-sonnet']
):
self.config.max_output_tokens = 64000 # litellm set max to 128k, but that requires a header to be set
# Initialize function calling capability