fix: support vLLM 'reasoning' field as fallback for 'reasoning_content'#3959
fix: support vLLM 'reasoning' field as fallback for 'reasoning_content'#3959r266-tech wants to merge 1 commit intocamel-ai:masterfrom
Conversation
vLLM deprecated the 'reasoning_content' field in favor of 'reasoning' in v0.8.3 (see vllm-project/vllm#12953). This caused reasoning content to be silently lost when using CAMEL with newer vLLM deployments of reasoning models. Fix both the non-streaming and streaming code paths in ChatAgent to check 'reasoning' as a fallback when 'reasoning_content' is absent: - _handle_batch_response: getattr fallback chain for choice.message - _astream / streaming loop: _reasoning_delta extracted with fallback Resolves camel-ai#3939
There was a problem hiding this comment.
Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit in Settings → Usage.
Once credits are available, reopen this pull request to trigger a review.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment Tip CodeRabbit can scan for known vulnerabilities in your dependencies using OSV Scanner.OSV Scanner will automatically detect and report security vulnerabilities in your project's dependencies. No additional configuration is required. |
Related Issue
#3939
Description
vLLM deprecated the
reasoning_contentfield in favor ofreasoningin v0.8.3 (see vllm-project/vllm#12953). CAMEL only checks forreasoning_content, so reasoning output is silently discarded when users run newer vLLM deployments of reasoning models (e.g., DeepSeek-R1 via vLLM ≥ 0.8.3).Root cause:
ChatAgent._handle_batch_responseand the two streaming loops each hard-codereasoning_contentwith no fallback.Fix: Add a
getattrfallback chain so thatreasoningis used whenreasoning_contentis absent, for both the non-streaming and streaming code paths. The change is fully backward-compatible — existing providers that emitreasoning_contentare unaffected.Changed lines in
camel/agents/chat_agent.py:getattr(choice.message, 'reasoning_content', None) or getattr(choice.message, 'reasoning', None)_reasoning_deltawith the same fallback pattern.What is the purpose of this pull request?
Checklist
pyproject.tomland runuv lock