fix(xai, deepseek, groq, mistral): send null content for tool-only assistant messages#14758
Open
blackwell-systems wants to merge 1 commit intovercel:mainfrom
Open
fix(xai, deepseek, groq, mistral): send null content for tool-only assistant messages#14758blackwell-systems wants to merge 1 commit intovercel:mainfrom
blackwell-systems wants to merge 1 commit intovercel:mainfrom
Conversation
…sistant messages When an assistant message contains only tool-call parts (no text), the converter emits content: "" which providers backed by AWS Bedrock reject with ValidationException: text content blocks must be non-empty. This applies the same fix from vercel#13744 (openai, openai-compatible) to the four remaining providers: change content: text to content: text || null. - Update converters in all four packages - Update type definitions (xai, mistral) to accept string | null - Update test expectations to expect null instead of "" - Add patch changeset for all four packages Fixes vercel#14612
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
Follow-up to #13744. Applies the same
content: text || nullfix to the four remaining providers that were missed.When an assistant message contains only tool-call parts (no text), the converter emits
content: "". Providers backed by AWS Bedrock reject this withValidationException: messages: text content blocks must be non-empty.Changes
packages/xai/src/convert-to-xai-chat-messages.ts:content: text→content: text || nullpackages/deepseek/src/chat/convert-to-deepseek-chat-messages.ts: samepackages/groq/src/convert-to-groq-chat-messages.ts: samepackages/mistral/src/convert-to-mistral-chat-messages.ts: sameXaiAssistantMessageandMistralAssistantMessagetypes to acceptstring | null(DeepSeek and Groq types already did)nullinstead of""Checklist
Fixes #14612