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

Streaming Support for Ayushma Responses #7

Merged
merged 5 commits into from
May 8, 2023
Merged

Streaming Support for Ayushma Responses #7

merged 5 commits into from
May 8, 2023

Conversation

Ashesh3
Copy link
Member

@Ashesh3 Ashesh3 commented May 8, 2023

Required backend change: coronasafe/ayushma#101

This pull request significantly enhances the user experience by adding real-time streaming support for Ayushma responses. Instead of waiting for the AI to generate a complete response, users will now be able to see each token as it arrives from OpenAI. This provides a more interactive and engaging experience, as users can follow the AI's thought process in real time.

To achieve this functionality, The @microsoft/fetch-event-source package has been integrated, which efficiently processes the incoming event source response stream. This package is designed specifically to handle streaming data, ensuring smooth and reliable delivery of tokens to the user interface.

The core changes have been made in the request method within the api.ts file. This method has been updated to support a new stream=true option, which enables the streaming functionality. Additionally, an onMessage callback has been introduced that receives an EventSourceMessage. This callback is responsible for handling individual tokens as they arrive from the AI, ensuring that they are displayed to the user in a timely manner.

Overall, this enhancement greatly improves the responsiveness and interactivity of the system, providing users with a more engaging and dynamic experience when interacting with Ayushma (AI) responses.

ayushma_streaming.mp4

@Ashesh3 Ashesh3 requested a review from skks1212 May 8, 2023 05:56
@vercel
Copy link

vercel bot commented May 8, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ayushma-fe ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 8, 2023 1:21pm

@skks1212 skks1212 merged commit 230e7f4 into master May 8, 2023
1 check passed
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.

None yet

2 participants