diff --git a/markitect/infospace/pipeline.py b/markitect/infospace/pipeline.py index 5779e032..030ce264 100644 --- a/markitect/infospace/pipeline.py +++ b/markitect/infospace/pipeline.py @@ -584,9 +584,14 @@ class SourcePipeline: except Exception as exc: msg = str(exc) print(f" LLM error: {msg}") - meta["error"] = msg - meta["duration_seconds"] = round(time.time() - t0, 1) - return None, meta + if attempt < max_retries: + wait = 5 * (attempt + 1) + print(f" Retrying in {wait}s (attempt {attempt + 1}/{max_retries})...") + time.sleep(wait) + else: + meta["error"] = msg + meta["duration_seconds"] = round(time.time() - t0, 1) + return None, meta if response is None: meta["error"] = "no response"