[GH-ISSUE #1533] Ollama logs/serve should show fully templatized body that is sent to the LLM #835

Closed
opened 2026-04-12 10:30:08 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @scpedicini on GitHub (Dec 14, 2023).
Original GitHub issue: https://github.com/ollama/ollama/issues/1533

Can we get ollama serve to show the fully populated "templatized" input in the logs? (input + modelfile template). It's difficult to determine if the template syntax language is working as expected when building custom models. Currently, using the /api/chat endpoint only logs out that the endpoint was hit.

Logs:

ollama-gpu  | [GIN] 2023/12/14 - 23:05:37 | 200 |  2.626169805s |      172.18.0.1 | POST     "/api/chat"

This makes it difficult to analyze how things work.

For example, here is the official ollama Modelfile for mistral:7b-instruct:

# Modelfile generated by "ollama show"
# To build a new Modelfile based on this one, replace the FROM line with:
# FROM mistral:7b-instruct-q5_K_M

FROM /root/.ollama/models/blobs/sha256:dfe9a77f22f5a72d25dcf6a55b7401c41ef92e28f3a7ad7c6f6f6b651023df55
TEMPLATE """[INST] {{ .System }} {{ .Prompt }} [/INST]
"""
PARAMETER stop "[INST]"
PARAMETER stop "[/INST]"
PARAMETER stop "<<SYS>>"
PARAMETER stop "<</SYS>>"

It is difficult to grok how such a simple prompt handles a complex request with an array of messages[] coming from the chat API endpoint /api/chat

"messages": [
    {
        "role": "system",
        "content": "You are a helpful assistant. Always follow instructions."
    },        {
        "role": "assistant",
        "content": "How can I help you?"
    },
    {
        "role": "user",
        "content": "How can I fold myself in half so that I can qualify as a carry-on with American Airlines?"
    }
]
Originally created by @scpedicini on GitHub (Dec 14, 2023). Original GitHub issue: https://github.com/ollama/ollama/issues/1533 Can we get `ollama serve` to show the fully populated "templatized" input in the logs? (input + modelfile template). It's difficult to determine if the template syntax language is working as expected when building custom models. Currently, using the `/api/chat` endpoint only logs out that the endpoint was hit. Logs: ```bash ollama-gpu | [GIN] 2023/12/14 - 23:05:37 | 200 | 2.626169805s | 172.18.0.1 | POST "/api/chat" ``` This makes it difficult to analyze how things work. For example, here is the official ollama Modelfile for `mistral:7b-instruct`: ``` # Modelfile generated by "ollama show" # To build a new Modelfile based on this one, replace the FROM line with: # FROM mistral:7b-instruct-q5_K_M FROM /root/.ollama/models/blobs/sha256:dfe9a77f22f5a72d25dcf6a55b7401c41ef92e28f3a7ad7c6f6f6b651023df55 TEMPLATE """[INST] {{ .System }} {{ .Prompt }} [/INST] """ PARAMETER stop "[INST]" PARAMETER stop "[/INST]" PARAMETER stop "<<SYS>>" PARAMETER stop "<</SYS>>" ``` It is difficult to grok how such a simple prompt handles a complex request with an array of `messages[]` coming from the chat API endpoint `/api/chat` ```json "messages": [ { "role": "system", "content": "You are a helpful assistant. Always follow instructions." }, { "role": "assistant", "content": "How can I help you?" }, { "role": "user", "content": "How can I fold myself in half so that I can qualify as a carry-on with American Airlines?" } ] ```
GiteaMirror added the feature request label 2026-04-12 10:30:08 -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#835