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]

fix: guard code_interpreter conversion to bash_code_execution results only

Andrzej Pomirski8f6011722882
diff --git a/litellm/llms/anthropic/chat/handler.py b/litellm/llms/anthropic/chat/handler.py
index 387901588f0..91fd3034066 100644
--- a/litellm/llms/anthropic/chat/handler.py
+++ b/litellm/llms/anthropic/chat/handler.py
@@ -703,6 +703,8 @@ class ModelResponseIterator:
"""
results = []
for tr in self.tool_results:
+ if tr.get("type") != "bash_code_execution_tool_result":
+ continue
call_id = tr.get("tool_use_id", "")
content = tr.get("content", {})
if isinstance(content, dict):
diff --git a/litellm/llms/anthropic/chat/transformation.py b/litellm/llms/anthropic/chat/transformation.py
index 238d72eda44..ca101df0e95 100644
--- a/litellm/llms/anthropic/chat/transformation.py
+++ b/litellm/llms/anthropic/chat/transformation.py
@@ -1767,6 +1767,8 @@ class AnthropicConfig(AnthropicModelInfo, BaseConfig):
pass
code_interpreter_results = []
for tr in tool_results:
+ if tr.get("type") != "bash_code_execution_tool_result":
+ continue
call_id = tr.get("tool_use_id", "")
content = tr.get("content", {})
if isinstance(content, dict):