[PR #14755] anthropic: handle thinking disabled case correctly. #61518

Open
opened 2026-04-29 16:36:20 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/14755
Author: @lightgao
Created: 3/10/2026
Status: 🔄 Open

Base: mainHead: fix-anthropic-thinking-disabled


📝 Commits (3)

  • f3205cc anthropic: handle thinking disabled case correctly.
  • 89df47f anthropic: update test to remove 'BudgetTokens' field in request for thinking disabled.
  • c22729b Merge branch 'ollama:main' into fix-anthropic-thinking-disabled

📊 Changes

2 files changed (+28 additions, -3 deletions)

View changed files

📝 anthropic/anthropic.go (+6 -2)
📝 anthropic/anthropic_test.go (+22 -1)

📄 Description

  • Bug Description

When using Ollama's native API with "think": false, the qwen3.5 model behaves as expected and does not return thinking results.
However, when using Ollama's Anthropic-compatible API with "thinking":{"type":"disabled"}, the model still returns thinking content, which is inconsistent with the expected behavior.

  • Root Cause

The 'FromMessagesRequest' function in the anthropic module converts Anthropic API requests to Ollama API requests, but only handles the case where thinking.type="enabled".
When thinking.type="disabled", the converted think parameter is missing, causing the qwen3.5 model to run with thinking enabled by default.

  • Fix

Properly handle the thinking.type="disabled" case by setting think to &api.ThinkValue{Value: false}.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/14755 **Author:** [@lightgao](https://github.com/lightgao) **Created:** 3/10/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix-anthropic-thinking-disabled` --- ### 📝 Commits (3) - [`f3205cc`](https://github.com/ollama/ollama/commit/f3205cca03deb5db9a38b758432cc43443147a66) anthropic: handle thinking disabled case correctly. - [`89df47f`](https://github.com/ollama/ollama/commit/89df47fd0d07bb2a656b8ed24ee8b2ae806a79d2) anthropic: update test to remove 'BudgetTokens' field in request for thinking disabled. - [`c22729b`](https://github.com/ollama/ollama/commit/c22729b8ae0ca121c3c2242c33d8b628d50e8180) Merge branch 'ollama:main' into fix-anthropic-thinking-disabled ### 📊 Changes **2 files changed** (+28 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `anthropic/anthropic.go` (+6 -2) 📝 `anthropic/anthropic_test.go` (+22 -1) </details> ### 📄 Description - Bug Description When using Ollama's native API with "think": false, the qwen3.5 model behaves as expected and does not return thinking results. However, when using Ollama's Anthropic-compatible API with "thinking":{"type":"disabled"}, the model still returns thinking content, which is inconsistent with the expected behavior. - Root Cause The 'FromMessagesRequest' function in the anthropic module converts Anthropic API requests to Ollama API requests, but only handles the case where thinking.type="enabled". When thinking.type="disabled", the converted think parameter is missing, causing the qwen3.5 model to run with thinking enabled by default. - Fix Properly handle the thinking.type="disabled" case by setting think to &api.ThinkValue{Value: false}. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-29 16:36:20 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#61518