Skip to content

fix(xai, deepseek, groq, mistral): send null content for tool-only assistant messages#14758

Open
blackwell-systems wants to merge 1 commit intovercel:mainfrom
blackwell-systems:fix/tool-only-content-null
Open

fix(xai, deepseek, groq, mistral): send null content for tool-only assistant messages#14758
blackwell-systems wants to merge 1 commit intovercel:mainfrom
blackwell-systems:fix/tool-only-content-null

Conversation

@blackwell-systems
Copy link
Copy Markdown

Summary

Follow-up to #13744. Applies the same content: text || null fix 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 with ValidationException: messages: text content blocks must be non-empty.

Changes

  • packages/xai/src/convert-to-xai-chat-messages.ts: content: textcontent: text || null
  • packages/deepseek/src/chat/convert-to-deepseek-chat-messages.ts: same
  • packages/groq/src/convert-to-groq-chat-messages.ts: same
  • packages/mistral/src/convert-to-mistral-chat-messages.ts: same
  • Updated XaiAssistantMessage and MistralAssistantMessage types to accept string | null (DeepSeek and Groq types already did)
  • Updated all test expectations to expect null instead of ""
  • Patch changeset for all four packages

Checklist

  • Tests updated (all four converter test files)
  • Patch changeset added
  • Self-reviewed

Fixes #14612

…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
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.

Bug: tool-only assistant messages send content:"" in xai, deepseek, groq, mistral providers

1 participant