Skip to content

Fix openrouter stream final chunk#64

Closed
rmichelena wants to merge 3 commits into
meltylabs:mainfrom
rmichelena:codex-fix-openrouter-stream-final-chunk
Closed

Fix openrouter stream final chunk#64
rmichelena wants to merge 3 commits into
meltylabs:mainfrom
rmichelena:codex-fix-openrouter-stream-final-chunk

Conversation

@rmichelena
Copy link
Copy Markdown

All streams were ending on:
UNDEFINED IS NOT AN OBJECT (EVALUATING 'I.CHOICES[0].DELTA')

so when you had tool calls, this actually failed quite early (as soon as the stream before the tool call, ended)
the fix was one single line in OpenAICompletionsAPIUtils.ts, line 202:

  • const toolCallDeltas = chunk.choices[0].delta.tool_calls || [];
  • const toolCallDeltas = chunk.choices?.[0]?.delta?.tool_calls || [];

Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@rmichelena rmichelena closed this Mar 10, 2026
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.

2 participants