[PR #14630] server: support think parameter in modelfiles #46004

Open
opened 2026-04-25 01:34:45 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/14630
Author: @ageorgop
Created: 3/5/2026
Status: 🔄 Open

Base: mainHead: think-modelfile-parameter


📝 Commits (1)

  • 3988a4e server: support think parameter in modelfiles

📊 Changes

13 files changed (+371 additions, -1 deletions)

View changed files

📝 api/types.go (+3 -0)
📝 cmd/cmd_test.go (+35 -0)
📝 cmd/interactive.go (+4 -0)
📝 docs/capabilities/thinking.mdx (+12 -0)
📝 docs/modelfile.mdx (+1 -0)
📝 parser/parser.go (+12 -0)
📝 parser/parser_test.go (+82 -0)
📝 server/create.go (+6 -0)
📝 server/images.go (+17 -1)
📝 server/images_test.go (+31 -0)
📝 server/routes.go (+14 -0)
📝 server/routes_generate_test.go (+114 -0)
📝 types/model/config.go (+40 -0)

📄 Description

Summary

Fixes #10961

  • Allow PARAMETER think true|false|high|medium|low in Modelfiles (case-insensitive)
  • Persist think setting in ConfigV2 as a proper model.Think type (alongside renderer/parser — no new OCI layer or media type)
  • Apply model-stored think default at request time; precedence: API request think > Modelfile default > auto-default for thinking-capable models (e.g. Qwen3, DeepSeek R1 default to enabled)
  • Think defaults are inherited from base models via FROM
  • Include think setting in /save so interactive sessions preserve it
  • Docs updated in modelfile.mdx and capabilities/thinking.mdx

Test plan

  • Parser tests: value variants, case-insensitivity + whitespace normalization, error on invalid values, last-wins override
  • Config round-trip: create model with think, GetModel reads it back, value matches
  • Model reconstruction: Model.String() round-trip for all think value types
  • /save tests: NewCreateRequest includes Think
  • Route handler integration test: model default applied when request omits think, explicit override works
  • Full suite passes: go test -count=1 ./api/... ./parser/... ./server/... ./cmd/... ./types/...

🔄 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/14630 **Author:** [@ageorgop](https://github.com/ageorgop) **Created:** 3/5/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `think-modelfile-parameter` --- ### 📝 Commits (1) - [`3988a4e`](https://github.com/ollama/ollama/commit/3988a4e2ccc9eb850f216b83e98a8c7f32758f42) server: support think parameter in modelfiles ### 📊 Changes **13 files changed** (+371 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `api/types.go` (+3 -0) 📝 `cmd/cmd_test.go` (+35 -0) 📝 `cmd/interactive.go` (+4 -0) 📝 `docs/capabilities/thinking.mdx` (+12 -0) 📝 `docs/modelfile.mdx` (+1 -0) 📝 `parser/parser.go` (+12 -0) 📝 `parser/parser_test.go` (+82 -0) 📝 `server/create.go` (+6 -0) 📝 `server/images.go` (+17 -1) 📝 `server/images_test.go` (+31 -0) 📝 `server/routes.go` (+14 -0) 📝 `server/routes_generate_test.go` (+114 -0) 📝 `types/model/config.go` (+40 -0) </details> ### 📄 Description ## Summary Fixes #10961 - Allow `PARAMETER think true|false|high|medium|low` in Modelfiles (case-insensitive) - Persist think setting in `ConfigV2` as a proper `model.Think` type (alongside renderer/parser — no new OCI layer or media type) - Apply model-stored think default at request time; precedence: API request `think` > Modelfile default > auto-default for thinking-capable models (e.g. Qwen3, DeepSeek R1 default to enabled) - Think defaults are inherited from base models via `FROM` - Include think setting in `/save` so interactive sessions preserve it - Docs updated in `modelfile.mdx` and `capabilities/thinking.mdx` ## Test plan - [x] Parser tests: value variants, case-insensitivity + whitespace normalization, error on invalid values, last-wins override - [x] Config round-trip: create model with think, `GetModel` reads it back, value matches - [x] Model reconstruction: `Model.String()` round-trip for all think value types - [x] `/save` tests: `NewCreateRequest` includes Think - [x] Route handler integration test: model default applied when request omits think, explicit override works - [x] Full suite passes: `go test -count=1 ./api/... ./parser/... ./server/... ./cmd/... ./types/...` --- <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-25 01:34:45 -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#46004