feat: add native Ollama API support with "think" control #277
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.
While experimenting with Ollama's thinking control feature using
"think": false
, I discovered this parameter wasn't being respected. This is because this plugin currently uses Ollama's OpenAI-compatible endpoint (/api/v1/chat/completions
) rather than the native API.According to Ollama's documentation, their OpenAI compatibility is "experimental and subject to major adjustments including breaking changes," while recommending their native API for "fully-featured access." This limitation prevents access to Ollama-specific features like thinking control.
This PR implements native Ollama API support to unlock these features.
Changes Made
• Native API Response Parsing - Added Ollama-specific streaming response handler for
{"message":{"content":"text"}}
format with robust error handling• Thinking Parameter Support - Implemented
think
parameter control for models like Qwen, with exampleChatQwen3-8B
agent configuration• Proper Parameter Structure - Refactored payload to follow Ollama API specification with parameters nested under
options
object (temperature
,top_p
,min_p
,num_ctx
,top_k
)• Authentication Handling - Removed unnecessary auth headers for Ollama's local API