Dash Streaming Callbacks

A callback delivers its output once, when it returns. Anything produced incrementally, e.g. an LLM response arriving token by token, progress through a multi-step job, a live data feed, etc. , either sits invisible until the work finishes, or forces a workaround, like polling with dcc.Interval, or dropping into WebSocket callbacks and driving the UI through set_props.

Proposed solution: Let a callback yield. A callback defined with async def and yield instead of return sends each value to the browser as it's produced, with no new keyword and no backend requirement. Yielding Patch objects sends only what changed, so token-by-token updates don't resend the whole value.

Please authenticate to join the conversation.

Upvoters
Status

In Progress

Board

Libraries

Date

About 1 hour ago

Author

Matthew Brown

Subscribe to post

Get notified by email when there are changes.