pub struct Teacher { /* private fields */ }Expand description
A source of proposals.
Constructing one is where credentials are checked, so a missing configuration fails before any work is queued rather than part-way through a corpus.
Implementations§
Source§impl Teacher
impl Teacher
Sourcepub fn fixed(proposal: Proposal) -> Teacher
pub fn fixed(proposal: Proposal) -> Teacher
A teacher that returns a fixed proposal. Useful for tests, for replaying a recorded proposal, and for feeding in candidates from a source of your own.
Sourcepub fn local(
base_url: impl Into<String>,
model: impl Into<String>,
) -> Result<Teacher, LearnError>
pub fn local( base_url: impl Into<String>, model: impl Into<String>, ) -> Result<Teacher, LearnError>
A teacher backed by a local model behind an OpenAI-compatible endpoint.
This is the preferred route. It needs no credentials, sends nothing off the machine, and costs nothing,
which removes every objection to learn except quality. Works with llama.cpp, vLLM, LM Studio, Ollama —
anything speaking /v1/chat/completions.
The model must support tool calling. learn asks for a structured ontology, and a model without
tool calling replies in prose or with nothing — measured on a local ollama, qwen2.5:0.5b returns
tool_calls: null for every request, while qwen3.5:0.8b, granite3-moe:3b and functiongemma work.
Beyond that, a small model is a reasonable choice because of the gate. Proposals are judged by the same
deterministic MECE test as local discovery, so a weak model produces rejected candidates rather than a
polluted vocabulary. The failure mode of choosing badly is wasted effort, not a wrong answer: on an
eight-document corpus qwen3.5:0.8b proposed a category that appears nowhere in the text and one that
restated an existing category, and the gate refused both.
use steeldb::learn::Teacher;
// a function-calling model small enough to run on a laptop
let teacher = Teacher::local("http://localhost:11434/v1", "qwen3.5:0.8b")?;Sourcepub fn ollama(model: impl Into<String>) -> Result<Teacher, LearnError>
pub fn ollama(model: impl Into<String>) -> Result<Teacher, LearnError>
A teacher backed by a model served by Ollama on the default port.
Shorthand for Teacher::local against http://localhost:11434/v1.
Sourcepub fn bedrock(model_id: impl Into<String>) -> Result<Teacher, LearnError>
pub fn bedrock(model_id: impl Into<String>) -> Result<Teacher, LearnError>
A teacher backed by Amazon Bedrock.
Requires AWS credentials resolvable by the standard chain (environment, profile, or instance role) and
AWS_REGION. Checked here so the failure is immediate and names what is missing.
This costs money per call. The amount is small for vocabulary proposal — one request over a sample of documents — but it is a real charge and worth saying out loud.
Sourcepub async fn propose_categories(
&self,
db: &SteelDb,
) -> Result<Proposal, LearnError>
pub async fn propose_categories( &self, db: &SteelDb, ) -> Result<Proposal, LearnError>
Ask for categories the local discovery may have missed.
Returns a Proposal; nothing changes until you SteelDb::adopt it.
Sourcepub async fn curate(&self, raw: &RawSpec) -> Result<Proposal, LearnError>
pub async fn curate(&self, raw: &RawSpec) -> Result<Proposal, LearnError>
Curate a raw spec into canonical facet types. The judgment half of neural discovery.
The tagger and the transport solver do the mechanical work: they find typed spans and group them. What
comes out is a list of raw entity-value clusters, and a cluster label is a VALUE. The reference’s own
committed spec has raw clusters named missile, bo, guidance control, ph, ge; its finished
ontology reads weapon-platform, control-system, with those terms demoted to examples. The step
between the two is this one, and skipping it puts ph in the index as a retrieval dimension.
Three things are asked of the model, following the reference’s curator exactly:
- merge synonymous or overlapping clusters into one facet TYPE — a short lowercase slug naming a kind of thing, not one of its values;
- drop clusters that are boilerplate, noise, or too generic to be a facet;
- name each surviving facet, listing the raw cluster terms it absorbs as its examples.
This is judgment, not arithmetic, which is why it is a model call and not a formula — and why what comes
back is a Proposal that still faces the MECE gate in SteelDb::adopt before anything is indexed.
Auto Trait Implementations§
impl Freeze for Teacher
impl RefUnwindSafe for Teacher
impl Send for Teacher
impl Sync for Teacher
impl Unpin for Teacher
impl UnsafeUnpin for Teacher
impl UnwindSafe for Teacher
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more