Tally results and invoke callbacks in the main thread.
(output: _BatchOutput)
| 552 | manifest.set_total_batches(total_batches) |
| 553 | |
| 554 | def _handle_output(output: _BatchOutput) -> None: |
| 555 | """Tally results and invoke callbacks in the main thread.""" |
| 556 | result.stats.input_tokens += output.usage.input_tokens |
| 557 | result.stats.output_tokens += output.usage.output_tokens |
| 558 | result.stats.reasoning_tokens += output.usage.reasoning_tokens |
| 559 | for entry in output.entries: |
| 560 | _tally(result, entry) |
| 561 | if on_result: |
| 562 | on_result(entry.gz_path, entry) |
| 563 | |
| 564 | inflight = _InflightBatches() |
| 565 |