Finalize and emit all buffered aggregates for a given task context. This writes current aggregates (using their stable paragraph item_id) and clears the corresponding buffers. Use at task end (success or fail).
(
self,
conversation_id: str,
thread_id: Optional[str],
task_id: Optional[str],
)
| 261 | return out |
| 262 | |
| 263 | def flush_task( |
| 264 | self, |
| 265 | conversation_id: str, |
| 266 | thread_id: Optional[str], |
| 267 | task_id: Optional[str], |
| 268 | ) -> List[SaveItem]: |
| 269 | """Finalize and emit all buffered aggregates for a given task context. |
| 270 | |
| 271 | This writes current aggregates (using their stable paragraph item_id) |
| 272 | and clears the corresponding buffers. Use at task end (success or fail). |
| 273 | """ |
| 274 | keys_to_flush = self._collect_task_keys(conversation_id, thread_id, task_id) |
| 275 | return self._finalize_keys(keys_to_flush) |
| 276 | |
| 277 | def _make_save_item_from_response(self, resp: BaseResponse) -> SaveItem: |
| 278 | data: UnifiedResponseData = resp.data |