feat: Add support for qwen3-thinking models via Function Calling #59
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.
Add Support for Qwen3-Thinking Models via Function Calling
Overview
This PR introduces comprehensive support for qwen3-thinking models, which do not support Structured Output (SO) but work excellently through Function Calling (FC). The implementation maintains full compatibility with the SGR framework while enabling the use of thinking models that provide intermediate reasoning in their outputs.
Key Features
1. Universal Pydantic to Function Calling Converter
sgr_deep_research/core/utils/pydantic_convert.pyLiteral,Optional,Union,List,Dict2. Qwen3-Thinking Response Adapter
sgr_deep_research/core/adapters/qwen3_thinking_adapter.pytool_callswith JSON inargumentscontentwith<tool_call>...</tool_call>tags (priority)contentwith raw JSON (fallback)3. SGRQwen3ThinkingAgent
sgr_deep_research/core/agents/sgr_qwen3_thinking_agent.pyDocumentation & Examples
Comprehensive Documentation:
docs/QWEN3_THINKING_SUPPORT.mdPractical Examples:
examples/qwen3_thinking_example.py️ Architecture
Design Decisions
Backward Compatibility
This PR:
agents-config-definitionsbranchConfiguration
config.yaml
agents.yaml