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: fix lint error

Yuta Saito60f40856e12e
diff --git a/litellm/responses/litellm_completion_transformation/transformation.py b/litellm/responses/litellm_completion_transformation/transformation.py
index a69f2c48bcf..eaa80c6cfe4 100644
--- a/litellm/responses/litellm_completion_transformation/transformation.py
+++ b/litellm/responses/litellm_completion_transformation/transformation.py
@@ -2,6 +2,7 @@
Handles transforming from Responses API -> LiteLLM completion (Chat Completion API)
"""
+from collections.abc import Sequence
from typing import Any, Dict, List, Literal, Optional, Set, Tuple, Union, cast
from openai.types.responses import ResponseFunctionToolCall
@@ -452,13 +453,17 @@ class LiteLLMCompletionResponsesConfig:
call_id = ""
if role == "assistant":
- tool_calls = None
+ tool_calls: Any = None
if isinstance(tool_call_message, dict):
tool_calls = tool_call_message.get("tool_calls")
else:
tool_calls = getattr(tool_call_message, "tool_calls", None)
- if tool_calls and len(tool_calls) > 0:
+ if (
+ isinstance(tool_calls, Sequence)
+ and not isinstance(tool_calls, (str, bytes))
+ and len(tool_calls) > 0
+ ):
first_call = tool_calls[0]
call_id_raw = None
if isinstance(first_call, dict):