Mimir.Oracle (Mimir v0.7.0)

Copy Markdown View Source

The pure routing decision: filter-then-rank over catalog entries. Every input entry receives a verdict (:chosen | :ranked | {:excluded, reason}) — the verdict table IS the decision record's body. No Repo, no process state, no side effects; the operational world arrives as a Snapshot argument.

Rank (v1, deliberately weightless): cheapest projected step cost, tie-break ascending p50 latency, then ascending priority. When eval scorecards exist, quality_bar becomes a fourth FILTER (below-bar excluded), not a weight.

Rates resolve field by field, the same way Mimir.Pricing resolves its own config table: a snapshot.pricing entry may be partial, with any rate it doesn't set — or a whole missing entry — falling back to the vendored LiteLLM DB, then to zero for input/output. Only a model absent from both the pricing map and the DB ranks free, always passing the cost filter and ranking as the cheapest candidate; keep the pricing map (or the DB) complete for every entry you want cost-ranked honestly.

Summary

Functions

Filter entries against descriptor, policy, and snapshot, then rank the viable candidates. Returns the chosen decision plus every candidate's verdict, or :no_candidate with the distinct exclusion reasons.

Functions

decide(d, entries, policy, snap)

@spec decide(
  Mimir.Descriptor.t(),
  [Mimir.Catalog.Entry.t()],
  Mimir.Oracle.Policy.t(),
  Mimir.Snapshot.t()
) ::
  {:decision, Mimir.Oracle.Decision.t()}
  | {:no_candidate, [term()], [Mimir.Candidate.t()]}

Filter entries against descriptor, policy, and snapshot, then rank the viable candidates. Returns the chosen decision plus every candidate's verdict, or :no_candidate with the distinct exclusion reasons.