Skip to content

fix(js/plugins/compat-oai): Content is not empty if tool_calls is []#5224

Merged
ifielker merged 2 commits intomainfrom
if-fixoai
May 1, 2026
Merged

fix(js/plugins/compat-oai): Content is not empty if tool_calls is []#5224
ifielker merged 2 commits intomainfrom
if-fixoai

Conversation

@ifielker
Copy link
Copy Markdown
Collaborator

@ifielker ifielker commented May 1, 2026

This fixes #5206

Checklist (if applicable):

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request addresses a bug in the OpenAI compatibility layer where message content was being ignored when tool_calls was provided as an empty array. The fix ensures that toolRequestParts is only processed if it contains elements, and a new test case has been added to verify this behavior. Feedback indicates that the same logic should be applied to the streaming response handler (fromOpenAIChunkChoice) to maintain consistency and prevent similar issues in streaming scenarios.

Comment thread js/plugins/compat-oai/src/model.ts
@ifielker ifielker requested a review from ssbushi May 1, 2026 19:06
@ifielker ifielker merged commit d979652 into main May 1, 2026
8 checks passed
@ifielker ifielker deleted the if-fixoai branch May 1, 2026 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[JS] compat-oai: Empty content when tool_calls is empty array

2 participants