GPT4All API: Add Streaming to the Completions endpoint #1129
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe your changes
Adding the ability to do streaming requests to the "/completions" endpoint of the API. Added in a test to showcase using the openai python client to stream the response from the api.
This addresses the NotImplementedError in the completions route of the api
https://github.com/nomic-ai/gpt4all/blob/main/gpt4all-api/gpt4all_api/app/api_v1/routes/completions.py#L54
Issue ticket number and link
Checklist before requesting a review
Demo
The above results in the model output being streamed to your console, directly from the API
Notes
There is a great issue thread over on the openai-node library page, discussing a lot of this streaming work.
openai/openai-node#18