fix: claude-3-5-sonnet-20240620 max token error (#6843)

This commit is contained in:
Joe 2024-07-31 18:34:44 +08:00 committed by GitHub
parent 77c071e26f
commit df9bd36cab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -26,7 +26,6 @@ parameter_rules:
required: false required: false
- name: max_tokens - name: max_tokens
use_template: max_tokens use_template: max_tokens
required: true
default: 8192 default: 8192
min: 1 min: 1
max: 8192 max: 8192

View File

@ -116,6 +116,7 @@ class AnthropicLargeLanguageModel(LargeLanguageModel):
# Add the new header for claude-3-5-sonnet-20240620 model # Add the new header for claude-3-5-sonnet-20240620 model
extra_headers = {} extra_headers = {}
if model == "claude-3-5-sonnet-20240620": if model == "claude-3-5-sonnet-20240620":
if model_parameters.get('max_tokens') > 4096:
extra_headers["anthropic-beta"] = "max-tokens-3-5-sonnet-2024-07-15" extra_headers["anthropic-beta"] = "max-tokens-3-5-sonnet-2024-07-15"
if tools: if tools: