refactor(responses): drop the api_base cast and mark the header merge mutable-ok
Some checks are pending
LiteLLM Rust / rust-lint (push) Waiting to run
LiteLLM Rust / rust-test (push) Waiting to run
LiteLLM Rust / rust-wheel (push) Waiting to run
Terraform Modules / fmt, validate, test (aws) (push) Waiting to run
Terraform Modules / fmt, validate, test (gcp) (push) Waiting to run
Terraform Provider / gofmt, vet, build, test (push) Waiting to run
Terraform Provider / Provider endpoints vs proxy OpenAPI schema (push) Waiting to run

This commit is contained in:
mateo-berri 2026-09-16 15:45:50 -07:00
parent 09f3a5160a
commit ebae692a0d
2 changed files with 12 additions and 3 deletions

View file

@ -34,7 +34,11 @@ class AzureAIResponsesAPIConfig(AzureOpenAIResponsesAPIConfig):
litellm_params=params.model_dump(),
api_key_header=api_key_header_for_base(AzureFoundryModelInfo.get_api_base(params.api_base)),
)
return {**headers, **auth_headers, "Content-Type": "application/json"}
return { # mutable-ok: the handler updates the returned headers in place per the dict contract
**headers,
**auth_headers,
"Content-Type": "application/json",
}
def supports_native_websocket(self) -> bool:
return False

View file

@ -492,6 +492,11 @@ def _resolve_responses_api_provider_config(
return OpenAILikeResponsesConfig()
def _api_base_kwarg(kwargs: Mapping[str, object]) -> str | None:
api_base: Final = kwargs.get("api_base")
return api_base if isinstance(api_base, str) else None
def _will_bridge_to_chat_completions(
model: str,
custom_llm_provider: str | None,
@ -622,7 +627,7 @@ async def aresponses(
custom_llm_provider,
bool(kwargs.get("use_chat_completions_api")),
kwargs.get("model_info"),
cast(str | None, kwargs.get("api_base")),
_api_base_kwarg(kwargs),
),
):
(
@ -792,7 +797,7 @@ def _apply_prompt_management_to_responses_call(
custom_llm_provider,
use_chat_completions_api,
kwargs.get("model_info"),
cast(str | None, kwargs.get("api_base")),
_api_base_kwarg(kwargs),
),
):
(