mixle.task.compose module¶
Compose two models or teachers while carrying a typed per-stage evidence ledger.
compose chains two models/teachers a: x -> y and b: y -> z into one
callable x -> z while preserving a per-stage evidence ledger that can be
reused by composition and belief-walk workflows.
a and b are any callables – a TaskModel, a
CalibratedTaskModel, a teacher LLM, or a plain function. A stage that
additionally exposes .score(input) -> float (a log-confidence or log-density) contributes that
number only when the caller declares its statistical type. Unrelated units are never added: a
combination rule is explicit and rejects incompatible evidence kinds.
- class ComposedAnswer(answer, intermediate, stages, combination_rule, combined_evidence, receipt_sha256)[source]
Bases:
objectA composed
x -> zanswer plus the per-stage receipt that attributes it to both stages.- Parameters:
- class ComposedModel(a, b, *, name_a='stage_a', name_b='stage_b', evidence_a=None, evidence_b=None, combination_rule='none')[source]
Bases:
objectChain
a: x -> ythenb: y -> zas one callablex -> z.composed(x)returns the bare answerz(so aComposedModelcan stand in anywhere a plain teacher callable is expected – including as theaorbof anothercompose(), chaining further).composed.answer(x)returns the ledger-carryingComposedAnswerinstead.- Parameters:
- class EvidenceValue(kind, value)[source]
Bases:
objectOne typed scalar. Its kind determines which composition rules may consume it.
- compose(a, b, *, name_a='stage_a', name_b='stage_b', evidence_a=None, evidence_b=None, combination_rule='none')[source]
Chain
a: x -> yandb: y -> zinto one ledger-carryingx -> zcallable.