Provenance API¶
The client.provenance namespace exposes the Decision Provenance Engine (DPE): claim detection, fabrication scoring, grounding verification, and contradiction analysis.
SDK proxy¶
crp.sdk.proxies._ProvenanceProxy ¶
Decision Provenance Engine proxy (SPEC-005, SPEC-011).
Exposes provenance chains, DPE scoring, and combined provenance reports.
chains(output_text, **kwargs) ¶
Build provenance chains for output_text.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_text | str | LLM output to trace back to source facts. | required |
**kwargs | Any | Additional options forwarded to the DPE/chain builder. | {} |
Returns:
| Type | Description |
|---|---|
list[Any] | List of ProvenanceChain objects. |
score(output_text) ¶
Run DPE scorers against output_text.
Returns:
| Type | Description |
|---|---|
dict[str, Any] | Dict with |
dict[str, Any] |
|
report(output_text) ¶
Return a combined provenance report for output_text.
Returns:
| Type | Description |
|---|---|
dict[str, Any] | Dict with chain count, scores, grounding ratio, and quality tier. |
Decision Provenance Engine¶
crp.provenance.DecisionProvenanceEngine ¶
Main entry point for the Decision Provenance Engine.
Ties together claim detection → attribution scoring → provenance chain construction → report generation into a single analyse() call.
config property ¶
Current provenance configuration.
enabled property ¶
Whether the DPE pipeline is enabled.
analyse(output_text, packed_facts, *, session_id='', window_id='', envelope_saturation=0.0, task_input_preview='', fact_metadata=None, query='', window_number=1, prior_window_texts=None, envelope_tier='', amplifier_context=None, upgrade_on_risk=False, revision_round=0, embedder=None, nli=None) ¶
Run the full DPE pipeline and return a provenance report.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
output_text | str | Raw LLM output text for this window. | required |
packed_facts | Sequence[PackedFact] | Facts that were packed into the envelope. | required |
session_id | str | Current CRP session ID. | '' |
window_id | str | Current dispatch window ID. | '' |
envelope_saturation | float | Envelope token saturation ratio (0.0-1.0). | 0.0 |
task_input_preview | str | First 120 chars of the task input. | '' |
fact_metadata | dict[str, dict[str, object]] | None | Optional mapping of fact_id → metadata dict containing | None |
query | str | Original task query (used for RQA completeness analysis). | '' |
window_number | int | Current window number in the session. | 1 |
prior_window_texts | Sequence[str] | None | Previous window outputs for cross-window analysis. | None |
envelope_tier | str | Envelope quality tier assigned by the packer. | '' |
amplifier_context | AmplifierContext | None | Regulatory amplifier context for risk scoring. | None |
upgrade_on_risk | bool | Whether to trigger re-dispatch on elevated risk. | False |
revision_round | int | Current revision iteration count. | 0 |
embedder | Callable[[str], Sequence[float]] | None | Optional embedding callable for semantic RQA stages. | None |
nli | Callable[[str, str], float] | None | Optional NLI callable for contradiction detection. | None |
Returns:
| Type | Description |
|---|---|
ProvenanceReport |
|
ProvenanceReport | and RQA results. |
generate_markdown(report) ¶
Generate a human-readable markdown provenance report.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
report | ProvenanceReport | Provenance report to render. | required |
Returns:
| Type | Description |
|---|---|
str | Markdown-formatted provenance report string. |
generate_json(report) ¶
Generate a machine-readable JSON provenance report.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
report | ProvenanceReport | Provenance report to serialise. | required |
Returns:
| Type | Description |
|---|---|
dict | Dict representation of the provenance report. |