For most chat applications, we want to stream each token back to the client. LangChain's callback
support is fantastic for async Web Sockets via FastAPI, and supports this out of the box.
However, developers migrating from OpenAI's python library may find difficulty in implementing a Python generator along the same lines of the OpenAI library approach.
Here's an example of the OpenAI library streaming generator, from the OpenAI Cookbook