llamaIndex - ✅(Solved) Fix [Bug]: reasoning_content is deprecated in vLLM, cannot get thinking content through openai API [2 pull requests, 2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
run-llama/llama_index#21075Fetched 2026-04-08 01:02:02
View on GitHub
Comments
2
Participants
2
Timeline
9
Reactions
0
Author
Participants
Timeline (top)
cross-referenced ×2labeled ×2referenced ×2commented ×1

Fix Action

Fixed

PR fix notes

PR #21076: fix: support both reasoning and reasoning_content fields for vLLM compatibility

Description (problem / solution / changelog)

Summary

Fixes #21075. Root cause: vLLM 0.17.0+ deprecated reasoning_content in favor of reasoning field (see vllm-project/vllm#36730), but the OpenAI LLM integration only reads reasoning_content, preventing extraction of thinking content when using vLLM. Fix: Read both reasoning (new standard) and reasoning_content (legacy) fields, preferring the new field. This maintains backward compatibility with providers still using reasoning_content.

Changes

  • llama-index-integrations/llms/llama-index-llms-openai/llama_index/llms/openai/base.py: Updated _stream_chat and _astream_chat to check both reasoning and reasoning_content attributes
  • llama-index-integrations/llms/llama-index-llms-openai/llama_index/llms/openai/utils.py: Updated from_openai_message to check both fields

Testing

  • Verified fix addresses reported scenario (vLLM reasoning field now extracted)
  • Change is minimal and follows existing code patterns
  • Backward compatible with providers using reasoning_content

Made with Cursor

Changed files

  • llama-index-integrations/llms/llama-index-llms-openai/llama_index/llms/openai/base.py (modified, +2/-2)
  • llama-index-integrations/llms/llama-index-llms-openai/llama_index/llms/openai/utils.py (modified, +1/-1)

PR #21078: fix(openai): handle deprecated reasoning_content in vLLM

Description (problem / solution / changelog)

Summary

The reasoning_content field is deprecated in vLLM (see vllm-project/vllm#36730). This fix updates the OpenAI LLM integration to handle the new reasoning field while maintaining backward compatibility with the old reasoning_content field.

Changes

  • Updated raw_reasoning extraction to check reasoning field first (new vLLM format), then fall back to reasoning_content (old format)
  • Applied the fix in both _stream_chat and _astream_chat methods
  • Added test test_stream_chat_reasoning_vllm_new_field to verify the new field works correctly

Testing

  • All existing tests pass (103 passed, 14 skipped)
  • New test verifies the new vLLM reasoning field is correctly captured as ThinkingBlock
  • Backward compatibility maintained - old reasoning_content field still works

Fixes run-llama/llama_index#21075

Changed files

  • llama-index-integrations/llms/llama-index-llms-openai/llama_index/llms/openai/base.py (modified, +12/-4)
  • llama-index-integrations/llms/llama-index-llms-openai/tests/test_openai.py (modified, +51/-0)
RAW_BUFFERClick to expand / collapse

Bug Description

I encountered an issue when trying to extract thinking content of Qwen3.5 model deployed by vLLM. I noticed the field 'reasoning_content' is deprecated in vLLM https://github.com/vllm-project/vllm/issues/36730, but the openai still tries to get reasoning_content as in L573 and L869. It's very helpful to fix such difference.

Version

llama_index_llms_openai version 0.7.2

Steps to Reproduce

As in comment.

Relevant Logs/Tracbacks

extent analysis

Fix Plan

The fix involves updating the llama_index_llms_openai library to use the new field instead of the deprecated reasoning_content field.

Step-by-Step Solution

  • Update the llama_index_llms_openai library to the latest version.
  • If the latest version still uses the deprecated field, manually update the code to use the new field.
  • Specifically, update lines L573 and L869 in base.py to use the new field.

Example code:

# Before
response = self._query(prompt, max_tokens=max_tokens, stop=None, temperature=temperature, reasoning_content=True)

# After
response = self._query(prompt, max_tokens=max_tokens, stop=None, temperature=temperature, new_field=True)

Replace new_field with the actual name of the new field.

Verification

Verify that the fix worked by checking the response from the vLLM model. The response should no longer contain the deprecated reasoning_content field.

Extra Tips

  • Always check the documentation for the latest field names and deprecations.
  • Consider using a version control system to track changes to the code.
  • If the issue persists, check the vLLM model documentation for any changes to the API.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING