[PR #9874] [MERGED] parser: remove role validation from Modelfile parser #23619

Closed
opened 2026-04-19 17:06:47 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/9874
Author: @rylativity
Created: 3/19/2025
Status: Merged
Merged: 3/20/2025
Merged by: @ParthSareen

Base: mainHead: remove-role-validation


📝 Commits (5)

  • 5572460 this updates parser/parser.go to allow arbitrary roles in Modelfile MESSAGE blocks
  • 189006c this adds test to ensure that arbitrary roles are parsed from Modelfile without issue
  • e1b3c18 Update parser/parser.go
  • 065d056 import slog in parser.go
  • c50ac94 remove unused errInvalidMessageRole error

📊 Changes

2 files changed (+12 additions, -16 deletions)

View changed files

📝 parser/parser.go (+7 -11)
📝 parser/parser_test.go (+5 -5)

📄 Description

This allows passing arbitrary roles in a MESSAGE block in a Modelfile. Related to https://github.com/ollama/ollama-python/pull/462 and comments from @ParthSareen.

Example Modelfiles that this PR will now allow:

FROM granite3.2

MESSAGE control thinking

or

FROM granite3.2

MESSAGE somerandomrole whatever you want here

🔄 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/9874 **Author:** [@rylativity](https://github.com/rylativity) **Created:** 3/19/2025 **Status:** ✅ Merged **Merged:** 3/20/2025 **Merged by:** [@ParthSareen](https://github.com/ParthSareen) **Base:** `main` ← **Head:** `remove-role-validation` --- ### 📝 Commits (5) - [`5572460`](https://github.com/ollama/ollama/commit/5572460db2eba7984e53d3ad8942b5399b274096) this updates parser/parser.go to allow arbitrary roles in Modelfile MESSAGE blocks - [`189006c`](https://github.com/ollama/ollama/commit/189006cc2280a0dfe175a49dfa0ae00048471554) this adds test to ensure that arbitrary roles are parsed from Modelfile without issue - [`e1b3c18`](https://github.com/ollama/ollama/commit/e1b3c189e64ed276582154438d991e4b26b3ad29) Update parser/parser.go - [`065d056`](https://github.com/ollama/ollama/commit/065d056e1bcb83a19a263433d3b06d5f301b35bf) import slog in parser.go - [`c50ac94`](https://github.com/ollama/ollama/commit/c50ac9471e6bf22c6e4eed6f8e8cccfbd19d8bdd) remove unused errInvalidMessageRole error ### 📊 Changes **2 files changed** (+12 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `parser/parser.go` (+7 -11) 📝 `parser/parser_test.go` (+5 -5) </details> ### 📄 Description This allows passing arbitrary roles in a MESSAGE block in a Modelfile. Related to https://github.com/ollama/ollama-python/pull/462 and comments from @ParthSareen. Example Modelfiles that this PR will now allow: ``` FROM granite3.2 MESSAGE control thinking ``` or ``` FROM granite3.2 MESSAGE somerandomrole whatever you want here ``` --- <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-19 17:06:47 -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#23619