Skip to content

Commit

Permalink
fix (examples/next-fastapi): Handle JSON encoding for text stream par…
Browse files Browse the repository at this point in the history
…ts (vercel#3200)
  • Loading branch information
Michael Oliver authored Oct 13, 2024
1 parent c0cee93 commit 827b03a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/next-fastapi/api/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ def stream_text(messages: List[ClientMessage], protocol: str = 'data'):
draft_tool_calls[draft_tool_calls_index]["arguments"] += arguments

else:
yield '0:"{text}"\n'.format(text=choice.delta.content)
yield '0:{text}\n'.format(text=json.dumps(choice.delta.content))

if chunk.choices == []:
usage = chunk.usage
Expand Down

0 comments on commit 827b03a

Please sign in to comment.