mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-06 08:16:43 +00:00
test fix await_batch_completion
This commit is contained in:
parent
1d2a9e423c
commit
3d87bf9fe6
1 changed files with 10 additions and 2 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue