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

api/chat.ts vs api/chat-stream.ts #16

Open
progremir opened this issue Mar 2, 2023 · 2 comments
Open

api/chat.ts vs api/chat-stream.ts #16

progremir opened this issue Mar 2, 2023 · 2 comments

Comments

@progremir
Copy link

Hello! Thanks for all the work! It was so easy to get it up and working!
I was wondering what's the difference between chat.ts and chat-stream.ts? I don't see chat-stream being used anywhere, but the bot's responses seem to come as a stream.

Thanks!

@rayli09
Copy link

rayli09 commented Mar 21, 2023

same question

@conroywhitney
Copy link
Contributor

Looking at the code, it seems the biggest difference is that the chat.ts uses HTTP text/event-stream, whereas chat-stream.ts uses websockets.

You can see a difference between the two here: https://stackoverflow.com/a/5326159

But they're both using the same model behind the scenes which has streaming set:

https://hwchase17.github.io/langchainjs/docs/modules/chat_models/overview#streaming

So yes -- they both will come through as a stream, they're just using different web technologies to do it.

(I'm not a maintainer, but feel free to close this ticket if that answers your question, or ping @sullivan-sean for more 😁 )

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

No branches or pull requests

3 participants