magnificent-hairdresser-38202
12/10/2025, 2:32 AMQwen3-8B model and getting this error message: openai.BadRequestError: Error code: 400 - {'error': {'code': 'invalid_parameter_error', 'param': None, 'message': 'parameter.enable_thinking must be set to false for non-streaming calls', 'type': 'invalid_request_error'}. Please investigate.nutritious-balloon-65098
12/10/2025, 2:32 AMnutritious-balloon-65098
12/10/2025, 2:43 AMparameter.enable_thinking must be set to false for non-streaming calls occurred because:
1. Qwen3-8B doesn't support reasoning effort - but thinking parameters were being passed through completion_kwargs
2. LiteLLM auto-sets enable_thinking=true when it detects thinking parameters, causing OpenAI to reject non-streaming calls
Solution Implemented
I made targeted changes to `openhands/llm/llm.py`:
1. Filter thinking parameters for unsupported models: Added logic to remove thinking, enable_thinking, and reasoning_effort from completion_kwargs when the model doesn't support reasoning effort
2. Explicit enable_thinking=false for non-streaming calls: Added a safety check to explicitly set enable_thinking=false when thinking parameters are present in non-streaming calls
Test Coverage Added
• Model features test: Verifies Qwen3-8B correctly has supports_reasoning_effort=False
• Parameter filtering test: Confirms thinking parameters are properly filtered while preserving other parameters
Verification
• ✅ Both new tests pass
• ✅ All pre-commit hooks pass (linting, formatting, type checking)
• ✅ Changes are minimal and focused on the specific issue
• ✅ Fix prevents the BadRequestError while preserving functionality for reasoning-capable models
The fix ensures users can have global thinking parameters in their configuration without breaking models like Qwen3-8B that don't support these features.
Would you like me to push these changes to a new branch and create a pull request?
<sub>View full conversation</sub>