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. Each skill is bound to stable implementation, artifact-state, and descriptor
digests; registries reject a skill whose executable or bound state has drifted.
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>, implementation_digest='', artifact_digest='', descriptor_digest='', _artifact=None)[source]
Bases:
objectA named, described, provenanced callable derived from a fitted artifact (or a plain function).
- Parameters:
- property guarantee: Any | None
The inherited estimation guarantee, if this skill wraps a certified model.
- score(query)[source]
Lexical overlap of
querywith this skill’s name/description/tags, in[0, 1].
- class SkillRegistry[source]
Bases:
objectA findable collection of skills – register once, retrieve by name or by query.
- add(sk)[source]
Register a skill and return it for chaining.
- Parameters:
sk (Skill)
- Return type:
Skill
- get(name)[source]
Return a registered skill by exact name.
- Parameters:
name (str)
- 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.