[PR #132] [CLOSED] Add support for additional template instructions #15276

Closed
opened 2026-04-16 04:54:31 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/132
Author: @nathanleclaire
Created: 7/20/2023
Status: Closed

Base: mainHead: template_fun


📝 Commits (1)

  • 90df9f9 Add support for additional template instructions

📊 Changes

5 files changed (+114 additions, -1 deletions)

View changed files

examples/history (+12 -0)
examples/top (+19 -0)
📝 go.mod (+10 -0)
📝 go.sum (+52 -0)
📝 server/routes.go (+21 -1)

📄 Description

This PR adds support for Sprig library of template functions, as well as a custom "exec" function that can run commands on the user's computer. This enables fun and novel use cases like including randomness (Roll a d20 if needed?) analyzing local system details/data and more.

Prototype/thought experiment: What if you could dramatically expand what the Modelfile templates could do by adding Sprig as well as custom commands like exec that will provide users with the ability to do things on their computer?

Two new examples to demonstrate the idea.

history

Which will set the context's "date" to a random previous era, making the characters generated relatively novel:

Einstein
Screenshot 2023-07-19 at 5 02 24 PM

Benjamin Franklin
Screenshot 2023-07-19 at 5 05 12 PM

Thomas Jefferson
Screenshot 2023-07-19 at 5 05 51 PM

top

Which uses top to performance an analysis of the user's desktop system.

Screenshot 2023-07-19 at 5 23 14 PM

🔄 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/132 **Author:** [@nathanleclaire](https://github.com/nathanleclaire) **Created:** 7/20/2023 **Status:** ❌ Closed **Base:** `main` ← **Head:** `template_fun` --- ### 📝 Commits (1) - [`90df9f9`](https://github.com/ollama/ollama/commit/90df9f9bb35446bdfbcb8857badd9229e3eafe7d) Add support for additional template instructions ### 📊 Changes **5 files changed** (+114 additions, -1 deletions) <details> <summary>View changed files</summary> ➕ `examples/history` (+12 -0) ➕ `examples/top` (+19 -0) 📝 `go.mod` (+10 -0) 📝 `go.sum` (+52 -0) 📝 `server/routes.go` (+21 -1) </details> ### 📄 Description This PR adds support for Sprig library of template functions, as well as a custom "exec" function that can run commands on the user's computer. This enables fun and novel use cases like including randomness (Roll a d20 if needed?) analyzing local system details/data and more. Prototype/thought experiment: What if you could dramatically expand what the Modelfile templates could do by adding [Sprig](http://masterminds.github.io/sprig/) as well as custom commands like `exec` that will provide users with the ability to do things on their computer? Two new examples to demonstrate the idea. ### `history` Which will set the context's "date" to a random previous era, making the characters generated relatively novel: **Einstein** <img width="1137" alt="Screenshot 2023-07-19 at 5 02 24 PM" src="https://github.com/jmorganca/ollama/assets/1476820/10c3de1e-0c4c-47ff-830c-fc37892ca98a"> **Benjamin Franklin** <img width="1130" alt="Screenshot 2023-07-19 at 5 05 12 PM" src="https://github.com/jmorganca/ollama/assets/1476820/8a3fed04-efbd-4527-95ad-7f0183194158"> **Thomas Jefferson** <img width="1141" alt="Screenshot 2023-07-19 at 5 05 51 PM" src="https://github.com/jmorganca/ollama/assets/1476820/a757dc1e-3329-488e-99d9-9f74fa5486d0"> ### `top` Which uses `top` to performance an analysis of the user's desktop system. <img width="1127" alt="Screenshot 2023-07-19 at 5 23 14 PM" src="https://github.com/jmorganca/ollama/assets/1476820/142c8ccf-dce3-49b4-a25e-33aed85773c5"> --- <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-16 04:54:31 -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#15276