mixle.substrate.answer module¶
Answer a question from substrate evidence with citations.
Given a question and a pluggable answerer callable, this module retrieves
evidence, assembles a budgeted context packet, and either returns an answer from
that evidence or abstains when the evidence is too thin. The result carries the
evidence chain and citations back to substrate items.
- class Answer(question, answer, abstained, confidence, context, note='', evidence=<factory>)[source]
Bases:
objectA cited answer or abstention with the evidence it rests on and a confidence.
- Parameters:
- citations()[source]
Where the answer’s evidence came from – the provenance the answer must be checkable against.
- answer_from_substrate(substrate, question, answerer, *, budget=None, hops=1, min_evidence=1, min_confidence=0.1, compress=True, scope=None, telemetry=None)[source]
Answer
questionfromsubstrateviaanswerer, or abstain when evidence is too thin.- Parameters:
answerer (Callable[[str, str], str]) –
(question, context_text) -> answer_str– any model/rule; called only when there is enough evidence above the confidence floor (so a weak retrieval never fabricates).budget (ContextBudget | None) – the context budget handed to the answerer (default 2000 chars).
hops (int) – 1 = single-shot
retrieve(); >1 =multihop()chaining that many hops.min_evidence (int) – minimum evidence items the answerer must actually receive to attempt an answer – checked against
packet.items(what survives context budgeting), never the pre-budget retrieved/hop-chain count. A small budget can drop most retrieved items before the answerer ever sees them; gating on the pre-budget count would let a caller believe far more evidence was used than the answerer actually got (MXR-080-0257).min_confidence (float) – retrieval-strength floor below which it abstains rather than guess.
compress (bool) – compress the context to fit more sources under budget.
scope (str | None) – restrict to a team/access scope.
substrate (Substrate)
question (str)
telemetry (Any)
- Return type:
Answer