Repository navigation
fix(hosted_vllm): map output_config effort and adaptive thinking to reasoning_effort #44563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -95,13 +95,20 @@ def map_openai_params( | |||||
| if _tools is not None: | ||||||
| non_default_params["tools"] = _tools | ||||||
|
|
||||||
| output_config: Final = non_default_params.pop("output_config", None) | ||||||
| thinking: Final = non_default_params.pop("thinking", None) | ||||||
| if thinking is not None and isinstance(thinking, dict): | ||||||
| if thinking.get("type") == "enabled": | ||||||
| if "reasoning_effort" not in non_default_params: | ||||||
| if "reasoning_effort" not in non_default_params: | ||||||
| if isinstance(output_config, dict) and output_config.get("effort"): | ||||||
| non_default_params["reasoning_effort"] = output_config["effort"] | ||||||
| elif thinking is not None and isinstance(thinking, dict): | ||||||
| if thinking.get("type") == "enabled": | ||||||
| non_default_params["reasoning_effort"] = reasoning_effort_from_thinking_budget( | ||||||
| thinking.get("budget_tokens", 0) | ||||||
| ) | ||||||
| elif thinking.get("type") == "adaptive" and thinking.get("effort"): | ||||||
| non_default_params["reasoning_effort"] = thinking["effort"] | ||||||
| elif thinking is not None and isinstance(thinking, dict) and thinking.get("type") == "enabled": | ||||||
| pass | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||||||
|
|
||||||
| return super().map_openai_params(non_default_params, optional_params, model, drop_params) | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -113,6 +113,31 @@ def test_hosted_vllm_supports_thinking(): | |
| ) | ||
| assert optional_params["reasoning_effort"] == "low" | ||
|
|
||
| # Test output_config.effort is mapped to reasoning_effort | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Context Used: AGENTS.md (source) Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||
| optional_params = config.map_openai_params( | ||
| non_default_params={ | ||
| "thinking": {"type": "adaptive"}, | ||
| "output_config": {"effort": "low"}, | ||
| }, | ||
| optional_params={}, | ||
| model="hosted_vllm/GLM-4.6-FP8", | ||
| drop_params=False, | ||
| ) | ||
| assert "thinking" not in optional_params | ||
| assert "output_config" not in optional_params | ||
| assert optional_params["reasoning_effort"] == "low" | ||
|
|
||
| # Test adaptive thinking with effort inside thinking dict | ||
| optional_params = config.map_openai_params( | ||
| non_default_params={ | ||
| "thinking": {"type": "adaptive", "effort": "max"}, | ||
| }, | ||
| optional_params={}, | ||
| model="hosted_vllm/GLM-4.6-FP8", | ||
| drop_params=False, | ||
| ) | ||
| assert optional_params["reasoning_effort"] == "max" | ||
|
|
||
|
|
||
| def test_hosted_vllm_reasoning_content_kept_and_thinking_blocks_removed(): | ||
| """ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
completion()calls discardoutput_configduring preprocessing, so this mapping cannot send the requested effort to hosted vLLM. The new tests bypass preprocessingKnowledge Base Used: Model invocation runtime