Skip to content

Add a two-stage curation fallback: alternate Gemini model, then manual - #9

Merged
AlexWindels merged 1 commit into
mainfrom
fix/gemini-curation-fallback
Aug 7, 2026
Merged

Add a two-stage curation fallback: alternate Gemini model, then manual#9
AlexWindels merged 1 commit into
mainfrom
fix/gemini-curation-fallback

Conversation

@AlexWindels

Copy link
Copy Markdown
Collaborator

Fixes #8.

Summary

  • A 503 UNAVAILABLE ("high demand") from Gemini's primary model used to crash the whole run, discarding the fetching/clustering/domain-detection work already done in that run -- often several minutes for a real CAZy family.
  • GeminiCurationBackend.curate() now tries one alternate model (gemini-2.5-flash-lite by default, via a new fallback_model constructor param -- pass None to disable) before giving up on Gemini, since a different model is frequently not overloaded/rate-limited/deprecated at the same time as the primary one.
  • run_pipeline now catches any exception from a non-manual curation backend and falls back to the existing interactive manual-curation prompt, so the run still completes instead of crashing. A failure in the manual backend itself (already the last resort) still propagates -- there's nowhere further to fall back to.
  • README documents both fallback layers in the Domain-name curation section.

Test plan

  • pytest -- 119 passed. New tests cover: Gemini falls back to the secondary model and succeeds; raises the last error when both models fail; fallback disabled via fallback_model=None; run_pipeline falls back to manual curation when the configured backend fails (asserting the run still completes and the fallback is logged); a manual-backend failure is not caught (propagates, since it's the last resort)
  • Reviewer: confirm CI passes on this PR

Fixes #8.

A Gemini 503 ("high demand") or similar transient failure used to
crash the whole run, discarding the fetching/clustering/domain-
detection work already done -- often several minutes for a real
family. Add two fallback layers:

- GeminiCurationBackend now tries one alternate model
  (gemini-2.5-flash-lite by default, configurable/disableable via a
  new fallback_model param) before giving up on Gemini, since a
  different model is often not overloaded at the same time.
- run_pipeline now catches any exception from a non-manual curation
  backend and falls back to the interactive manual-curation prompt,
  so a Gemini outage no longer loses the run -- only a genuine manual
  backend failure (e.g. non-interactive stdin) still propagates.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@AlexWindels
AlexWindels merged commit 6fa534f into main Aug 7, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant