From f6d74abfb198a97891c0ea107e27dcb5b33ef9d9 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Wed, 14 Jan 2026 11:35:10 -0800 Subject: [PATCH] test_anthropic_messages_bedrock_converse_with_thinking --- litellm/proxy/proxy_config.yaml | 10 +++--- .../test_bedrock_anthropic_messages_test.py | 32 +++++++++++++++++++ 2 files changed, 37 insertions(+), 5 deletions(-) diff --git a/litellm/proxy/proxy_config.yaml b/litellm/proxy/proxy_config.yaml index 576ba24aac2..54a923e3bbb 100644 --- a/litellm/proxy/proxy_config.yaml +++ b/litellm/proxy/proxy_config.yaml @@ -1,10 +1,10 @@ model_list: - - model_name: anthropic/* + - model_name: us.anthropic.claude-sonnet-4-20250514-v1:0 litellm_params: - model: anthropic/* - - model_name: openai/* - litellm_params: - model: openai/* + model: bedrock/converse/us.anthropic.claude-sonnet-4-20250514-v1:0 + model_info: + litellm_provider: bedrock_converse + mode: chat general_settings: store_prompts_in_spend_logs: true \ No newline at end of file diff --git a/tests/pass_through_unit_tests/test_bedrock_anthropic_messages_test.py b/tests/pass_through_unit_tests/test_bedrock_anthropic_messages_test.py index 41edc8572cd..155af6b6a95 100644 --- a/tests/pass_through_unit_tests/test_bedrock_anthropic_messages_test.py +++ b/tests/pass_through_unit_tests/test_bedrock_anthropic_messages_test.py @@ -66,3 +66,35 @@ async def test_anthropic_messages_litellm_router_bedrock(): INSTANCE_BASE_ANTHROPIC_MESSAGES_TEST._validate_response(response) +@pytest.mark.asyncio +async def test_anthropic_messages_bedrock_converse_with_thinking(): + """ + Test that bedrock/converse model works with thinking parameter. + Validates the request body from issue where budget_tokens was being lost. + """ + router = Router( + model_list=[ + { + "model_name": "bedrock/converse/us.anthropic.claude-sonnet-4-20250514-v1:0", + "litellm_params": { + "model": "bedrock/converse/us.anthropic.claude-sonnet-4-20250514-v1:0", + }, + }, + ] + ) + + messages = [{"role": "user", "content": "What is 2+2?"}] + + response = await router.aanthropic_messages( + messages=messages, + model="bedrock/converse/us.anthropic.claude-sonnet-4-20250514-v1:0", + max_tokens=1026, + thinking={ + "type": "enabled", + "budget_tokens": 1025 + }, + ) + print("bedrock response: ", response) + + # Verify response + INSTANCE_BASE_ANTHROPIC_MESSAGES_TEST._validate_response(response)