-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Bug: tool-only assistant messages send content:"" in xai, deepseek, groq, mistral providers #14612
Copy link
Copy link
Closed
Labels
ai/providerrelated to a provider package. Must be assigned together with at least one `provider/*` labelrelated to a provider package. Must be assigned together with at least one `provider/*` labelbugSomething isn't working as documentedSomething isn't working as documentedprovider/deepseekIssues related to the @ai-sdk/deepseek providerIssues related to the @ai-sdk/deepseek providerprovider/groqIssues related to the @ai-sdk/groq providerIssues related to the @ai-sdk/groq providerprovider/mistralIssues related to the @ai-sdk/mistral providerIssues related to the @ai-sdk/mistral providerprovider/xaiIssues related to the @ai-sdk/xai providerIssues related to the @ai-sdk/xai providerreproduction provided
Metadata
Metadata
Assignees
Labels
ai/providerrelated to a provider package. Must be assigned together with at least one `provider/*` labelrelated to a provider package. Must be assigned together with at least one `provider/*` labelbugSomething isn't working as documentedSomething isn't working as documentedprovider/deepseekIssues related to the @ai-sdk/deepseek providerIssues related to the @ai-sdk/deepseek providerprovider/groqIssues related to the @ai-sdk/groq providerIssues related to the @ai-sdk/groq providerprovider/mistralIssues related to the @ai-sdk/mistral providerIssues related to the @ai-sdk/mistral providerprovider/xaiIssues related to the @ai-sdk/xai providerIssues related to the @ai-sdk/xai providerreproduction provided
Type
Fields
Give feedbackNo fields configured for issues without a type.
Summary
Follow-up to #13466 / #13744.
The same pattern that caused Bedrock
ValidationException: messages: text content blocks must be non-emptyin@ai-sdk/openai-compatibleand@ai-sdk/openaialso exists in four other provider packages. When an assistant message contains onlytool-callparts (no text), the converter emitscontent: "", which Bedrock-backed endpoints reject.Affected files
packages/xai/src/convert-to-xai-chat-messages.ts:111packages/deepseek/src/chat/convert-to-deepseek-chat-messages.ts:126packages/groq/src/convert-to-groq-chat-messages.ts:105packages/mistral/src/convert-to-mistral-chat-messages.ts:122Each has the same shape:
Proposed fix
Apply the same change as #13744:
This matches the OpenAI spec (content is nullable when
tool_callsis present) and what official OpenAI SDKs send.Scope
nullfor tool-only assistant messages.Note: Mistral uses its own API shape; verify Mistral's spec accepts
nullbefore applying there. The other three (xai, deepseek, groq) are OpenAI-compatible.