Expand description
The model catalogue: which AI models exist for this tool’s world, what each can do,
and which one a stated need selects — as declared data, never as a live client. ADR
0044 is the decision; ADR 0032’s boundary stands untouched: this crate calls no
model, holds no SDK, and reads no credential’s value. The catalogue is
share/models.yaml — one declaration, exactly like share/providers.yaml — and
models.list / models.route project it to the CLI, HTTP, OpenAPI, MCP and the
Cockpit, so no consumer keeps a model name of its own.
Two words are deliberately absent. “Provider” is spent (ADR 0024, 0032): here the
party that serves a model is a vendor. And “routing” here is a pure, explainable
function over the declared data — a decision with the reasons attached, never an
opaque dispatcher: ask models.route why, and every excluded model answers.
use majordomus_cli::models::{route, ModelCatalogue, Requirements};
let catalogue: ModelCatalogue = majordomus_cli::metadata::yaml::parse_into(
"version: 1\nvendors:\n - id: acme\n title: Acme\nmodels:\n - id: acme-large\n vendor: acme\n native_id: acme-large-1\n context_window: 200000\n capabilities: [text, tools, vision]\n - id: acme-mini\n vendor: acme\n native_id: acme-mini-1\n context_window: 32000\n capabilities: [text]\n",
).unwrap();
let decision = route(&catalogue, &Requirements { require: vec!["vision".into()], ..Default::default() });
assert_eq!(decision.selected.as_deref(), Some("acme-large"));
assert_eq!(decision.excluded[0].reason, "missing capability: vision");Structs§
- Excluded
Model - One model that did not qualify, and exactly why.
- Model
Catalogue - The whole catalogue, as
share/models.yamldeclares it. - Model
Entry - One model: the canonical reference this repository uses, the vendor’s own name for it, and its typed capabilities. Capability words are data the catalogue declares — consumers compare against a requirement list, never against a hardcoded name.
- Requirements
- What a task needs from a model. Every field empty means “the first available model”.
- Routing
Decision - The routing answer: what was selected, what stands behind it, who fell out and why. The whole decision is derived from the catalogue and the requirements — run it twice, get it twice; there is no state to consult and no health to guess.
- Vendor
- A party that serves models: a remote API vendor or a local runtime. Not a “provider” — that word names the AI client tools this repository already adapts to (ADR 0024), and one word for two registries is how truths fork.
Enums§
- Inference
- Where a vendor’s inference runs.
- Model
Status - A model’s lifecycle standing, as the catalogue declares it. There is no default: a catalogue entry that declares none has an undeclared standing, which is not the same fact as “available”, and no reader may render it as one.
Constants§
- MODELS_
FILE - The file name under the share directory.
Functions§
- route
- Decide. Pure over the catalogue and the requirements; the preference order is the catalogue’s declaration order, and every exclusion names its first failing check.