diff --git a/tests/test_litellm/anthropic_interface/test_bedrock_rust_bridge_e2e.py b/tests/test_litellm/anthropic_interface/test_bedrock_rust_bridge_e2e.py new file mode 100644 index 00000000000..714b2865bb4 --- /dev/null +++ b/tests/test_litellm/anthropic_interface/test_bedrock_rust_bridge_e2e.py @@ -0,0 +1,20 @@ +import os + +import pytest + +import litellm + + +@pytest.mark.asyncio +async def test_bedrock_messages_with_rust() -> None: + response = await litellm.anthropic.messages.acreate( + model="bedrock/us.anthropic.claude-sonnet-4-5-20250929-v1:0", + messages=[{"role": "user", "content": "Say hello"}], + max_tokens=20, + api_key=os.getenv("AWS_BEARER_TOKEN_BEDROCK"), + aws_region_name="us-west-2", + rust=True, + ) + + assert response["content"][0]["text"] + assert response["_hidden_params"]["additional_headers"]["x-litellm-rust"] == "true" 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 53cce27aa16..fbd7e36e298 100644 --- a/tests/test_litellm/anthropic_interface/test_rust_bridge_messages.py +++ b/tests/test_litellm/anthropic_interface/test_rust_bridge_messages.py @@ -1,7 +1,6 @@ """Tests for the optional Rust-backed Anthropic Messages path.""" import importlib -import os from typing import cast import httpx @@ -123,29 +122,6 @@ 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