mixle.inference.skill module¶
Package a fitted model or callable as a reusable skill.
skill wraps a model, subgraph, or plain callable as a named
Skill and stores it in a SkillRegistry. Skills carry
description, tags, provenance, and any estimation certificate inherited from
the wrapped object, so reuse remains auditable.
find(query) ranks skills by lexical overlap against the skill name,
description, and tags. SkillRegistry.index() can also mirror skills into a
Substrate when a workflow wants retrieval over the
same capability catalog.
The wrapped callable is resolved from the object: explicit call= wins, then
predict or __call__, then sampler for generative models.
- class Skill(name, call, description='', tags=(), certificate=None, provenance=<factory>)[source]
Bases:
objectA named, described, provenanced callable derived from a fitted artifact (or a plain function).
- Parameters:
- name: str
- description: str = ''
- class SkillRegistry[source]
Bases:
objectA findable collection of skills – register once, retrieve by name or by query.
- add(sk)[source]
- Parameters:
sk (Skill)
- Return type:
Skill
- find(query, k=5)[source]
The best
kskills forqueryby lexical overlap (highest score first, ties by name).
- best(query)[source]
The single best-matching skill for
query(or None if nothing overlaps).- Parameters:
query (str)
- Return type:
Skill | None
- index(substrate)[source]
Mirror every skill into a
Substratefor embedding-grade recall.The registry’s own
findis a lexical matcher; when a corpus grows past that, index the skills asartifactitems and retrieve through the substrate instead. Returns the item ids.
- default_registry()[source]
The process-wide default registry
skill()writes to when noregistryis given.- Return type:
SkillRegistry
- skill(name, obj, *, description='', tags=(), call=None, provenance=None, registry=None)[source]
Package
obj(a fitted model, aCreatedModel, or a function) as a reusableSkilland register it (see module docstring).The estimation certificate is inherited from
obj.certificatewhen present (so a certified model yields a certified skill).calloverrides how the skill is invoked; otherwise a model verb (predict/__call__/sampler) is used. The skill is added toregistry(or the process default) and returned.