Mimir.Oracle (Mimir v0.1.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.

A model absent from snapshot.pricing defaults to zero input/output rates — it always passes the cost filter and ranks as the cheapest candidate, so keep the pricing map 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 placement 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()
) ::
  {:placement, Mimir.Oracle.Placement.t()} | {:no_candidate, [term()], [map()]}

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