fix(api): add type field to messages in Responses API#5701
Open
Patel230 wants to merge 5 commits intoKilo-Org:mainfrom
Open
fix(api): add type field to messages in Responses API#5701Patel230 wants to merge 5 commits intoKilo-Org:mainfrom
Patel230 wants to merge 5 commits intoKilo-Org:mainfrom
Conversation
OpenAI's Responses API requires the type field to be explicitly set in message objects when using array input. Some OpenAI-compatible endpoint providers fail with HTTP 500 errors when type is missing. Changes: - Add type: "message" to user and assistant messages in formatFullConversation - Add type: "message" to user message in completePrompt Fixes Kilo-Org#5700
🦋 Changeset detectedLatest commit: be1da59 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Fix the same issue found in: - openai-codex.ts (Codex provider) - openai-native.ts (OpenAI Native provider) All three Responses API handlers now include type: "message" for user and assistant messages. Related: Kilo-Org#5700
The original interface supported: - Regular messages with role (now also includes type: "message") - Other items like function_call/output without role My previous change was too restrictive.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OpenAI's Responses API requires the field to be explicitly set in message objects when using array input. Some OpenAI-compatible endpoint providers fail with HTTP 500 errors when is missing.
Changes
Before
After
Fixes
Fixes #5700