Repository navigation
Python: honor tool_choice="none" in OllamaChatClient - #9049
Closed
Suhas Aggarwal (suhasagg) wants to merge 3 commits into
Closed
Suhas Aggarwal (suhasagg) wants to merge 3 commits into
Suhas Aggarwal (suhasagg) wants to merge 3 commits into
Conversation
Suhas Aggarwal (suhasagg)
requested review from
SergeyMenshykh,
Tao Chen (TaoChenOSU),
Eduard van Valkenburg (eavanvalkenburg),
Giles Odigwe (giles17),
Jose Alvarez (jpalvarezl),
Evan Mattson (moonbox3),
Roger Barreto (rogerbarreto),
sophia-ramsey and
westey (westey-m)
as code owners
October 5, 2026 08:27
Suhas Aggarwal (suhasagg)
temporarily deployed
to
github-app-auth
October 5, 2026 08:27 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
ToolMode mappings remain unsupported and the public options type contradicts the new behavior.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Updates Ollama request preparation to honor disabled tool choice.
Changes:
- Handles tools separately from generic options.
- Omits tools for
tool_choice="none". - Adds regression tests for
noneandauto.
| File | Description |
|---|---|
_chat_client.py |
Conditionally includes Ollama tools. |
test_ollama_chat_client.py |
Tests disabled and automatic tool choice. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Contributor
Author
|
@microsoft-github-policy-service agree |
Suhas Aggarwal (suhasagg)
temporarily deployed
to
github-app-auth
October 5, 2026 08:42 — with
GitHub Actions
Inactive
Eduard van Valkenburg (eavanvalkenburg)
approved these changes
Oct 5, 2026
Eduard van Valkenburg (eavanvalkenburg)
enabled auto-merge
October 5, 2026 13:27
auto-merge was automatically disabled
October 5, 2026 14:33
Head branch was pushed to by a user without write access
Suhas Aggarwal (suhasagg)
temporarily deployed
to
github-app-auth
October 5, 2026 14:33 — with
GitHub Actions
Inactive
Member
|
Suhas Aggarwal (@suhasagg) Thanks for the contribution. This implements the same change as #8987, so we'll continue the work there and close this duplicate. |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Summary
Honor
tool_choice="none"when preparing Ollama chat requests.Problem
OllamaChatClient._prepare_options()excludestool_choicefrom theprovider request because Ollama does not accept that option directly.
However,
toolswere still processed by the generic option path andincluded in the Ollama request even when the caller explicitly selected
tool_choice="none".Changes
toolsas a specially handled option instead of passing itthrough the generic option-processing path.
tool_choice="none".Testing
**expansion errors in_chat_client.py; the same errors reproduce on the unmodified baseline.Fixes #8986