Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/pyob/core_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,10 +487,12 @@ def get_valid_llm_response(self, prompt: str, validator, context: str = "") -> s

# 3. Handle Empty or Error Responses (STOPS THE INFINITE LOOP)
if not response_text or response_text.startswith("ERROR_CODE_"):
# If we are in the cloud, we need to wait longer for the token bucket to refill
wait_time = 60 if is_cloud else 10
logger.warning(
"⚠️ API Error/Empty Response. Sleeping 10s before retry..."
f"⚠️ API Error/Empty Response. Sleeping {wait_time}s to refill tokens..."
)
time.sleep(10) # MANDATORY SLEEP to prevent tight-looping
time.sleep(wait_time)
attempts += 1
continue

Expand Down