Add support for vLLM's new reasoning field#6988
Open
AntoineToussaint wants to merge 4 commits intomainfrom
Open
Add support for vLLM's new reasoning field#6988AntoineToussaint wants to merge 4 commits intomainfrom
reasoning field#6988AntoineToussaint wants to merge 4 commits intomainfrom
Conversation
GabrielBianconi
requested changes
Mar 20, 2026
Member
GabrielBianconi
left a comment
There was a problem hiding this comment.
We need to handle sending it back to the model in multi-turn conversations. This means we need to know the right one to send back.
We might need a more holistic solution here, e.g. default to the new one and make it configurable, or something like that.
We should also run E2E tests to confirm this works. We have a VLLM deployment; we might need to bump it to 0.8+.
vLLM >=0.8 renamed `reasoning_content` to `reasoning` in chat completion responses. Add `#[serde(alias = "reasoning")]` to `OpenAIResponseMessage` and `OpenAIDelta` so both field names are accepted, maintaining compatibility with all OpenAI-compatible providers. Closes #6653 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ning_content` vLLM >=0.8 sends both `reasoning` and `reasoning_content` in responses (typically one null). Using `#[serde(alias)]` fails with a duplicate field error in this case. Replace with custom Deserialize impls that accept both fields and merge them, preferring `reasoning_content`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
c357acd to
d67a978
Compare
vLLM >=0.8 renamed `reasoning_content` to `reasoning` in both requests and responses. The previous commits handle deserialization (accepting both field names), but we also need to send the correct field name back when constructing assistant messages for multi-turn conversations. Add `ReasoningFieldName` enum and `reasoning_field_name` config to `OpenAIMessagesConfig`, so each provider can choose which field name to serialize. vLLM defaults to `reasoning`; all other providers default to `reasoning_content`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Member
Author
|
Addressed the multi-turn serialization concern:
Still TODO: E2E tests with a vLLM >=0.8 deployment to confirm end-to-end behavior. |
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
reasoning_contenttoreasoningin chat completion responses (commit), but sends both fields simultaneously (typically one null)#[serde(alias)]can't handle duplicate keys, so we use customDeserializeimpls with intermediateRawstructs that accept both fields and merge them, preferringreasoning_contentOpenAIResponseMessage) and streaming (OpenAIDelta) response typesCloses #6653
Test plan
reasoningonly,reasoning_contentonly, both null, both set, and one null + one setcargo clippyclean🤖 Generated with Claude Code