From a17fcecf7092d0333afed4168d1954a1e9675d18 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Sat, 5 Sep 2026 19:21:34 -0700 Subject: [PATCH] refactor(azure_ai): type the Foundry param mapping override and drop test docstrings The AzureAIStudioConfig.map_openai_params override now carries dict[str, object] annotations instead of bare dict, and the docstrings added to the new tests go away since the test names already say what they cover. No behavior change --- litellm/llms/azure_ai/chat/transformation.py | 6 +++--- .../llm_cost_calc/test_llm_cost_calc_utils.py | 3 --- .../llms/azure_ai/chat/test_azure_ai_transformation.py | 3 --- tests/test_litellm/proxy/auth/test_model_checks.py | 3 --- .../router_utils/test_reasoning_effort_capability.py | 3 +-- 5 files changed, 4 insertions(+), 14 deletions(-) diff --git a/litellm/llms/azure_ai/chat/transformation.py b/litellm/llms/azure_ai/chat/transformation.py index 05abd5882c6..7c9a26c3f07 100644 --- a/litellm/llms/azure_ai/chat/transformation.py +++ b/litellm/llms/azure_ai/chat/transformation.py @@ -77,11 +77,11 @@ class AzureAIStudioConfig(OpenAIConfig): def map_openai_params( self, - non_default_params: dict, # mutable-ok: OpenAIConfig.map_openai_params signature - optional_params: dict, # mutable-ok: OpenAIConfig.map_openai_params signature + non_default_params: dict[str, object], # mutable-ok: OpenAIConfig.map_openai_params signature + optional_params: dict[str, object], # mutable-ok: OpenAIConfig.map_openai_params signature model: str, drop_params: bool, - ) -> dict: # mutable-ok: OpenAIConfig.map_openai_params signature + ) -> dict[str, object]: # mutable-ok: OpenAIConfig.map_openai_params signature if not azureAIGPT5Config.is_model_gpt_5_model(model): return super().map_openai_params( non_default_params=non_default_params, diff --git a/tests/test_litellm/litellm_core_utils/llm_cost_calc/test_llm_cost_calc_utils.py b/tests/test_litellm/litellm_core_utils/llm_cost_calc/test_llm_cost_calc_utils.py index caf97ba791d..40abb5bfca3 100644 --- a/tests/test_litellm/litellm_core_utils/llm_cost_calc/test_llm_cost_calc_utils.py +++ b/tests/test_litellm/litellm_core_utils/llm_cost_calc/test_llm_cost_calc_utils.py @@ -2061,9 +2061,6 @@ def test_generic_cost_per_token_azure_gpt_6_astra_foundry_price_sheet( def test_generic_cost_per_token_azure_ai_gpt_6_astra_flex_bills_the_standard_rate(_local_model_cost_map): - """Foundry sells gpt-6-astra on Standard Global only, so a flex service_tier bills the standard rate. - The bare OpenAI card the azure_ai route fell back to before this entry existed carries flex prices - at half rate (LIT-7081).""" usage = Usage(prompt_tokens=1000, completion_tokens=100, total_tokens=1100) standard = generic_cost_per_token(model="azure_ai/gpt-6-astra", usage=usage, custom_llm_provider="azure_ai") 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 25eca3b37ad..5ff0b729449 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 @@ -147,9 +147,6 @@ def _local_model_cost_map(monkeypatch: pytest.MonkeyPatch) -> None: def test_foundry_gpt_6_astra_keeps_sampling_params_when_reasoning_effort_is_none(_local_model_cost_map): - """A Foundry deployment reached through azure_ai reads the azure_ai/ card, where gpt-6-astra supports - reasoning_effort none, so temperature and top_p ride along; the bare OpenAI card says none is - unsupported and the route used to refuse temperature and drop top_p (LIT-7081).""" optional_params = AzureAIStudioConfig().map_openai_params( non_default_params={"reasoning_effort": "none", "temperature": 0.2, "top_p": 0.9}, optional_params={}, diff --git a/tests/test_litellm/proxy/auth/test_model_checks.py b/tests/test_litellm/proxy/auth/test_model_checks.py index 56dbcca61f3..36bfc4c5dd3 100644 --- a/tests/test_litellm/proxy/auth/test_model_checks.py +++ b/tests/test_litellm/proxy/auth/test_model_checks.py @@ -859,9 +859,6 @@ def test_add_known_models_refreshes_models_by_provider_for_wildcard_expansion(): def test_azure_ai_wildcard_lists_the_foundry_gpt_6_astra_entry(monkeypatch): - """A Foundry (azure_ai) deployment of gpt-6-astra only shows up under an azure_ai/* wildcard - when the cost map carries its own azure_ai/ entry; the azure/ entry from the OpenAI-on-Azure - price sheet never reaches the Foundry provider list (LIT-7081).""" import litellm from litellm.proxy.auth.model_checks import get_known_models_from_wildcard diff --git a/tests/test_litellm/router_utils/test_reasoning_effort_capability.py b/tests/test_litellm/router_utils/test_reasoning_effort_capability.py index b7499d1c975..3e1f26b6e1c 100644 --- a/tests/test_litellm/router_utils/test_reasoning_effort_capability.py +++ b/tests/test_litellm/router_utils/test_reasoning_effort_capability.py @@ -400,8 +400,7 @@ class TestGpt6AstraAdvertisesItsDocumentedLevels: def test_a_foundry_deployment_also_advertises_none(self, local_model_cost_map, model, custom_llm_provider): """Microsoft Foundry serves the same model but its API accepts reasoning_effort none (verified live: 200 with zero reasoning tokens, and it unlocks temperature), which - OpenAI's rejects, so an Azure deployment offers none on top of low through max, whether - it is reached through the azure route or the azure_ai (Foundry) route.""" + OpenAI's rejects, so an Azure deployment offers none on top of low through max.""" from litellm.utils import _get_model_info_helper model_info = dict(_get_model_info_helper(model=model, custom_llm_provider=custom_llm_provider))