Skip to content

bug: handle empty Fireworks AI stream choices#1675

Open
mangopep wants to merge 1 commit into
Portkey-AI:mainfrom
mangopep:fireworks-empty-stream-choices
Open

bug: handle empty Fireworks AI stream choices#1675
mangopep wants to merge 1 commit into
Portkey-AI:mainfrom
mangopep:fireworks-empty-stream-choices

Conversation

@mangopep
Copy link
Copy Markdown

Description: (required)

Before Fix
The new reproduction test fails because the transformer reads parsedChunk.choices[0].index when choices is empty.

[![before-fix]]
Screenshot 2026-05-31 at 7 17 58 AM

After Fix
The same test passes after safely handling empty or missing choices.

![after-fix]
Screenshot 2026-05-31 at 7 19 23 AM

Tests Run/Test cases added: (required)

  • Added test for usage-only Fireworks stream chunk with empty choices
  • npx jest src/providers/fireworks-ai/chatComplete.test.ts --runInBand
  • npm run build

Type of Change:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unhandled exception in fireworks-ai streaming requests when stream chunk has empty choices

2 participants