Asynchronously Stream OpenAI GPT Outputs

I could not find any good examples online, so here’s how we can asynchronously stream OpenAI’s outputs in a streamlit app.

Screen Recording 2024-02-03 at 11.55.55 PM

1 Like

Nice! Would be nice also to see a contrasting implementation using the new st.write_stream(). See here.

As mentioned in Add support for async generators in `write_stream` · Issue #8161 · streamlit/streamlit · GitHub, st.write_stream() does not support async?