From 083f24387970fc41fcd9d2092d439ec98efd3aaa Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Tue, 28 Jul 2026 20:38:03 -0700 Subject: [PATCH] test(rust): add live Bedrock messages bridge call Co-authored-by: Cursor --- .../test_rust_bridge_messages.py | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/test_litellm/anthropic_interface/test_rust_bridge_messages.py b/tests/test_litellm/anthropic_interface/test_rust_bridge_messages.py index fbd7e36e298..53cce27aa16 100644 --- a/tests/test_litellm/anthropic_interface/test_rust_bridge_messages.py +++ b/tests/test_litellm/anthropic_interface/test_rust_bridge_messages.py @@ -1,6 +1,7 @@ """Tests for the optional Rust-backed Anthropic Messages path.""" import importlib +import os from typing import cast import httpx @@ -122,6 +123,29 @@ def test_load_rust_messages_returns_injected_impl(): assert rust_messages.load_rust_messages() is bridge +@pytest.mark.asyncio +async def test_bedrock_invoke_uses_native_rust_bridge(): + model = os.getenv( + "BEDROCK_MODEL", + "us.anthropic.claude-sonnet-4-5-20250929-v1:0", + ) + + response = await litellm.anthropic.messages.acreate( + model=f"bedrock/{model}", + messages=[{"role": "user", "content": "Reply with one word: hello"}], + max_tokens=32, + api_key=os.getenv("AWS_BEARER_TOKEN_BEDROCK"), + aws_region_name=os.getenv("AWS_REGION_NAME", "us-west-2"), + rust=True, + ) + + assert response["type"] == "message" + assert response["role"] == "assistant" + assert response["content"][0]["type"] == "text" + assert response["content"][0]["text"].strip() + assert response["_hidden_params"]["additional_headers"]["x-litellm-rust"] == "true" + + def test_configuring_messages_does_not_enable_ocr(): from litellm.rust_bridge.ocr import rust_ocr_enabled