Skip to content

Commit f153b59

Browse files
authored
fix(openai): handle None arguments in tool calls (#1339)
1 parent 017e488 commit f153b59

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

langfuse/openai.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,10 @@ def _extract_streamed_openai_response(resource: Any, chunks: Any) -> Any:
641641
curr[-1]["name"] = curr[-1]["name"] or getattr(
642642
tool_call_chunk, "name", None
643643
)
644+
645+
if curr[-1]["arguments"] is None:
646+
curr[-1]["arguments"] = ""
647+
644648
curr[-1]["arguments"] += getattr(
645649
tool_call_chunk, "arguments", None
646650
)

0 commit comments

Comments
 (0)