chat-langchain
chat-langchain copied to clipboard
Is there a way to do it with SSE (Server Sent Events) rather than Websockets?
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
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
same problem
I would like to know too. Any following up??? I need to use chain on my application.