Skip to content
Open
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
2 changes: 2 additions & 0 deletions chatblade/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ def map_from_stream(openai_gen):
final one being the completed Message"""
role, message = None, ""
for update in openai_gen:
if not update.choices:
continue # Skip the iteration if choices is empty
delta = [choice.delta for choice in update.choices][0]
if delta.role:
role = delta.role
Expand Down