From 522c8fd53aeebc9ec65e1a206a1746a66bfcf2d5 Mon Sep 17 00:00:00 2001 From: semio Date: Thu, 16 Jan 2025 11:28:50 +0800 Subject: [PATCH] add retries --- automation-api/lib/pilot/send_batch_prompt_litellm.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/automation-api/lib/pilot/send_batch_prompt_litellm.py b/automation-api/lib/pilot/send_batch_prompt_litellm.py index 1a2e8a7..2cb292b 100644 --- a/automation-api/lib/pilot/send_batch_prompt_litellm.py +++ b/automation-api/lib/pilot/send_batch_prompt_litellm.py @@ -45,6 +45,9 @@ def process_single_prompt(data: Dict) -> Dict: """Process a single prompt using LiteLLM.""" try: time.sleep(0.5) # Add delay between requests + # add retry to request + if "num_retries" not in data.keys(): + data["num_retries"] = 5 response = litellm.completion(**data["body"]) # type: ignore # Format response like OpenAI batch API