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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
test(router): prove request-level bedrock_tags override deployment-level tags for acreate_batch
mateo-berrif5dc1a30107d
diff --git a/tests/test_litellm/test_router.py b/tests/test_litellm/test_router.pyindex c2c98c8869c..a13b3759865 100644--- a/tests/test_litellm/test_router.py+++ b/tests/test_litellm/test_router.py@@ -5430,3 +5430,63 @@ class TestRouterRequestTimeoutPropagation:)== 60)+++async def test_acreate_batch_request_bedrock_tags_override_deployment_tags():+ import httpx++ from litellm.llms.bedrock.common_utils import CommonBatchFilesUtils++ deployment_tags = [{"key": "application", "value": "config-level"}]+ request_tags = [{"key": "application", "value": "request-level"}]+ router = litellm.Router(+ model_list=[+ {+ "model_name": "bedrock-batch-model",+ "litellm_params": {+ "model": "bedrock/us.anthropic.claude-sonnet-5",+ "aws_batch_role_arn": "arn:aws:iam::123:role/batch-role",+ "aws_region_name": "us-west-2",+ "bedrock_tags": deployment_tags,+ },+ }+ ]+ )++ def fake_response():+ return httpx.Response(+ status_code=200,+ json={+ "jobArn": "arn:aws:bedrock:us-west-2:123:model-invocation-job/abc1234567",+ "status": "Submitted",+ },+ )++ mock_client = MagicMock()+ mock_client.post = AsyncMock(side_effect=lambda *args, **kwargs: fake_response())++ with patch.object(+ CommonBatchFilesUtils,+ "sign_aws_request",+ return_value=({"Authorization": "signed"}, b"{}"),+ ) as mock_sign, patch(+ "litellm.llms.custom_httpx.llm_http_handler.get_async_httpx_client",+ return_value=mock_client,+ ):+ await router.acreate_batch(+ model="bedrock-batch-model",+ input_file_id="s3://bucket/input.jsonl",+ endpoint="/v1/chat/completions",+ completion_window="24h",+ )+ assert mock_sign.call_args.kwargs["data"]["tags"] == deployment_tags++ await router.acreate_batch(+ model="bedrock-batch-model",+ input_file_id="s3://bucket/input.jsonl",+ endpoint="/v1/chat/completions",+ completion_window="24h",+ bedrock_tags=request_tags,+ )+ assert mock_sign.call_args.kwargs["data"]["tags"] == request_tags