[PR #639] [MERGED] optional parameter to not stream response #15544

Closed
opened 2026-04-16 05:01:51 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/639
Author: @BruceMacD
Created: 9/28/2023
Status: Merged
Merged: 10/11/2023
Merged by: @BruceMacD

Base: mainHead: brucemacd/sync-generate


📝 Commits (5)

  • 65ddd02 optional generate header to not stream response
  • 0307d5b X-Streamed -> X-Stream
  • 3174aa0 update streaming request accept header
  • 2acb260 add optional stream param to request bodies
  • 6c9f242 Update routes.go

📊 Changes

4 files changed (+94 additions, -18 deletions)

View changed files

📝 api/client.go (+5 -1)
📝 api/types.go (+11 -3)
📝 docs/api.md (+21 -14)
📝 server/routes.go (+57 -0)

📄 Description

Add an optional stream parameter to the generate endpoint (and other endpoints that stream a response) to return the full response in one JSON body, rather than streaming:

curl -X POST -H "Content-Type: application/json" -d '{
    "model": "llama2",
    "prompt": "why is the sky blue?",
    "stream": false
}' 'localhost:11434/api/generate'

When stream is not specified it defaults to true.

resolves https://github.com/jmorganca/ollama/issues/281


🔄 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/639 **Author:** [@BruceMacD](https://github.com/BruceMacD) **Created:** 9/28/2023 **Status:** ✅ Merged **Merged:** 10/11/2023 **Merged by:** [@BruceMacD](https://github.com/BruceMacD) **Base:** `main` ← **Head:** `brucemacd/sync-generate` --- ### 📝 Commits (5) - [`65ddd02`](https://github.com/ollama/ollama/commit/65ddd02610fdd2a3d8c6a1629002259d9d0bbb4f) optional generate header to not stream response - [`0307d5b`](https://github.com/ollama/ollama/commit/0307d5b1bab2bbb5e368aa74b7c79f298c0a6a3a) X-Streamed -> X-Stream - [`3174aa0`](https://github.com/ollama/ollama/commit/3174aa03e769899fa1640485f7a55a0a33129a37) update streaming request accept header - [`2acb260`](https://github.com/ollama/ollama/commit/2acb260829995d7192a855b1632efdda3900f6a4) add optional stream param to request bodies - [`6c9f242`](https://github.com/ollama/ollama/commit/6c9f2425764c2a3e7605d06fa6352e53e3875bae) Update routes.go ### 📊 Changes **4 files changed** (+94 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `api/client.go` (+5 -1) 📝 `api/types.go` (+11 -3) 📝 `docs/api.md` (+21 -14) 📝 `server/routes.go` (+57 -0) </details> ### 📄 Description Add an optional `stream` parameter to the generate endpoint (and other endpoints that stream a response) to return the full response in one JSON body, rather than streaming: ``` curl -X POST -H "Content-Type: application/json" -d '{ "model": "llama2", "prompt": "why is the sky blue?", "stream": false }' 'localhost:11434/api/generate' ``` When `stream` is not specified it defaults to true. resolves https://github.com/jmorganca/ollama/issues/281 --- <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 05:01:51 -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#15544