feat: add reasoning and reasoning_content fields to OpenAI message types #4244
+162
−1
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.
What does this PR do?
Add support for reasoning fields in OpenAI-compatible chat completion
messages to enable compatibility with vLLM reasoning parsers.
Changes:
reasoning_contentandreasoningfields to OpenAIAssistantMessageParamreasoningfield to OpenAIChoiceDelta (reasoning_content already existed)Both field names are supported for maximum compatibility:
reasoning_content: Used by vLLM ≤ v0.8.4reasoning: New field name in vLLM ≥ v0.9.x(based on release notes)
vLLM documentation recommends migrating to the shorter
reasoningfieldname, but maintains backward compatibility with
reasoning_content.These fields allow reasoning models to return their chain-of-thought
process alongside the final answer, which is crucial for transparency
and debugging with reasoning models.
References:
reasoning_contentin API for reasoning models like DeepSeek R1 vllm-project/vllm#12468Test Plan