refactor(providers): use extractReasoningFromDelta helper for reasoni…#588
refactor(providers): use extractReasoningFromDelta helper for reasoni…#588daewoongoh wants to merge 3 commits into
Conversation
…ng streams Replace duplicated reasoning_content extraction logic across 7 providers (deepseek, mimo, openai, opencode-go, qwen-code, requesty, unbound) with the shared extractReasoningFromDelta helper. This also adds the OpenRouter- style 'reasoning' field fallback to each provider for free.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughProvider streaming handlers (DeepSeek, MiMo, OpenAI, Opencode-Go, Qwen-Code, Requesty, Unbound) now import and use extractReasoningFromDelta(delta) to emit ChangesConsolidate Reasoning Extraction Helper Adoption
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install timed out. The project may have too many dependencies for the sandbox. 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Add streaming tests for openai, requesty, and unbound covering: - delta.reasoning_content yields a reasoning chunk - delta.reasoning fallback yields a reasoning chunk when reasoning_content is absent (OpenRouter-style) This raises line coverage on the changed reasoning paths from 50%.
Related GitHub Issue
#570
Description
This PR replaces duplicated inline reasoning-delta extraction logic across seven providers with the shared
extractReasoningFromDeltahelper.Affected providers:
deepseekmimoopenaiopencode-goqwen-coderequestyunboundPreviously, each provider had a near-identical streaming check for
delta.reasoning_contentand emitted reasoning chunks inline. Sincesrc/api/providers/utils/extract-reasoning.tsalready provides the canonical extraction behavior and is already used by other OpenAI-compatible providers, this PR brings the remaining duplicated call sites in line with the shared implementation.Test Procedure
Pre-Submission Checklist
Existing tests cover the changed provider behavior, and the shared helper is already test-covered.
Screenshots / Videos
N/A
Documentation Updates
Additional Notes
This is a focused provider refactor. It removes duplicated reasoning extraction logic and routes all seven affected providers through the shared
extractReasoningFromDeltahelper.The intended behavior for existing
reasoning_contentchunks is unchanged for normal string payloads. The practical improvement is that these providers now also handle thereasoningfallback supported by the helper, so future or model-specific deltas using that field will stream reasoning text instead of being ignored.Get in Touch
hehegwk_23849
Summary by CodeRabbit