Stop Streaming Early and Save Partial Response to History #5548
Unanswered
CristinaStn
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I need to stop agent streaming early (e.g., user clicks "Stop" button) and save the partial response to the history provider. The use case is:
The Problem I Encountered
When I break the stream loop and call get_final_response(), it consumes the entire remaining stream:
Workaround I Found
Setting the internal
ResponseStream._consumedflag before callingget_final_response():This works - both user and truncated assistant messages are saved to history correctly.
Concerns with my workaround:
Questions: is there:
Environment
Beta Was this translation helpful? Give feedback.
All reactions