Skip to content

fix(llm): route all DashScope models through native provider - #7234

Merged
Vidit-Ostwal merged 2 commits into
crewAIInc:mainfrom
Alphaxiaoteng:fix/dashscope-non-qwen-native-provider
Sep 8, 2026
Merged

fix(llm): route all DashScope models through native provider#7234
Vidit-Ostwal merged 2 commits into
crewAIInc:mainfrom
Alphaxiaoteng:fix/dashscope-non-qwen-native-provider

Conversation

@Alphaxiaoteng

Copy link
Copy Markdown
Contributor

Summary

Test plan

  • Code + regression added next to existing DashScope factory test
  • CI: test_openai_compatible.py DashScope cases

Made with Cursor

DashScope's OpenAI-compatible endpoint serves DeepSeek/Kimi/GLM/etc.,
not only Qwen. Stop restricting the native match to the qwen* prefix so
DASHSCOPE_BASE_URL applies consistently. Fixes crewAIInc#7233.
@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: ceac3f37-062b-4c0d-b25e-6119b94079e0

📥 Commits

Reviewing files that changed from the base of the PR and between 09997bf and 629b7b7.

📒 Files selected for processing (2)
  • lib/crewai/src/crewai/llm.py
  • lib/crewai/tests/llms/openai_compatible/test_openai_compatible.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • lib/crewai/tests/llms/openai_compatible/test_openai_compatible.py
  • lib/crewai/src/crewai/llm.py

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The DashScope provider matcher now accepts all DashScope model names. Non-Qwen models route to OpenAICompatibleCompletion and use DASHSCOPE_BASE_URL. A test verifies routing for dashscope/deepseek-v3.

Changes

DashScope routing

Layer / File(s) Summary
Native DashScope provider routing
lib/crewai/src/crewai/llm.py, lib/crewai/tests/llms/openai_compatible/test_openai_compatible.py
The DashScope provider matcher accepts all model names. The test verifies that dashscope/deepseek-v3 creates an OpenAICompatibleCompletion with provider dashscope and the configured base URL.

Suggested reviewers: vidit-ostwal

Priority: ➖ Normal — Impact reflects medium issue severity.

Severity of issue fixed: Medium

Merge Risk: ⚪ Minimal · up to 629b7

DashScope model routing now uses the native OpenAI-compatible provider for non-Qwen models and applies custom DashScope base URLs consistently. The added DeepSeek regression coverage supports the intended routing behavior, with no current merge-blocking risk identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: routing all DashScope models through the native provider.
Description check ✅ Passed The description explains the bug, solution, linked issue, and regression test. It uses a Test plan section instead of Verification and omits an explicit Additional context section, but the required in…
Linked Issues check ✅ Passed The change directly addresses issue #7233 by routing non-Qwen DashScope models through the native OpenAI-compatible provider and adding regression coverage for custom DASHSCOPE_BASE_URL handling. The …
Out of Scope Changes check ✅ Passed The modified routing logic and added test are directly related to issue #7233 and the stated pull request objectives. No unrelated changes are present.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@parthiban-sivakumar

Copy link
Copy Markdown
Contributor

Hi @Alphaxiaoteng,

Thanks for picking this up so quickly! The change looks right to me and matches what I had in mind when I filed the issue.

Two small thoughts, both optional. The comment mentions DeepSeek/Kimi/GLM but the test only covers deepseek-v3 — parametrising over one more family would back up the comment. And it might be worth asserting llm.model == "deepseek-v3" too, just to confirm the model string is passed through correctly.

One thing I left out of the issue deliberately: the hardcoded default https://dashscope-intl.aliyuncs.com/compatible-mode/v1 may also be stale, since the current docs list dashscope-us.aliyuncs.com and workspace-scoped *.maas.aliyuncs.com URLs. Probably a separate issue rather than something for this PR.

Thanks!

@Vidit-Ostwal Vidit-Ostwal self-assigned this Sep 3, 2026

@Vidit-Ostwal Vidit-Ostwal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks correct for #7233. The factory only takes the native OpenAICompatibleCompletion path when _matches_provider_pattern returns true, so the qwen* gate was sending dashscope/deepseek-v3 (and the other compatible-mode families) to LiteLLM and dropping DASHSCOPE_BASE_URL. return True matches the other OpenAI-compatible providers and Alibaba's compatible-mode docs.

The new test hits the reported case (dashscope/deepseek-v3 + custom DASHSCOPE_BASE_URL). That's enough; the matcher is now unconditional, so parametrizing Kimi/GLM is optional. Asserting llm.model == "deepseek-v3" would be a cheap extra check that the prefix is stripped.

One leftover: the comment a few lines above still says (DeepSeek, Dashscope) restrict to their own model prefixes. After this change only DeepSeek does. Please update that so it doesn't contradict the new DashScope branch.

CodeRabbit is clean. Not behind main, so no rebase needed. Leave the default dashscope-intl URL alone — that's a separate follow-up.

@Vidit-Ostwal Vidit-Ostwal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover comment next to the DashScope matcher.

Comment thread lib/crewai/src/crewai/llm.py
@coderabbitai

coderabbitai Bot commented Sep 8, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@Vidit-Ostwal Vidit-Ostwal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes #7233. return True matches the other OpenAI-compatible providers, so dashscope/deepseek-v3 (and Kimi/GLM) take the native path and honor DASHSCOPE_BASE_URL. The new test covers the reported case.

Please rebase onto main (mergeStateStatus is BEHIND). Non-blocking leftover: the comment a few lines above still says (DeepSeek, Dashscope) restrict to their own model prefixes — after this change only DeepSeek does.

@Vidit-Ostwal
Vidit-Ostwal enabled auto-merge (squash) September 8, 2026 06:04
@Vidit-Ostwal
Vidit-Ostwal merged commit 7e18abd into crewAIInc:main Sep 8, 2026
53 checks passed
@parthiban-sivakumar

Copy link
Copy Markdown
Contributor

thanks @Alphaxiaoteng for picking this up so quickly, and thanks @Vidit-Ostwal for the review and merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] DashScope non-Qwen models bypass the native provider and ignore DASHSCOPE_BASE_URL

3 participants