Skip to content

Commit 86019f7

Browse files
committed
fix: cases where content is a str we still need to wrap
1 parent 73ac9b7 commit 86019f7

File tree

1 file changed

+6
-1
lines changed
  • sentry_sdk/integrations/openai_agents

1 file changed

+6
-1
lines changed

sentry_sdk/integrations/openai_agents/utils.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,15 @@ def _set_input_data(span, get_response_kwargs):
130130
for message in get_response_kwargs.get("input", []):
131131
if "role" in message:
132132
normalized_role = normalize_message_role(message.get("role"))
133+
content = message.get("content")
133134
request_messages.append(
134135
{
135136
"role": normalized_role,
136-
"content": message.get("content"),
137+
"content": (
138+
[{"type": "text", "text": content}]
139+
if isinstance(content, str)
140+
else content
141+
),
137142
}
138143
)
139144
else:

0 commit comments

Comments
 (0)