[PR #1210] [CLOSED] Add user to prompt template #72799

Closed
opened 2026-05-05 04:21:11 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/1210
Author: @BruceMacD
Created: 11/20/2023
Status: Closed

Base: mainHead: brucemacd/user-template


📝 Commits (10+)

📊 Changes

9 files changed (+305 additions, -137 deletions)

View changed files

📝 api/types.go (+33 -22)
📝 cmd/cmd.go (+46 -29)
📝 docs/api.md (+61 -17)
📝 docs/modelfile.md (+5 -5)
📝 llm/llama.go (+5 -21)
📝 llm/llm.go (+1 -1)
📝 server/images.go (+10 -18)
📝 server/images_test.go (+4 -6)
📝 server/routes.go (+140 -18)

📄 Description

With the upcoming messages API change the lack of symmetry between the user role and the prompt in the template is confusing. This change proposes adding {{ .User }} as an alternative to {{ .Prompt }} for the model template.

Here's an example:

FROM llama2
PARAMETER temperature 1
TEMPLATE """[INST] <<SYS>>{{ .System }}<</SYS>>

{{ .User }} [/INST]
"""
SYSTEM """
You are Mario from super mario bros, acting as an assistant.
"""

🔄 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/1210 **Author:** [@BruceMacD](https://github.com/BruceMacD) **Created:** 11/20/2023 **Status:** ❌ Closed **Base:** `main` ← **Head:** `brucemacd/user-template` --- ### 📝 Commits (10+) - [`9c21d23`](https://github.com/ollama/ollama/commit/9c21d23a354601dc44cb5e78c16edb6447f2aeb2) add messages to /generate api - [`4718ecc`](https://github.com/ollama/ollama/commit/4718ecc62ea04118baf8b3c023184269cf997330) switch to role based messages - [`e03fbf5`](https://github.com/ollama/ollama/commit/e03fbf558d8f09856be497943a879d274aad0be1) chat mode - [`8c044c8`](https://github.com/ollama/ollama/commit/8c044c8dd2415b78095926f20d9d657a90452aeb) cli fixes - [`2d5d926`](https://github.com/ollama/ollama/commit/2d5d926ce0752f2e8e67daa69da01e612e4d2c0d) clean up - [`50ba1dc`](https://github.com/ollama/ollama/commit/50ba1dcc7ebaf4ac2564b4998a3c413f71236762) PR feedback - [`6e6b3ba`](https://github.com/ollama/ollama/commit/6e6b3baa231861677c32bac60b5ea5e10bc32058) Update api.md - [`1eff685`](https://github.com/ollama/ollama/commit/1eff6853eb1aef505597ab0d3a6a2110eeb22855) error on unknown message role - [`72ce843`](https://github.com/ollama/ollama/commit/72ce843921296cd1d6ac4e0a7c670cceb08075b7) Update images_test.go - [`75657e3`](https://github.com/ollama/ollama/commit/75657e30e05cf8ec1f9f388f5a656c0ae5f317e3) fix prompt spacing ### 📊 Changes **9 files changed** (+305 additions, -137 deletions) <details> <summary>View changed files</summary> 📝 `api/types.go` (+33 -22) 📝 `cmd/cmd.go` (+46 -29) 📝 `docs/api.md` (+61 -17) 📝 `docs/modelfile.md` (+5 -5) 📝 `llm/llama.go` (+5 -21) 📝 `llm/llm.go` (+1 -1) 📝 `server/images.go` (+10 -18) 📝 `server/images_test.go` (+4 -6) 📝 `server/routes.go` (+140 -18) </details> ### 📄 Description With the upcoming `messages` API change the lack of symmetry between the `user` role and the `prompt` in the template is confusing. This change proposes adding `{{ .User }}` as an alternative to `{{ .Prompt }}` for the model template. Here's an example: ``` FROM llama2 PARAMETER temperature 1 TEMPLATE """[INST] <<SYS>>{{ .System }}<</SYS>> {{ .User }} [/INST] """ SYSTEM """ You are Mario from super mario bros, acting as an assistant. """ ``` --- <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 04:21:11 -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#72799