test fix await_batch_completion

This commit is contained in:
Ishaan Jaff
2025-03-06 08:15:45 -08:00
parent 1d2a9e423c
commit 3d87bf9fe6
@@ -92,7 +92,10 @@ def create_batch_oai_sdk(filepath: str, custom_llm_provider: str) -> str:
def await_batch_completion(batch_id: str, custom_llm_provider: str):
while True:
max_tries = 3
tries = 0
while tries < max_tries:
batch = client.batches.retrieve(
batch_id, extra_body={"custom_llm_provider": custom_llm_provider}
)
@@ -100,9 +103,14 @@ def await_batch_completion(batch_id: str, custom_llm_provider: str):
print(f"Batch {batch_id} completed.")
return
print("waiting for batch to complete...")
tries += 1
print(f"waiting for batch to complete... (attempt {tries}/{max_tries})")
time.sleep(10)
print(
f"Reached maximum number of attempts ({max_tries}). Batch may still be processing."
)
def write_content_to_file(
batch_id: str, output_path: str, custom_llm_provider: str