Skip to content

Commit 9c6a71d

Browse files
authored
fix(openai): add check for metadata NotGiven (#1240)
1 parent 404ebbf commit 9c6a71d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

langfuse/openai.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,11 @@ def _get_langfuse_data_from_kwargs(resource: OpenAiDefinition, kwargs):
355355
raise ValueError("parent_observation_id requires trace_id to be set")
356356

357357
metadata = kwargs.get("metadata", {})
358-
if metadata is not None and not isinstance(metadata, dict):
358+
if (
359+
metadata is not None
360+
and not isinstance(metadata, NotGiven)
361+
and not isinstance(metadata, dict)
362+
):
359363
raise TypeError("metadata must be a dictionary")
360364

361365
model = kwargs.get("model", None) or None

0 commit comments

Comments
 (0)