Write the responses to a local file. output_path: The path to write the responses to. batch_outputs: The list of batch outputs to write.
(output_path: str, batch_outputs: list[BatchRequestOutput])
| 168 | |
| 169 | |
| 170 | async def write_local_file(output_path: str, batch_outputs: list[BatchRequestOutput]) -> None: |
| 171 | """ |
| 172 | Write the responses to a local file. |
| 173 | output_path: The path to write the responses to. |
| 174 | batch_outputs: The list of batch outputs to write. |
| 175 | """ |
| 176 | # We should make this async, but as long as run_batch runs as a |
| 177 | # standalone program, blocking the event loop won't effect performance. |
| 178 | with open(output_path, "w", encoding="utf-8") as f: |
| 179 | for o in batch_outputs: |
| 180 | print(o.model_dump_json(), file=f) |
| 181 | |
| 182 | |
| 183 | async def upload_data(output_url: str, data_or_file: str, from_file: bool) -> None: |