fix: remove Ollama template-based tool support gate#11905
Conversation
…tection The Ollama provider checks the model template from /api/show for a `.Tools` placeholder to decide whether to pass tools to the API. For newer models (e.g. qwen3.5) whose templates may not yet include `.Tools`, this silently strips tools from the request — even when the user explicitly sets `capabilities: tools: true` in config.yaml. Use nullish coalescing so an explicit capabilities.tools setting always wins, with the template heuristic as a fallback.
Documentation ReviewNo documentation updates needed for this PR. Reason: This is an internal bug fix that makes the existing documented behavior work correctly. The documentation already instructs users to explicitly set This PR fixes the code to properly honor those explicit capability settings for Ollama models—the user-facing configuration and recommended workflow remain unchanged. |
Test Coverage ReviewThis PR introduces new logic where Suggested Test Cases
Example Test Structuredescribe('_streamChat tool capability handling', () => {
it('should include tools when capabilities.tools is explicitly true', () => {
// Set capabilities.tools = true, templateSupportsTools = false
// Verify tools are included in chatOptions
});
it('should exclude tools when capabilities.tools is explicitly false', () => {
// Set capabilities.tools = false, templateSupportsTools = true
// Verify tools are NOT included in chatOptions
});
it('should use templateSupportsTools when capabilities.tools is undefined', () => {
// Set capabilities.tools = undefined, templateSupportsTools = true
// Verify tools ARE included (existing behavior)
});
});These tests would provide regression coverage for the bug this PR fixes and ensure the capability override precedence logic works correctly. Automated test coverage check |
Summary
/api/show) for a.Toolsplaceholder to decide whether to pass tools to the APIqwen3.5:9b) whose templates don't yet include.Tools, even whentoolSupport.tsor explicit config said the model supports toolstemplateSupportsToolscheck entirely — ifoptions.toolsis non-empty, the upstream (capabilities.toolsfrom config ortoolSupport.tsheuristic) already decided the model supports toolsTest plan
qwen3.5:9b) and verify tools are passed to the APItoolSupport.tsheuristics still don't receive tools