Supported
Knowledge parsers¶
Behavior¶
Mari provides |
Caller provides |
|---|---|
Typed schemas, evidence resolution, ordering recovery, and safe fallbacks |
Model prompt, inference, and task-specific quality |
An uncertain result when a required row or citation is invalid |
The threshold for retry, review, or rejection |
The parsers validate injected extraction results. Corpus evidence helps select the model. Parser guarantees cover structure, attribution, and failure behavior.
Example malformed-batch recovery
Requested claim |
Model row |
Parsed result |
|---|---|---|
Claim A |
Valid supported row with evidence |
Supported assessment |
Claim B |
Missing row |
Uncertain assessment |
Claim C |
Malformed evidence |
Uncertain assessment with parse issue |
Claim D |
Valid row returned out of order |
Restored to Claim D position |
Models return JSON-like values. Parsers resolve evidence against supplied document and section revisions and return immutable typed values. Research establishes each task formulation. Mari implements the deterministic validation boundary around the cited model.
How it works¶
Each parser requires the recipe’s top-level collection, validates every required
field and enum, resolves evidence through the contract below, derives audit
signals, and constructs frozen result types. Claim meaning stays with the
caller. Batch claim assessment keys rows to caller order. Absent rows become
uncertain, and malformed rows leave valid siblings available.
model proposal schema exact evidence revision binding typed candidate
Parser |
Produces |
Research-backed task |
Academic sources |
|---|---|---|---|
|
|
Atomic claims and optional document-level relations with evidence |
|
|
|
Supported, contradicted, or uncertain verdicts. Decisive rows require evidence |
|
|
|
Decision-related utterance extraction with evidence-based interpretation |
|
|
|
Evidence-selected document QA, citations, or explicit insufficient evidence |
|
|
|
Reusable question-answer pairs bound to supporting passages |
|
|
|
Term-definition relations, aliases, and source spans |
|
|
|
Document-wide and topic summaries with separately inspectable evidence |
|
|
|
In-scope affected-document proposals followed by deterministic dependency checks |
Mari contract. No claimed benchmark reproduction |
|
|
Bounded, attribution-aware, fact-preserving edit proposals |
from mari_kit.knowledge import parse_answer
raw = model(question, documents)
answer = parse_answer(question, documents, raw)
print(answer.disposition) # grounded | insufficient_evidence
print(answer.grounding_coverage) # deterministic text coverage
for evidence in answer.evidence:
print(evidence.quote) # insufficient-evidence answers can have no citations
Additional deterministic helpers include normalize_claim, deduplicate_fact_candidates, grounding_coverage, and excerpt. Recoverable batch drift is handled conservatively: assessment rows are restored to caller order, missing rows become uncertain, and good rows survive alongside invalid ones. Structured fact qualifiers preserve subject, relation, object, scope, validity, and conditions.
grounding_coverage measures lexical coverage. It is a Mari-specific audit
signal motivated by citation completeness. Exact quote validation catches
fabricated citations. Logical entailment remains a separate evaluation.
Source parser functions and options¶
Function |
Main options |
Failure behavior |
|---|---|---|
|
|
Returns an unclosed-fence warning or error and retains the recovered block |
|
|
Reports unmatched and implicitly closed tags. |
|
|
Rejects a malformed-width row in strict mode. Valid siblings survive |
|
|
Each malformed or non-object line is positioned independently |
|
|
Retains parsed object siblings and positions non-object or malformed members |
|
Repository, revision, path and parser ID |
Syntax errors produce an empty, positioned result. Symbol extraction requires valid syntax |
ParseIssue contains code and message. Severity and an optional subject
add context. The record also carries an exact character span.
ParseResult.succeeded becomes true when every issue stays below error
severity. Warnings and accepted values remain available in the result.
from mari_kit.documents import parse_json_lines
result = parse_json_lines(
payload,
source_id="warehouse:policies",
revision=object_etag,
identity_fields=("policy_id", "jurisdiction"),
)
store(result.values)
observe(result.issues)
Structured-ingest fixture |
Before |
Current |
|---|---|---|
Fields with exact raw spans |
|
|
Syntactically accepted records with record spans |
|
|
Schema-drift violations |
|
|
Invalid integer/date values rejected |
|
|
Format and parser references
CommonMark block syntaxWHATWG HTML parsingRFC 4180 CSVJSON LinesPython ASTTree-sitter
Markdown-It-Py and html5lib are MIT-licensed differential references. Tree-sitter and its Python grammar are MIT licensed.