[GH-ISSUE #789] How to disable streaming output in Rest API #26136

Closed
opened 2026-04-22 02:10:44 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @ajasingh on GitHub (Oct 14, 2023).
Original GitHub issue: https://github.com/ollama/ollama/issues/789

I am trying to get structured information like json back from model , so i am not looking at streamed output . I have tried setting content-type:application/json as mentioned in one of the issues but is still get back streamed output . Can somebody help me how to disable streamed output

Originally created by @ajasingh on GitHub (Oct 14, 2023). Original GitHub issue: https://github.com/ollama/ollama/issues/789 I am trying to get structured information like json back from model , so i am not looking at streamed output . I have tried setting content-type:application/json as mentioned in one of the issues but is still get back streamed output . Can somebody help me how to disable streamed output
Author
Owner

@wzulfikar commented on GitHub (Oct 14, 2023):

I tried and it works for me. I assume you're referring to https://github.com/jmorganca/ollama/pull/639 (where it adds the optional "stream": false param). Note that I didn't use content-type: application/json, just using curl.

curl -XPOST localhost:11434/api/generate -d '{"model": "zephyr", "prompt": "Why is the sky blue?", "stream": false }'

https://github.com/jmorganca/ollama/assets/7823011/914a4445-e051-4936-9ddb-a12c4221718d

<!-- gh-comment-id:1762871779 --> @wzulfikar commented on GitHub (Oct 14, 2023): I tried and it works for me. I assume you're referring to https://github.com/jmorganca/ollama/pull/639 (where it adds the optional `"stream": false` param). Note that I didn't use `content-type: application/json`, just using `curl`. ```sh curl -XPOST localhost:11434/api/generate -d '{"model": "zephyr", "prompt": "Why is the sky blue?", "stream": false }' ``` https://github.com/jmorganca/ollama/assets/7823011/914a4445-e051-4936-9ddb-a12c4221718d
Author
Owner

@mxyng commented on GitHub (Oct 16, 2023):

This is done in #639 and part of the release starting 0.1.2

<!-- gh-comment-id:1765009279 --> @mxyng commented on GitHub (Oct 16, 2023): This is done in #639 and part of the release starting 0.1.2
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#26136