Skip to content

Commit 1a853da

Browse files
authored
Merge branch 'master' into ivana/fix-pydantic-ai-slim-toolmanager
2 parents 9c306de + 499c041 commit 1a853da

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

sentry_sdk/integrations/anthropic.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def _set_input_data(
247247
"""
248248
Set input data for the span based on the provided keyword arguments for the anthropic message creation.
249249
"""
250-
set_data_normalized(span, SPANDATA.GEN_AI_OPERATION_NAME, "chat")
250+
span.set_data(SPANDATA.GEN_AI_OPERATION_NAME, "chat")
251251
system_instructions: "Union[str, Iterable[TextBlockParam]]" = kwargs.get("system") # type: ignore
252252
messages = kwargs.get("messages")
253253
if (
@@ -317,9 +317,7 @@ def _set_input_data(
317317
span, SPANDATA.GEN_AI_REQUEST_MESSAGES, messages_data, unpack=False
318318
)
319319

320-
set_data_normalized(
321-
span, SPANDATA.GEN_AI_RESPONSE_STREAMING, kwargs.get("stream", False)
322-
)
320+
span.set_data(SPANDATA.GEN_AI_RESPONSE_STREAMING, kwargs.get("stream", False))
323321

324322
kwargs_keys_to_attributes = {
325323
"max_tokens": SPANDATA.GEN_AI_REQUEST_MAX_TOKENS,
@@ -332,14 +330,12 @@ def _set_input_data(
332330
value = kwargs.get(key)
333331

334332
if value is not None and _is_given(value):
335-
set_data_normalized(span, attribute, value)
333+
span.set_data(attribute, value)
336334

337335
# Input attributes: Tools
338336
tools = kwargs.get("tools")
339337
if tools is not None and _is_given(tools) and len(tools) > 0:
340-
set_data_normalized(
341-
span, SPANDATA.GEN_AI_REQUEST_AVAILABLE_TOOLS, safe_serialize(tools)
342-
)
338+
span.set_data(SPANDATA.GEN_AI_REQUEST_AVAILABLE_TOOLS, safe_serialize(tools))
343339

344340

345341
def _set_output_data(

sentry_sdk/integrations/openai_agents/utils.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,8 @@ def _create_mcp_execute_tool_spans(
239239
description=f"execute_tool {output.name}",
240240
start_timestamp=span.start_timestamp,
241241
) as execute_tool_span:
242-
set_data_normalized(execute_tool_span, SPANDATA.GEN_AI_TOOL_TYPE, "mcp")
243-
set_data_normalized(
244-
execute_tool_span, SPANDATA.GEN_AI_TOOL_NAME, output.name
245-
)
242+
execute_tool_span.set_data(SPANDATA.GEN_AI_TOOL_TYPE, "mcp")
243+
execute_tool_span.set_data(SPANDATA.GEN_AI_TOOL_NAME, output.name)
246244
if should_send_default_pii():
247245
execute_tool_span.set_data(
248246
SPANDATA.GEN_AI_TOOL_INPUT, output.arguments

sentry_sdk/integrations/pydantic_ai/spans/ai_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def _set_output_data(span: "sentry_sdk.tracing.Span", response: "Any") -> None:
207207
if not response:
208208
return
209209

210-
set_data_normalized(span, SPANDATA.GEN_AI_RESPONSE_MODEL, response.model_name)
210+
span.set_data(SPANDATA.GEN_AI_RESPONSE_MODEL, response.model_name)
211211
try:
212212
# Extract text from ModelResponse
213213
if hasattr(response, "parts"):

0 commit comments

Comments
 (0)