sullivan-sean / chat-langchainjs

https://chat-langchainjs.fly.dev/
290 stars 76 forks source link

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

Open progremir opened 1 year ago

progremir commented 1 year ago

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 commented 1 year ago

same question

conroywhitney commented 1 year ago

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 😁 )