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
fix(responses): narrow response params without cast
Devin AI96b7fbb1fc39
diff --git a/litellm/responses/utils.py b/litellm/responses/utils.pyindex 42bd99ccae2..d3418da585d 100644--- a/litellm/responses/utils.py+++ b/litellm/responses/utils.py@@ -285,10 +285,11 @@ class ResponsesAPIRequestUtils:)# decode previous_response_id if it's a litellm encoded id- if "previous_response_id" in non_default_params:+ previous_response_id: Final = non_default_params.get("previous_response_id")+ if isinstance(previous_response_id, str):decoded_previous_response_id: Final = (ResponsesAPIRequestUtils.decode_previous_response_id_to_original_previous_response_id(- cast(str, non_default_params["previous_response_id"])+ previous_response_id))non_default_params["previous_response_id"] = decoded_previous_response_id@@ -296,9 +297,8 @@ class ResponsesAPIRequestUtils:if "metadata" in non_default_params:from litellm.utils import add_openai_metadata- converted_metadata: Final = add_openai_metadata(- cast(Mapping[str, object] | None, non_default_params["metadata"])- )+ raw_metadata: Final = non_default_params["metadata"]+ converted_metadata: Final = add_openai_metadata(raw_metadata if _is_object_dict(raw_metadata) else None)if converted_metadata is not None:non_default_params["metadata"] = converted_metadataelse: