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(azure_ai): pin the tier the messages bridge sends when astra refuses max

mateo-berrifffe0bb0dc94
diff --git a/tests/test_litellm/llms/anthropic/experimental_pass_through/adapters/test_handler_reasoning_effort_normalization.py b/tests/test_litellm/llms/anthropic/experimental_pass_through/adapters/test_handler_reasoning_effort_normalization.py
index 56b754c3476..af7befecc33 100644
--- a/tests/test_litellm/llms/anthropic/experimental_pass_through/adapters/test_handler_reasoning_effort_normalization.py
+++ b/tests/test_litellm/llms/anthropic/experimental_pass_through/adapters/test_handler_reasoning_effort_normalization.py
@@ -82,3 +82,22 @@ class TestTheNormalizedTierIsTheTierSent:
self, local_model_cost_map, model, provider, effort, expected
):
assert _reasoning_effort_sent(model, provider, effort) == expected
+
+ @pytest.mark.parametrize(
+ "model, provider",
+ [
+ ("gpt-6-astra", "azure_ai"),
+ ("azure_ai/gpt-6-astra", "azure_ai"),
+ ("gpt-6-astra", "azure"),
+ ("us/gpt-6-astra", "azure"),
+ ],
+ )
+ def test_an_azure_hosted_astra_deployment_drops_to_the_tier_it_accepts(
+ self, local_model_cost_map, model, provider
+ ):
+ """The deployment answers ``max`` with a 400 naming ``none`` through ``xhigh``, so the rows
+ say so and the adapter sends the tier below instead of the rejected one."""
+ assert _reasoning_effort_sent(model, provider, "max") == "xhigh"
+
+ def test_the_openai_hosted_twin_still_sends_max(self, local_model_cost_map):
+ assert _reasoning_effort_sent("gpt-6-astra", "openai", "max") == "max"
diff --git a/tests/test_litellm/llms/azure_ai/chat/test_azure_ai_transformation.py b/tests/test_litellm/llms/azure_ai/chat/test_azure_ai_transformation.py
index 9924d77eb39..f8cc0b5071e 100644
--- a/tests/test_litellm/llms/azure_ai/chat/test_azure_ai_transformation.py
+++ b/tests/test_litellm/llms/azure_ai/chat/test_azure_ai_transformation.py
@@ -160,10 +160,10 @@ def test_foundry_gpt_6_astra_keeps_sampling_params_when_reasoning_effort_is_none
def test_a_gpt_5_name_without_a_foundry_row_keeps_reading_its_own_entry(
monkeypatch: pytest.MonkeyPatch, _local_model_cost_map
):
- """gpt-6-astra is the only gpt-5-family name with an azure_ai/ row. Reading an azure_ai/ key for
- the rest finds nothing, and an openai.azure.com base sends that name down the azure provider,
- which has no key for it either, so every effort answer would silently fall back to false and
- take temperature, top_p and logprobs down with it."""
+ """Most gpt-5-family names have no azure_ai/ row. Reading an azure_ai/ key for those finds
+ nothing, and an openai.azure.com base sends the name down the azure provider, which has no key
+ for it either, so every effort answer would silently fall back to false and take temperature,
+ top_p and logprobs down with it."""
monkeypatch.setenv("AZURE_AI_API_BASE", "https://example-resource.openai.azure.com")
monkeypatch.setenv("AZURE_AI_API_KEY", "placeholder")