diff --git a/src/pyob/core_utils.py b/src/pyob/core_utils.py index b2581b0..9ee013d 100644 --- a/src/pyob/core_utils.py +++ b/src/pyob/core_utils.py @@ -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