-
Notifications
You must be signed in to change notification settings - Fork 763
Support multi-turn reasoning for xAI (reasoning_content only)
#5989
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
/merge-queue |
|
🚀 Merge queue workflow triggered! View the run: https://github.com/tensorzero/tensorzero/actions/runs/21497851446 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
|
/merge-queue |
|
🚀 Merge queue workflow triggered! View the run: https://github.com/tensorzero/tensorzero/actions/runs/21498830853 |
* Support multi-turn reasoning for xAI * Support multi-turn reasoning for xAI * Support multi-turn reasoning for xAI * Support multi-turn reasoning for xAI * Support multi-turn reasoning for xAI
Fix #5971.
This required relying less on the OpenAI types and methods, and instead migrating them to xAI-specific ones (inevitable).
For now we'll only support
reasoning_content. We don't support encrypted reasoning as that requires the Responses API (we use the legacy Chat Completions API). See the issue above for more details.Note
Medium Risk
Medium risk because it changes how xAI chat requests are constructed (message splitting, JSON-mode system injection, and thought/tool handling), which could affect correctness across tool and multi-turn flows.
Overview
Enables multi-turn reasoning for xAI by introducing xAI-specific request message types (including assistant
reasoning_content) intensorzero-types-providersand switching the xAI provider off the shared OpenAI message builder.Adds
prepare_xai_messages/conversion helpers to map TensorZeroRequestMessageblocks into xAI Chat Completions messages, including concatenating assistantThoughttext intoreasoning_content, enforcing tool-call/result placement rules, and preserving JSON-mode system instructions.Updates tests and tooling: expands xAI unit/E2E coverage around
reasoning_contentand thought filtering behavior, and adds a nextest timeout override for slow xAI multi-turn reasoning tests.Written by Cursor Bugbot for commit 79118e2. This will update automatically on new commits. Configure here.