[PR #11291] server: add option to preserve think tags in chat #75793

Open
opened 2026-05-05 08:13:29 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/11291
Author: @jessy2027
Created: 7/3/2025
Status: 🔄 Open

Base: mainHead: feat/preserve-think-tags


📝 Commits (1)

  • 8a7a463 server: add option to preserve think tags in chat

📊 Changes

3 files changed (+71 additions, -9 deletions)

View changed files

📝 api/types.go (+3 -0)
📝 server/routes.go (+17 -9)
📝 server/routes_generate_test.go (+51 -0)

📄 Description

This commit introduces a preserve_think_block option to the chat API. When set to true, the server will not strip tags from the assistant's response content.

This is useful for agentic workflows and multi-turn reasoning where preserving the full model output, including thought processes, is required.

This also fixes a bug where the thinking parser was not active unless the think true parameter was explicitly set, causing think tags to be leaked to the user unexpectedly.

Fixes #11279


🔄 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/11291 **Author:** [@jessy2027](https://github.com/jessy2027) **Created:** 7/3/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/preserve-think-tags` --- ### 📝 Commits (1) - [`8a7a463`](https://github.com/ollama/ollama/commit/8a7a463bae85597064b2df9861cc748ca37a7e9d) server: add option to preserve think tags in chat ### 📊 Changes **3 files changed** (+71 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `api/types.go` (+3 -0) 📝 `server/routes.go` (+17 -9) 📝 `server/routes_generate_test.go` (+51 -0) </details> ### 📄 Description This commit introduces a preserve_think_block option to the chat API. When set to true, the server will not strip <think> tags from the assistant's response content. This is useful for agentic workflows and multi-turn reasoning where preserving the full model output, including thought processes, is required. This also fixes a bug where the thinking parser was not active unless the think true parameter was explicitly set, causing think tags to be leaked to the user unexpectedly. Fixes #11279 --- <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-05-05 08:13:29 -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#75793