[GH-ISSUE #4518] Add option to control start of response to generate api #28592

Closed
opened 2026-04-22 06:59:33 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @notasquid1938 on GitHub (May 19, 2024).
Original GitHub issue: https://github.com/ollama/ollama/issues/4518

Using openwebui for ollama or textgenwebui. you can control what the model's response begins with to steer it in a certain direction. It would be very helpful to have this built-in to the api. I have struggled to recreate this effect with the api by trying to include the model's response portion of the template in my initial prompt but have been unsuccessful so far.

Originally created by @notasquid1938 on GitHub (May 19, 2024). Original GitHub issue: https://github.com/ollama/ollama/issues/4518 Using openwebui for ollama or textgenwebui. you can control what the model's response begins with to steer it in a certain direction. It would be very helpful to have this built-in to the api. I have struggled to recreate this effect with the api by trying to include the model's response portion of the template in my initial prompt but have been unsuccessful so far.
GiteaMirror added the feature requestapi labels 2026-04-22 06:59:34 -05:00
Author
Owner

@rick-github commented on GitHub (Feb 1, 2026):

You can achieve this be telling the assistant how to start its response:

$ curl -s localhost:11434/api/chat -d '{
  "model":"qwen2.5:0.5b",
  "stream":false,
  "messages":[
    {"role":"user","content":"Why is the sky blue?"},
    {"role":"assistant","content":"The reason"}
  ]}' | jq -r .message.content 
 why we see the sky as being blue instead of green or yellow is due to
light scattering and absorption effects in the atmosphere.

This is dependent on the template properly formatting the prompt.

<!-- gh-comment-id:3831720499 --> @rick-github commented on GitHub (Feb 1, 2026): You can achieve this be telling the assistant how to start its response: ```console $ curl -s localhost:11434/api/chat -d '{ "model":"qwen2.5:0.5b", "stream":false, "messages":[ {"role":"user","content":"Why is the sky blue?"}, {"role":"assistant","content":"The reason"} ]}' | jq -r .message.content why we see the sky as being blue instead of green or yellow is due to light scattering and absorption effects in the atmosphere. ``` This is dependent on the template properly formatting the prompt.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#28592