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]

remove tool metadata

mubashir1osmanib13baffeb502
diff --git a/litellm/integrations/arize/_utils.py b/litellm/integrations/arize/_utils.py
index c17acd95554..ed02021312b 100644
--- a/litellm/integrations/arize/_utils.py
+++ b/litellm/integrations/arize/_utils.py
@@ -88,15 +88,18 @@ class ArizeOTELAttributes(BaseLLMObsOTELAttributes):
)
-def _set_tool_attributes(span: "Span", optional_params: dict):
- """Helper to set tool and function call attributes on span."""
+def _set_tool_attributes(span: "Span", optional_params: dict, metadata_tools: Optional[list] = None):
+ """Helper to set tool and function call attributes on span.
+
+ Supports both classic optional_params.tools and metadata-provided llm.tools (e.g., responses API).
+ """
from litellm.integrations._types.open_inference import (
MessageAttributes,
SpanAttributes,
ToolCallAttributes,
)
- tools = optional_params.get("tools")
+ tools = optional_params.get("tools") or metadata_tools or []
if tools:
for idx, tool in enumerate(tools):
function = tool.get("function")
@@ -250,8 +253,6 @@ def _set_retrieval_documents(span: "Span", metadata: Optional[dict], max_docs: i
if doc_entry:
docs.append(doc_entry)
-
- # Also set Phoenix/OpenInference-friendly flattened attributes per document so they render on retriever spans.
doc_index = len(docs) - 1
doc_id = item.get("id") or file_id
if doc_id is not None:
@@ -260,7 +261,6 @@ def _set_retrieval_documents(span: "Span", metadata: Optional[dict], max_docs: i
)
if contents:
- # Join content pieces to a single string for UI display
safe_set_attribute(
span,
f"{SpanAttributes.RETRIEVAL_DOCUMENTS}.{doc_index}.document.content",
@@ -409,15 +409,9 @@ def set_attributes(
span_kind = _infer_open_inference_span_kind(call_type=call_type)
- # If MCP tool calls are present, report span as TOOL even when call_type is generic (e.g., responses).
- if metadata and metadata.get("mcp_tool_call_metadata"):
- span_kind = OpenInferenceSpanKindValues.TOOL.value
-
safe_set_attribute(span, SpanAttributes.OPENINFERENCE_SPAN_KIND, span_kind)
attributes.set_messages(span, kwargs)
- _set_tool_attributes(span=span, optional_params=optional_params)
-
model_params = (
standard_logging_payload.get("model_parameters")
if standard_logging_payload