Repository navigation
Stop Streaming Early and Save Partial Response to History #5548
Replies: 3 comments 1 reply
|
Adding Eduard van Valkenburg (@eavanvalkenburg) to comment |
|
CristinaStn thanks for posting, we could add a The other problem is that the finalizers are designed to be flexible, so in some cases it just combines update into a single response, but it can also be used to update UI, to store in file storage, etc. which is all circumvented when setting So, the best alternative, is to use a westey (@westey-m) has also done a lot of looking into different approaches here, he might have some other insights to share, but the long and short of it, is |
|
I came with the same problem when i stop the response streaming in between it gives me a error 400 tool call missing . Did you find any other solid way of doing the same it . |
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
All reactions