Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@GabrielBianconi
Copy link
Member

@GabrielBianconi GabrielBianconi commented Jan 29, 2026

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) in tensorzero-types-providers and switching the xAI provider off the shared OpenAI message builder.

Adds prepare_xai_messages/conversion helpers to map TensorZero RequestMessage blocks into xAI Chat Completions messages, including concatenating assistant Thought text into reasoning_content, enforcing tool-call/result placement rules, and preserving JSON-mode system instructions.

Updates tests and tooling: expands xAI unit/E2E coverage around reasoning_content and 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.

@GabrielBianconi
Copy link
Member Author

/merge-queue

@GabrielBianconi GabrielBianconi self-assigned this Jan 29, 2026
@github-actions
Copy link
Contributor

🚀 Merge queue workflow triggered!

View the run: https://github.com/tensorzero/tensorzero/actions/runs/21497851446

Copy link

@cursor cursor bot left a 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.

@GabrielBianconi
Copy link
Member Author

/merge-queue

@github-actions
Copy link
Contributor

🚀 Merge queue workflow triggered!

View the run: https://github.com/tensorzero/tensorzero/actions/runs/21498830853

@GabrielBianconi GabrielBianconi added this pull request to the merge queue Jan 30, 2026
github-merge-queue bot pushed a commit that referenced this pull request Jan 30, 2026
* 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
Merged via the queue into main with commit d39f75e Jan 30, 2026
81 of 83 checks passed
@GabrielBianconi GabrielBianconi deleted the gb/fix-5971 branch January 30, 2026 19:23
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.

Add first-class support for reasoning_content in xAI provider

4 participants