Skip to content

API Reference parrot.knowledge.graphindex.grounding

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

parrot.knowledge.graphindex.grounding

View source

Grounding evaluator — check claims against graph evidence.

Implements the paper's grounding layer: instead of a free-form critique, a claim is checked for supporting paths in the knowledge graph. When support exists, the result cites the exact edges (stable ids); when it does not, the result is a structured revise instruction listing the missing evidence — actionable feedback an agent can act on (add the missing relation, find a source, or weaken the claim).

Example revise contract::

{
  "decision": "revise",
  "claim": "Vendor X supplied the component in Incident Y",
  "reason": "No supported path between 'Vendor X' and 'Incident Y'",
  "required_evidence": [
    "A path connecting 'Vendor X' and 'Incident Y' (e.g. a"
    " supported_by/references relation)"
  ]
}

Alias GraphContextBuilder

Re-exported from parrot.knowledge.graphindex.context_builder.GraphContextBuilder.

Alias GraphExpandedRetriever

Re-exported from parrot.knowledge.graphindex.retriever.GraphExpandedRetriever.

Class GroundingEvaluator

Check claims for edge-level support in a knowledge graph.

Parameter Type Default Description
retriever GraphExpandedRetriever A :class:GraphExpandedRetriever over the graph (supplies the graph, node models, and entity surface forms).
client Optional[Any] None Optional AbstractClient; when present, a structured LLM judgement confirms that found paths semantically support the claim (path existence alone can be coincidental).
max_hops int 2 Maximum path length considered supporting evidence.

Method GroundingEvaluator.ground_claim

Ground a claim against the graph.

ground_claim(claim: str) -> GroundingResult

Parameter Type Default Description
claim str Natural-language claim to check.

Returns: GroundingResult — class:GroundingResult — grounded with cited edge paths, or a structured revise instruction.

Class GroundingJudgement

Structured output of the optional LLM semantic check.

Fields:

Field Type Default Description
supported bool
reason str ''
confidence float 0.7

Class GroundingResult

Outcome of grounding one claim against the graph.

Fields:

Field Type Default Description
decision Literal['grounded', 'revise']
claim str
reason str
entities list[str]
unresolved_entities list[str]
supported_paths list[list[str]]
contradictions list[str]
required_evidence list[str]
confidence float 0.0

Attribute logger

Alias stable_edge_id

Re-exported from parrot.knowledge.graphindex.schema.stable_edge_id.

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