[PR #15364] anthropic: set Think to false when thinking type is disabled #61820

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

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/15364
Author: @ysnows
Created: 4/6/2026
Status: 🔄 Open

Base: mainHead: fix/anthropic-thinking-disabled


📝 Commits (1)

  • 6c64b74 anthropic: explicitly set Think to false when thinking type is "disabled"

📊 Changes

2 files changed (+23 additions, -0 deletions)

View changed files

📝 anthropic/anthropic.go (+2 -0)
📝 anthropic/anthropic_test.go (+21 -0)

📄 Description

Summary

  • When an Anthropic API request includes "thinking": {"type": "disabled"}, the adapter now explicitly sets Think to &ThinkValue{Value: false} instead of leaving it as nil
  • This distinguishes between "not set" (nil) and "explicitly disabled" (false), ensuring the user's intent to disable thinking is properly forwarded to the Ollama API
  • Added test case for the disabled thinking path

Test plan

  • Existing TestFromMessagesRequest_WithThinking still passes
  • New TestFromMessagesRequest_WithThinkingDisabled passes
  • Manual: send Anthropic-compatible request with "thinking": {"type": "disabled"} and verify Think is explicitly false

🤖 Generated with Claude Code


🔄 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/15364 **Author:** [@ysnows](https://github.com/ysnows) **Created:** 4/6/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/anthropic-thinking-disabled` --- ### 📝 Commits (1) - [`6c64b74`](https://github.com/ollama/ollama/commit/6c64b74c5d1dfe621db5037a84c1909265cabeea) anthropic: explicitly set Think to false when thinking type is "disabled" ### 📊 Changes **2 files changed** (+23 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `anthropic/anthropic.go` (+2 -0) 📝 `anthropic/anthropic_test.go` (+21 -0) </details> ### 📄 Description ## Summary - When an Anthropic API request includes `"thinking": {"type": "disabled"}`, the adapter now explicitly sets `Think` to `&ThinkValue{Value: false}` instead of leaving it as `nil` - This distinguishes between "not set" (nil) and "explicitly disabled" (false), ensuring the user's intent to disable thinking is properly forwarded to the Ollama API - Added test case for the disabled thinking path ## Test plan - [x] Existing `TestFromMessagesRequest_WithThinking` still passes - [x] New `TestFromMessagesRequest_WithThinkingDisabled` passes - [ ] Manual: send Anthropic-compatible request with `"thinking": {"type": "disabled"}` and verify `Think` is explicitly `false` 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <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:49:42 -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#61820