Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

test: assert the responses bridge forwards aws_region_name

yuneng72abd11b4ce4
diff --git a/tests/unit/completion_extras/test_responses_bridge_provider_propagation.py b/tests/unit/completion_extras/test_responses_bridge_provider_propagation.py
new file mode 100644
index 00000000000..09ef1889818
--- /dev/null
+++ b/tests/unit/completion_extras/test_responses_bridge_provider_propagation.py
@@ -0,0 +1,59 @@
+from datetime import datetime
+from unittest.mock import patch
+
+import pytest
+
+from litellm.completion_extras.litellm_responses_transformation.handler import (
+ ResponsesToCompletionBridgeHandler,
+)
+from litellm.litellm_core_utils.litellm_logging import Logging as LiteLLMLogging
+from litellm.types.utils import ModelResponse
+
+MODEL = "openai.gpt-5.5"
+REGION = "us-east-2"
+
+
+def _bedrock_mantle_kwargs() -> dict:
+ messages = [{"role": "user", "content": "hi"}]
+ logging_obj = LiteLLMLogging(
+ litellm_call_id="test-call",
+ call_type="acompletion",
+ model=MODEL,
+ messages=messages,
+ function_id="fn-id",
+ stream=False,
+ start_time=datetime.now(),
+ )
+ return {
+ "model": MODEL,
+ "custom_llm_provider": "bedrock_mantle",
+ "messages": messages,
+ "optional_params": {},
+ "litellm_params": {
+ "aws_region_name": REGION,
+ "api_base": "https://bedrock-mantle.us-east-1.api.aws/v1",
+ "custom_llm_provider": "bedrock_mantle",
+ },
+ "headers": {},
+ "model_response": ModelResponse(),
+ "logging_obj": logging_obj,
+ }
+
+
+async def test_acompletion_forwards_aws_region_name_to_aresponses():
+ bridge = ResponsesToCompletionBridgeHandler()
+ cached = ModelResponse(id="chatcmpl-cached", model=MODEL)
+
+ async def _fake_aresponses(**kwargs):
+ _fake_aresponses.kwargs = kwargs
+ return cached
+
+ _fake_aresponses.kwargs = {}
+
+ with patch("litellm.aresponses", _fake_aresponses):
+ result = await bridge.acompletion(**_bedrock_mantle_kwargs())
+
+ assert result is cached
+ assert _fake_aresponses.kwargs["aws_region_name"] == REGION
+ assert _fake_aresponses.kwargs["custom_llm_provider"] == "bedrock_mantle"