chat-langchain icon indicating copy to clipboard operation
chat-langchain copied to clipboard

Is there a way to do it with SSE (Server Sent Events) rather than Websockets?

Open oneryalcin opened this issue 1 year ago • 3 comments

Hi, this is very useful and inspiring example, but in my case I need to use one way communication using SSE, and does anybody have a guidance how to implement SSE for chains?

I can see LLMs (OpenAI) has stream() method which returns a generator and using that it is easy to implement SSE using Fast API (https://stackoverflow.com/a/75851218/6624291) however I don't see any way Chains return a generator for each token.

Any help is appreciated. Thanks

oneryalcin avatar Mar 27 '23 19:03 oneryalcin

I'm able to implement it with avoiding chains and implementing it with low level calls, but I'm happy to hear if there is any better way using chains:

https://gist.github.com/oneryalcin/2921408da70266aa61f9c40cb2973865

oneryalcin avatar Mar 27 '23 21:03 oneryalcin

same problem

ImmortalZ avatar Apr 26 '23 08:04 ImmortalZ

I would like to know too. Any following up??? I need to use chain on my application.

littlevincee avatar May 27 '23 06:05 littlevincee