Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add streaming support for chatcompletions #749

Merged
merged 1 commit into from
Jan 15, 2024
Merged

Add streaming support for chatcompletions #749

merged 1 commit into from
Jan 15, 2024

Conversation

jlowin
Copy link
Member

@jlowin jlowin commented Jan 15, 2024

This PR allows you to pass a stream_callback to generate_chat in order to handle streaming responses from chat completion endpoints.

stream_callback receives a StreamingChatResponse object which has:

  • chunk, the most recently received chatcompletion delta
  • completion, the reconstructed chatcompletion (up through the provided chunk)
  • messages, for easy access to the messages received in the completion (a list in case n > 1)

Note this is not used in Marvin features yet.

@jlowin
Copy link
Member Author

jlowin commented Jan 15, 2024

Merging because the failed test is a flaky one

@jlowin jlowin merged commit 9bc94be into 2.0 Jan 15, 2024
13 of 14 checks passed
@jlowin jlowin deleted the streaming branch January 15, 2024 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant