Skip to content

Commit

Permalink
clean up function implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
rishsriv committed Dec 12, 2024
1 parent 5b6e5a9 commit 60fff3b
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions defog_utils/utils_multi_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ async def chat_async(
seed=0,
store=True,
metadata=None,
) -> Optional[LLMResponse]:
) -> LLMResponse:
"""
Returns the response from the LLM API for a single model that is passed in.
Includes retry logic with exponential backoff for up to 3 attempts.
Expand All @@ -88,9 +88,6 @@ async def chat_async(
metadata=metadata,
)
except Exception as e:
if attempt == max_retries - 1: # Last attempt
raise # Re-raise the last exception

delay = base_delay * (2 ** attempt) # Exponential backoff
print(f"Attempt {attempt + 1} failed. Retrying in {delay} seconds...")
await asyncio.sleep(delay)
Expand Down

0 comments on commit 60fff3b

Please sign in to comment.