[GH-ISSUE #9480] Add system prompt override to chat #68232

Closed
opened 2026-05-04 12:57:29 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @jbutlerdev on GitHub (Mar 3, 2025).
Original GitHub issue: https://github.com/ollama/ollama/issues/9480

Similar to #296

It would be nice to be able to override the system prompt when sending a Chat Request and not just a generate

Originally created by @jbutlerdev on GitHub (Mar 3, 2025). Original GitHub issue: https://github.com/ollama/ollama/issues/9480 Similar to #296 It would be nice to be able to override the system prompt when sending a Chat Request and not just a generate
GiteaMirror added the feature request label 2026-05-04 12:57:29 -05:00
Author
Owner

@rick-github commented on GitHub (Mar 3, 2025):

You can.

$ curl -s localhost:11434/api/chat -d '{
  "model":"qwen2.5:7b",
  "messages":[
    {"role":"system","content":"Talk like a pirate"},
    {"role":"user","content":"hello"}
  ],
  "stream":false}' | jq .message.content
"Ahoy there, matey! Welcome aboard me ship. How be ye doin'? Be ye lookin' to cross the seven seas or perhaps seek some treasure? Ye needna worry 'bout them parrots; they just talk too much sometimes. So, what wind be blowin' your sails today?"

<!-- gh-comment-id:2695231635 --> @rick-github commented on GitHub (Mar 3, 2025): You can. ```console $ curl -s localhost:11434/api/chat -d '{ "model":"qwen2.5:7b", "messages":[ {"role":"system","content":"Talk like a pirate"}, {"role":"user","content":"hello"} ], "stream":false}' | jq .message.content "Ahoy there, matey! Welcome aboard me ship. How be ye doin'? Be ye lookin' to cross the seven seas or perhaps seek some treasure? Ye needna worry 'bout them parrots; they just talk too much sometimes. So, what wind be blowin' your sails today?" ```
Author
Owner

@jbutlerdev commented on GitHub (Mar 3, 2025):

My understanding was that a system message was handled a little differently than the actual system prompt. For instance will this override the original system prompt specified in the modelfile?

<!-- gh-comment-id:2695275156 --> @jbutlerdev commented on GitHub (Mar 3, 2025): My understanding was that a system message was handled a little differently than the actual system prompt. For instance will this override the original system prompt specified in the modelfile?
Author
Owner

@rick-github commented on GitHub (Mar 3, 2025):

For instance will this override the original system prompt specified in the modelfile?

Yes. You can verify this by setting OLLAMA_DEBUG=1 in the server environment and search the log file for "chat request". The processed prompt will be recorded and should show the system prompt from messages in place of the default system prompt for the model.

<!-- gh-comment-id:2695283463 --> @rick-github commented on GitHub (Mar 3, 2025): > For instance will this override the original system prompt specified in the modelfile? Yes. You can verify this by setting `OLLAMA_DEBUG=1` in the server environment and search the [log file](https://github.com/ollama/ollama/blob/main/docs/troubleshooting.md#how-to-troubleshoot-issues) for "chat request". The processed prompt will be recorded and should show the system prompt from `messages` in place of the default system prompt for the model.
Author
Owner

@jbutlerdev commented on GitHub (Mar 3, 2025):

Oh, dang. Sorry for missing that. You can obviously close this then.

<!-- gh-comment-id:2695300066 --> @jbutlerdev commented on GitHub (Mar 3, 2025): Oh, dang. Sorry for missing that. You can obviously close this then.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#68232