Skip to main content

Module learn

Module learn 

Source
Expand description

Learn — the third verb, and the one that works differently on purpose.

ingest and query are offline, deterministic and free. learn is none of those: it calls a language model, which means credentials, network, latency and a bill. Hiding that behind a method that looks like the other two would be a trap, so this module makes all four facts visible in the shape of the API.

use steeldb::{SteelDb, learn::Teacher};

let mut db = SteelDb::ingest(["…documents…"])?;

// credentials are checked when the teacher is built, not when it is used
let teacher = Teacher::bedrock("us.anthropic.claude-sonnet-4-5-20250929-v1:0")?;

// a proposal is returned, NOT applied
let proposal = teacher.propose_categories(&db).await?;
println!("{proposal}");

// you decide, and the same MECE test that gates local discovery gates this too
let adopted = db.adopt(&proposal);
println!("kept {} of {}", adopted.len(), proposal.candidates.len());

§Why a proposal instead of a mutation

A model suggesting categories is a suggestion, not an authority. Returning a Proposal means you can print it, diff it, log it, or reject it before your vocabulary changes — and it keeps the model advisory, which is the same separation the query planner has. adopt then applies the same gate that local discovery uses, so a model cannot sneak in a category that a deterministic test would have rejected.

Without a network-capable feature enabled, this module still compiles: Proposal and SteelDb::adopt work with candidates from any source, so the offline path is testable.

Structs§

Candidate
A candidate category, from wherever.
Proposal
What a teacher suggests. Inert until adopted.
Teacher
A source of proposals.
Verdict
The outcome of adopting one candidate. Reported per candidate so a rejection is explicable.

Enums§

LearnError
Why learning could not proceed.