Skip to content

Commit

Permalink
add retries
Browse files Browse the repository at this point in the history
  • Loading branch information
semio committed Jan 16, 2025
1 parent 81b16b0 commit 522c8fd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions automation-api/lib/pilot/send_batch_prompt_litellm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 522c8fd

Please sign in to comment.