fix(pipeline): retry on all LLM errors (not just rate limits)
Free-tier APIs intermittently return invalid JSON or empty responses. Now any exception in _call_llm retries up to 3 times with a 5s back-off, rather than failing immediately on non-rate-limit errors. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
06e904ccf5
commit
1b9a31665c
1 changed files with 8 additions and 3 deletions
|
|
@ -584,9 +584,14 @@ class SourcePipeline:
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
msg = str(exc)
|
msg = str(exc)
|
||||||
print(f" LLM error: {msg}")
|
print(f" LLM error: {msg}")
|
||||||
meta["error"] = msg
|
if attempt < max_retries:
|
||||||
meta["duration_seconds"] = round(time.time() - t0, 1)
|
wait = 5 * (attempt + 1)
|
||||||
return None, meta
|
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:
|
if response is None:
|
||||||
meta["error"] = "no response"
|
meta["error"] = "no response"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue