mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-10 11:03:42 +00:00
test fix await_batch_completion
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user