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
This commit is contained in:
mateo-berri 2026-09-05 19:21:34 -07:00
parent 15372967c6
commit a17fcecf70
5 changed files with 4 additions and 14 deletions

View file

@ -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,

View file

@ -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")

View file

@ -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={},

View file

@ -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

View file

@ -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))