Skip to content

API Reference parrot.knowledge.common.provenance

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.knowledge.common.provenance

View source

Domain-neutral evidence and provenance primitives (FEAT-601 M1).

Moved verbatim from parrot.knowledge.contracts.models so that other knowledge planes can share them without importing contracts.

Attribute AnswerProvenance

Class Evidence

A verbatim excerpt anchoring one extracted fact to a tree node.

Fields:

Field Type Default Description
node_id str
quote str ''
page Optional[int] None

Attributes:

Attribute Type Description
substantiates bool True when this evidence carries a nonempty quote.

Class Extracted

One typed value produced by extraction, with its evidence.

Uses a typed generic rather than value: object so drafts keep their field types through structured-output round trips.

Fields:

Field Type Default Description
value Optional[T] None
evidence Optional[Evidence] None
confidence float 0.0

Attributes:

Attribute Type Description
substantiated bool True when a nonempty quote backs this value.

Class FieldProvenance

Where one card field came from and whether a human confirmed it.

origin and verification are independent axes so field-state transitions are unambiguous: correcting a value makes the origin manual; confirming an extracted value only moves verification.

Fields:

Field Type Default Description
origin ProvenanceOrigin 'llm'
verification VerificationState 'extracted'
node_id Optional[str] None
page Optional[int] None
quote Optional[str] None
confidence Optional[float] None
verified_by Optional[str] None
verified_at Optional[datetime] None
derived_from list[str]
candidate Optional[Any] None

Attributes:

Attribute Type Description
substantiates bool True when a nonempty quote backs this field.

Attribute MAX_QUOTE_CHARS

Attribute ProvenanceOrigin

Attribute UNSUBSTANTIATED_CONFIDENCE_CAP

Attribute VerificationState

Function trim_quote

Trim an over-long quote to :data:MAX_QUOTE_CHARS at a word boundary.

Models regularly return excerpts a little longer than the requested bound. Rejecting the whole structured draft for that discards every other clause in the section, so the excerpt is shortened instead: a verbatim prefix is still verbatim, and evidence validation checks it against the indexed text afterwards exactly as before.

trim_quote(value: Any) -> Any

Parameter Type Default Description
value Any

Returns: Any

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally