fix: use DashScope-compatible parameters in Qwen Code provider (#12067)#12068
Draft
roomote-v0[bot] wants to merge 1 commit intomainfrom
Draft
fix: use DashScope-compatible parameters in Qwen Code provider (#12067)#12068roomote-v0[bot] wants to merge 1 commit intomainfrom
roomote-v0[bot] wants to merge 1 commit intomainfrom
Conversation
… 400 errors Replace OpenAI-specific parameters that DashScope does not support: - max_completion_tokens -> max_tokens - Remove parallel_tool_calls (unsupported) - Remove stream_options (unsupported) - Override convertToolsForOpenAI to skip strict mode (unsupported) Fixes #12067
|
Is there a way to implement this fix right now, or do I need to wait until a new version is released? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Related GitHub Issue
Closes: #12067
Description
This PR attempts to address Issue #12067 where Qwen Code provider returns 400 Bad Request errors for all requests. Feedback and guidance are welcome.
The root cause is that the Qwen Code provider sends several OpenAI-specific parameters that DashScope's compatible-mode API does not support. This PR makes the following changes to
src/api/providers/qwen-code.ts:max_completion_tokensreplaced withmax_tokens- DashScope uses the standardmax_tokensparameter, not the newer OpenAI-specificmax_completion_tokens.parallel_tool_calls- DashScope does not support this OpenAI-specific parameter.stream_options- DashScope does not supportstream_options: { include_usage: true }.convertToolsForOpenAI- DashScope does not support OpenAI'sstrict: truemode on tool definitions. The override filters for function tools without adding strict mode or schema transformations.Test Procedure
cd src && npx vitest run api/providers/__tests__/qwen-code-native-tools.spec.ts- all 12 tests pass.parallel_tool_calls: trueto assert it is NOT present.DashScope API Compatibilitytest suite verifying:max_tokensis used instead ofmax_completion_tokensstream_optionsis not includedparallel_tool_callsis not includedstrict: trueis not set on tool definitionscompletePromptalso usesmax_tokensPre-Submission Checklist
Documentation Updates
Additional Notes
This fix follows the same pattern used by other OpenAI-compatible providers (like LM Studio and Moonshot) that adapt request parameters to match what their target API actually supports.
Interactively review PR in Roo Code Cloud