Skip to content

Commit 2b58e65

Browse files
add dict edge case
1 parent 6484710 commit 2b58e65

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

sentry_sdk/integrations/openai.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,8 @@ def _set_completions_api_input_data(
383383
_commmon_set_input_data(span, kwargs)
384384
return
385385

386-
if not isinstance(messages, Iterable):
386+
# Special case following https://github.com/openai/openai-python/blob/3e0c05b84a2056870abf3bd6a5e7849020209cc3/src/openai/_utils/_transform.py#L194-L197
387+
if not isinstance(messages, Iterable) or isinstance(messages, dict):
387388
set_data_normalized(span, SPANDATA.GEN_AI_OPERATION_NAME, "chat")
388389
_commmon_set_input_data(span, kwargs)
389390
return

0 commit comments

Comments
 (0)