mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-08 03:08:45 +00:00
fix(dashscope): forward reasoning_effort to the provider
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
4bb3152cc5
commit
62d8258868
2 changed files with 21 additions and 0 deletions
|
|
@ -12,6 +12,12 @@ from ...openai.chat.gpt_transformation import OpenAIGPTConfig
|
|||
|
||||
|
||||
class DashScopeChatConfig(OpenAIGPTConfig):
|
||||
def get_supported_openai_params(self, model: str) -> list: # mutable-ok: base class contract returns a list
|
||||
return [ # mutable-ok: base class contract returns a list
|
||||
*super().get_supported_openai_params(model=model),
|
||||
"reasoning_effort",
|
||||
]
|
||||
|
||||
def remove_cache_control_flag_from_messages_and_tools(
|
||||
self,
|
||||
model: str,
|
||||
|
|
|
|||
|
|
@ -169,6 +169,21 @@ class TestDashScopeConfig:
|
|||
|
||||
assert transformed_messages[0].get("cache_control") == {"type": "ephemeral"}
|
||||
|
||||
@pytest.mark.parametrize("reasoning_effort", ["none", "minimal", "low", "high"])
|
||||
def test_dashscope_forwards_reasoning_effort(self, reasoning_effort: str):
|
||||
"""DashScope supports reasoning_effort, so it must reach the provider instead of being dropped."""
|
||||
assert "reasoning_effort" in DashScopeChatConfig().get_supported_openai_params(
|
||||
model="qwen3.7-plus"
|
||||
)
|
||||
|
||||
optional_params = litellm.get_optional_params(
|
||||
model="qwen3.7-plus",
|
||||
custom_llm_provider="dashscope",
|
||||
reasoning_effort=reasoning_effort,
|
||||
)
|
||||
|
||||
assert optional_params["reasoning_effort"] == reasoning_effort
|
||||
|
||||
def test_dashscope_preserves_cache_control_in_tools(self):
|
||||
"""DashScope should NOT strip cache_control from tools."""
|
||||
config = DashScopeChatConfig()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue