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]

chore(responses): keep the session lookup inside the type-discipline budget

mateo-berri23e64c8b3d89
diff --git a/litellm/responses/litellm_completion_transformation/session_handler.py b/litellm/responses/litellm_completion_transformation/session_handler.py
index 2008006e6cf..1566bb1bdd7 100644
--- a/litellm/responses/litellm_completion_transformation/session_handler.py
+++ b/litellm/responses/litellm_completion_transformation/session_handler.py
@@ -108,7 +108,10 @@ class ResponsesSessionHandler:
if isinstance(_response_input_param, (str, list)):
response_input_param = _response_input_param
elif isinstance(_response_input_param, dict):
- response_input_param = cast(ResponseInputParam, [_response_input_param])
+ response_input_param = cast(
+ ResponseInputParam,
+ [_response_input_param], # mutable-ok: a lone input item still has to arrive as a list
+ )
if response_input_param:
chat_completion_messages = LiteLLMCompletionResponsesConfig.transform_responses_api_input_to_messages(
@@ -301,4 +304,4 @@ class ResponsesSessionHandler:
return spend_logs
verbose_proxy_logger.debug("Found no spend logs for previous response id %s", response_id)
- return []
+ return [] # mutable-ok: an empty result the caller only reads