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

Json streaming POC (WIP) #346

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from
Open

Json streaming POC (WIP) #346

wants to merge 3 commits into from

Conversation

avaer
Copy link
Contributor

@avaer avaer commented Oct 23, 2024

This is a simple POC of how we could implement streaming output for our chat messages. This is a highly desirable feature and almost all AI inference endpoints support it.

Since we deal exclusively in formatted JSON messages, it's a little tricky to extract the partially completed JSON keys/values before they are done (e.g. printing half of a deep string that's not even terminated).

This POC shows how we can do it using https://www.npmjs.com/package/@streamparser/json-whatwg. Example parse is included.

Not to be merged, this is just a hack for now.

Copy link

vercel bot commented Oct 23, 2024

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

Name Status Preview Comments Updated (UTC)
chat ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 5, 2024 9:53pm
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 5, 2024 9:53pm

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