Skip to content

Commit 1b7085d

Browse files
fix(integrations): openai-agents fixing the input messages structure which was wrapped too much in some cases (#5203)
#### Issues Closes https://linear.app/getsentry/issue/TET-1551/openai-agents-broken-input-messages
1 parent 3eac23c commit 1b7085d

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": [{"type": "text", "text": 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)