fix(agent): restrict think=False to Ollama/local endpoints only#11362
Open
yeyitech wants to merge 1 commit into
Open
fix(agent): restrict think=False to Ollama/local endpoints only#11362yeyitech wants to merge 1 commit into
yeyitech wants to merge 1 commit into
Conversation
The `think=False` extra_body parameter is Ollama-specific. The previous guard `provider == "custom"` matched all custom providers (Mistral, Fireworks, Together.ai, vLLM remote, etc.), causing HTTP 422 errors from cloud APIs that don't recognize the `think` field. Replace the guard with an Ollama/local endpoint check that mirrors the existing pattern used elsewhere in the codebase: - URL contains "ollama" - URL contains ":11434" (default Ollama port) - is_local_endpoint() returns True Fixes NousResearch#11237 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
I want this fix. |
13 tasks
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
think=Falseincorrectly sent to allprovider=customendpoints, not just Ollama #11237think=Falseparameter inextra_bodyis Ollama-specific. The previous guardif self.provider == "custom"matched all custom providers (Mistral, Fireworks, Together.ai, vLLM remote, etc.), causing HTTP 422 errors from cloud APIs that do not recognise thethinkfield.run_agent.py(_ollama_num_ctx,_is_glm_zai_direct).Changes
In
_build_api_kwargs(), replaced:with:
is_local_endpointis already imported at the top ofrun_agent.pyandself._base_url_loweris a cached lowercased copy of the base URL set in thebase_urlproperty setter.Test plan
http://localhost:11434/v1):think=Falsestill sent when reasoning is disabledhttp://my-ollama-server/v1):think=Falsestill sentthink=Falseno longer sent; no HTTP 422think=Falseno longer sent; no HTTP 422🤖 Generated with Claude Code