I’m creating a chatbot with Dash using the GPT3.5 API, but I encountered some problems with streaming. Dcc.store does not support Python generator objects; they are not json serializable.
The value in question is either the only value returned,
or is in the top level of the returned list,
and has string representation
`[['hi', <generator object EngineAPIResource.create.<locals>.<genexpr> at 0x7f4239cb6340>]]`
In general, Dash properties can only be
dash components, strings, dictionaries, numbers, None,
or lists of those.
Is there any way to implement the streaming inside the session.
Yep, I thought streaming the output would save some time, but implementing streaming in Dash would complicate things. @AIMPED Is there any other way to do it?
As far as storing information in dcc.Store() components there is no other solution I know of.
Other than that, I’m not sure what you are trying to do. I could imagine a dash app communicating with an fastAPI or even flask on which you have the openAI related code. But I’m not sure if this is the best way to set this up, looking at this.
No, it would actually decrease latency as the amount of data transferred is reduced (callbacks are executed serverside).
If you need streaming, you can use a Quart server to stream the data to a Websocket component combined with a client side callback that updates relevant UI components.