Skip to content

Commit

Permalink
fix: add underlying error message for Retries Exhausted error (#2308)
Browse files Browse the repository at this point in the history
  • Loading branch information
carenthomas authored Dec 22, 2024
1 parent ec55e03 commit 3b94b45
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions letta/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,6 @@ def _get_ai_reply(
# Force a tool call if exactly one tool is specified
elif step_count is not None and step_count > 0 and len(allowed_tool_names) == 1:
force_tool_call = allowed_tool_names[0]

for attempt in range(1, empty_response_retry_limit + 1):
try:
response = create(
Expand Down Expand Up @@ -314,7 +313,7 @@ def _get_ai_reply(
except ValueError as ve:
if attempt >= empty_response_retry_limit:
warnings.warn(f"Retry limit reached. Final error: {ve}")
break
raise Exception(f"Retries exhausted and no valid response received. Final error: {ve}")
else:
delay = min(backoff_factor * (2 ** (attempt - 1)), max_delay)
warnings.warn(f"Attempt {attempt} failed: {ve}. Retrying in {delay} seconds...")
Expand Down

0 comments on commit 3b94b45

Please sign in to comment.