Skip to content

Commit

Permalink
chore: catch empty choices array
Browse files Browse the repository at this point in the history
  • Loading branch information
darkskygit committed Sep 3, 2024
1 parent 12d73ee commit 2f0bca4
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ export class OpenAIProvider
);

for await (const message of result) {
if (!Array.isArray(message.choices) || !message.choices.length) {
continue;
}
const content = message.choices[0].delta.content;
if (content) {
yield content;
Expand Down

0 comments on commit 2f0bca4

Please sign in to comment.