(path_or_url: str)
| 159 | |
| 160 | |
| 161 | async def read_file(path_or_url: str) -> str: |
| 162 | if path_or_url.startswith("http://") or path_or_url.startswith("https://"): |
| 163 | async with aiohttp.ClientSession() as session, session.get(path_or_url) as resp: |
| 164 | return await resp.text() |
| 165 | else: |
| 166 | with open(path_or_url, encoding="utf-8") as f: |
| 167 | return f.read() |
| 168 | |
| 169 | |
| 170 | async def write_local_file(output_path: str, batch_outputs: list[BatchRequestOutput]) -> None: |