Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions langfuse/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,10 @@ def _extract_streamed_openai_response(resource: Any, chunks: Any) -> Any:
curr[-1]["name"] = curr[-1]["name"] or getattr(
tool_call_chunk, "name", None
)

if curr[-1]["arguments"] is None:
curr[-1]["arguments"] = ""

curr[-1]["arguments"] += getattr(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good fix: initializing curr[-1]['arguments'] as empty string avoids TypeError. However, consider also defaulting the getattr call (e.g. using '' instead of None) so that if tool_call_chunk.arguments is None, concatenation won’t fail.

tool_call_chunk, "arguments", None
)
Expand Down