[GH-ISSUE #675] api improvements #46814

Closed
opened 2026-04-28 00:20:34 -05:00 by GiteaMirror · 7 comments
Owner

Originally created by @jtoy on GitHub (Oct 2, 2023).
Original GitHub issue: https://github.com/ollama/ollama/issues/675

its a stream of objects that are separated with a newline. often times new lines are returned in the response, so that breaks just splitting on new lines.
I think the split should be on something else.
Also it seems like there should be an api endpoint that just returns the whole response in a string.

thoughts?

Originally created by @jtoy on GitHub (Oct 2, 2023). Original GitHub issue: https://github.com/ollama/ollama/issues/675 its a stream of objects that are separated with a newline. often times new lines are returned in the response, so that breaks just splitting on new lines. I think the split should be on something else. Also it seems like there should be an api endpoint that just returns the whole response in a string. thoughts?
Author
Owner

@technovangelist commented on GitHub (Oct 2, 2023):

If using JS, sometimes fetch will grab multiple json objects at once if there are more than one available. Your code should split the string received by '\n' to ensure its dealing with a single response to parse. This is common in other streaming apis as well.

<!-- gh-comment-id:1743662978 --> @technovangelist commented on GitHub (Oct 2, 2023): If using JS, sometimes fetch will grab multiple json objects at once if there are more than one available. Your code should split the string received by '\n' to ensure its dealing with a single response to parse. This is common in other streaming apis as well.
Author
Owner

@jtoy commented on GitHub (Oct 2, 2023):

the problem is newlines in the responses

<!-- gh-comment-id:1743908625 --> @jtoy commented on GitHub (Oct 2, 2023): the problem is newlines in the responses
Author
Owner

@technovangelist commented on GitHub (Oct 2, 2023):

perhaps you can give an example of what you are referring to.

<!-- gh-comment-id:1743911954 --> @technovangelist commented on GitHub (Oct 2, 2023): perhaps you can give an example of what you are referring to.
Author
Owner

@technovangelist commented on GitHub (Oct 3, 2023):

Do you have an example of the problem you are seeing and what you think it should be?

<!-- gh-comment-id:1744975423 --> @technovangelist commented on GitHub (Oct 3, 2023): Do you have an example of the problem you are seeing and what you think it should be?
Author
Owner

@reustle commented on GitHub (Oct 4, 2023):

Also it seems like there should be an api endpoint that just returns the whole response in a string.

For this, fortunately there is a recent PR for this that seems like it will be merged soon https://github.com/jmorganca/ollama/pull/639

<!-- gh-comment-id:1746176558 --> @reustle commented on GitHub (Oct 4, 2023): > Also it seems like there should be an api endpoint that just returns the whole response in a string. For this, fortunately there is a recent PR for this that seems like it will be merged soon https://github.com/jmorganca/ollama/pull/639
Author
Owner

@technovangelist commented on GitHub (Oct 5, 2023):

Haven't heard back from you. If you have an example, please reopen but for now I'll close this.

<!-- gh-comment-id:1749282102 --> @technovangelist commented on GitHub (Oct 5, 2023): Haven't heard back from you. If you have an example, please reopen but for now I'll close this.
Author
Owner

@mccainz commented on GitHub (Jan 10, 2024):

Also it seems like there should be an api endpoint that just returns the whole response in a string.

For this, fortunately there is a recent PR for this that seems like it will be merged soon #639

"stream" : false works perfectly in this regard.

<!-- gh-comment-id:1884830590 --> @mccainz commented on GitHub (Jan 10, 2024): > > Also it seems like there should be an api endpoint that just returns the whole response in a string. > > For this, fortunately there is a recent PR for this that seems like it will be merged soon #639 `"stream" : false` works perfectly in this regard.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#46814