1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//! # eligo — *I choose* (Latin)
//!
//! Best-of-N image generation that **selects** the best candidate by a
//! measurable reward, rather than returning a single one-shot result.
//!
//! *eligo* is Latin for "I pick out / I choose" — the root of *elect* and
//! *elite*. Choosing is the tool's one job. Where `revelo` *reveals* and
//! `viser` *sees*, eligo *chooses*: given a prompt, it generates `n` candidate
//! images through a [`Backend`], scores each against the prompt with a
//! [`Scorer`] (the reward), and returns the highest-scoring one. An optional
//! bounded re-roll replaces the single worst candidate once. That generate →
//! score → select loop is the smallest honest agentic pattern: a numeric reward
//! drives a decision.
//!
//! ## Scope (deliberately bounded)
//!
//! eligo is a *selection* library, not a model zoo or an editor. It owns the
//! loop and the contracts ([`Backend`], [`Scorer`]); concrete model inference
//! (a Stable Diffusion backend, and CLIP scoring via ONNX Runtime) are pluggable
//! implementations behind those traits. The default build ships a deterministic
//! mock backend/scorer so the loop is testable without model weights.
//!
//! ```
//! use eligo::{best_of_n, GenerateConfig};
//! use eligo::mock::{MockBackend, MockScorer};
//!
//! let backend = MockBackend::default();
//! let scorer = MockScorer;
//! let cfg = GenerateConfig::new("a red bicycle").with_candidates(4);
//! let selection = best_of_n(&backend, &scorer, &cfg).unwrap();
//! assert_eq!(selection.all.len(), 4);
//! // The chosen candidate is the highest-scoring one.
//! let top = selection.all.iter().map(|c| c.score).fold(f32::MIN, f32::max);
//! assert!((selection.best().score - top).abs() < f32::EPSILON);
//! ```
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use best_of_n;
pub use ;
pub use Scorer;
pub use ;
pub use SdBackend;