mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-29 06:33:28 +00:00
fix(anthropic): raise DEFAULT_ANTHROPIC_CHAT_MAX_TOKENS from 4096 to 128000 (#48502)
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
7e14638001
commit
3b8ad37296
2 changed files with 9 additions and 21 deletions
|
|
@ -627,7 +627,7 @@ BEDROCK_MIN_THINKING_BUDGET_TOKENS: Final = get_env_int("BEDROCK_MIN_THINKING_BU
|
|||
# Anthropic's Messages API rejects thinking.budget_tokens < 1024.
|
||||
ANTHROPIC_MIN_THINKING_BUDGET_TOKENS: Final = 1024
|
||||
REPLICATE_POLLING_DELAY_SECONDS: Final = get_env_float("REPLICATE_POLLING_DELAY_SECONDS", 0.5)
|
||||
DEFAULT_ANTHROPIC_CHAT_MAX_TOKENS: Final = get_env_int("DEFAULT_ANTHROPIC_CHAT_MAX_TOKENS", 4096)
|
||||
DEFAULT_ANTHROPIC_CHAT_MAX_TOKENS: Final = get_env_int("DEFAULT_ANTHROPIC_CHAT_MAX_TOKENS", 128000)
|
||||
DEFAULT_OCI_CHAT_MAX_TOKENS: Final = 4096
|
||||
TOGETHER_AI_4_B: Final = get_env_int("TOGETHER_AI_4_B", 4)
|
||||
TOGETHER_AI_8_B: Final = get_env_int("TOGETHER_AI_8_B", 8)
|
||||
|
|
|
|||
|
|
@ -2549,18 +2549,6 @@ def test_translate_system_message_preserves_cache_control():
|
|||
# ============ Dynamic max_tokens Tests ============
|
||||
|
||||
|
||||
def test_get_max_tokens_for_model_claude_3():
|
||||
"""
|
||||
Test that get_max_tokens_for_model returns correct value for Claude 3 models.
|
||||
Claude 3 models have max_output_tokens of 4096.
|
||||
"""
|
||||
config = AnthropicConfig()
|
||||
|
||||
# Claude 3 Sonnet should return 4096
|
||||
max_tokens = config.get_max_tokens_for_model("claude-3-sonnet-20240229")
|
||||
assert max_tokens == 4096
|
||||
|
||||
|
||||
def test_get_max_tokens_for_model_claude_35():
|
||||
"""
|
||||
Test that get_max_tokens_for_model returns correct value for Claude 3.5 models.
|
||||
|
|
@ -2581,24 +2569,24 @@ def test_get_max_tokens_for_model_claude_35():
|
|||
|
||||
def test_get_max_tokens_for_model_unknown():
|
||||
"""
|
||||
Test that get_max_tokens_for_model returns 4096 fallback for unknown models.
|
||||
Test that get_max_tokens_for_model returns 128000 fallback for unknown models.
|
||||
"""
|
||||
config = AnthropicConfig()
|
||||
|
||||
# Unknown model should return 4096 as fallback
|
||||
# Unknown model should return 128000 as fallback
|
||||
max_tokens = config.get_max_tokens_for_model("unknown-model-xyz")
|
||||
assert max_tokens == 4096
|
||||
assert max_tokens == 128000
|
||||
|
||||
|
||||
def test_get_max_tokens_for_model_none():
|
||||
"""
|
||||
Test that get_max_tokens_for_model returns 4096 fallback when model is None.
|
||||
Test that get_max_tokens_for_model returns 128000 fallback when model is None.
|
||||
"""
|
||||
config = AnthropicConfig()
|
||||
|
||||
# None model should return 4096 as fallback
|
||||
# None model should return 128000 as fallback
|
||||
max_tokens = config.get_max_tokens_for_model(None)
|
||||
assert max_tokens == 4096
|
||||
assert max_tokens == 128000
|
||||
|
||||
|
||||
def test_get_config_with_model_uses_dynamic_max_tokens():
|
||||
|
|
@ -2639,10 +2627,10 @@ def test_get_config_with_model_uses_dynamic_max_tokens():
|
|||
|
||||
def test_get_config_without_model_uses_fallback():
|
||||
"""
|
||||
Test that get_config without model parameter uses 4096 fallback.
|
||||
Test that get_config without model parameter uses 128000 fallback.
|
||||
"""
|
||||
config = AnthropicConfig.get_config()
|
||||
assert config["max_tokens"] == 4096
|
||||
assert config["max_tokens"] == 128000
|
||||
|
||||
|
||||
def test_get_config_does_not_leak_module_constants():
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue