Skip to main content

Crate klieo_memory_graph_rag

Crate klieo_memory_graph_rag 

Source
Expand description

klieo-memory-graph-rag — graph-first RAG composer.

Stable at 1.x. Trait freeze contract recorded in ADR-039 (docs/adr/adr-039-graphrag-1-0-promotion.md).

Public surface:

  • BuiltinExtractor, FallbackExtractor, LlmEntityExtractor
  • ProvenanceKnowledgeGraph — wraps any KnowledgeGraph with a ProvenanceRepository so every index() mints a v2 chain entry and every recall_paths() attaches the entry per hop (ADR-038).
  • VerbalizationPipeline — LLM-driven prose summary of a RetrievalPath under a klieo-spec QualityLoop.
  • RegulationIngestToolImportSource for structured regulatory texts (DORA, AI-Act) — pre-seeds typed Article / Obligation / Deadline entity hints.
  • GraphAwareLongTerm — drop-in LongTermMemory that issues graph-first recall with vector fallback; recall_traced exposes the same authoritative facts plus a RecallTrace of extracted entities and graph paths for “why did retrieval return this?”
  • KnowledgeIngestionPipeline + ImportSource extension point
  • InMemoryFilterableLongTerm — zero-infra FilterableLongTermMemory with real cosine similarity over an injected Embedder

§Quickstart

let long_term = GraphAwareLongTerm::builder().build(vector, graph);

GraphAwareLongTerm::builder defaults the extractor (BuiltinExtractor) and the klieo_memory_graph::RecallMetrics counter so callers only supply the two mandatory backends. Override either via GraphAwareLongTermBuilder::extractor / GraphAwareLongTermBuilder::metrics / GraphAwareLongTermBuilder::min_graph_hits.

Re-exports§

pub use extractor::BuiltinExtractor;
pub use fallback_extractor::FallbackExtractor;
pub use graph_aware::GraphAwareLongTerm;
pub use graph_aware::GraphAwareLongTermBuilder;
pub use graph_aware::RecallTrace;
pub use import::ImportDocument;
pub use import::ImportError;
pub use import::ImportSource;
pub use import::KnowledgeIngestionPipeline;
pub use in_memory_vector::InMemoryFilterableLongTerm;
pub use llm_extractor::LlmEntityExtractor;
pub use metadata::KEY_ENTITIES;
pub use metadata::KEY_IMPORT_SOURCE_ID;
pub use metadata::KEY_TITLE;
pub use metadata::KEY_VALID_FROM;
pub use metadata::RESERVED_METADATA_KEYS;
pub use path_rag::LlmRefiner;
pub use path_rag::VerbalizationCritic;
pub use path_rag::VerbalizationPipeline;
pub use path_rag::DEFAULT_MAX_ITERATIONS;
pub use provenance::ProvenanceKnowledgeGraph;
pub use provenance::DEFAULT_FACT_INDEX_CAPACITY;
pub use provenance::FORGET_EVENT_LABEL;
pub use regulation::RegulationDocument;
pub use regulation::RegulationIngestTool;

Modules§

extractor
Regex-driven entity recogniser and (future) extractor combinators. BuiltinExtractor — regex-driven entity recogniser for known typed formats, merged with caller-supplied hints.
fallback_extractor
Two-stage extractor combinator: secondary runs only when primary is empty. FallbackExtractor — chains primary → secondary EntityExtractors. Secondary runs only when primary returns an empty Vec (not on error).
graph_aware
GraphAwareLongTerm — graph-first RAG composer over vector + graph. GraphAwareLongTerm — drop-in LongTermMemory that issues graph-first recall with vector fallback.
import
KnowledgeIngestionPipeline + ImportSource — bulk-ingest extension point. KnowledgeIngestionPipeline + ImportSource — bulk-import external documents into a LongTermMemory.
in_memory_vector
In-memory [FilterableLongTermMemory] with real cosine similarity. In-memory [FilterableLongTermMemory] with real cosine similarity.
llm_extractor
LLM-backed entity extractor — JSON-array prompt with hint-fallback. LlmEntityExtractor — recall-extension EntityExtractor that uses an LLM to recognise entities in free-form text.
metadata
Shared reserved metadata-key constants for the ingest/recall contract. Shared reserved metadata-key constants — KnowledgeIngestionPipeline WRITES these; GraphAwareLongTerm READS them. Centralised so the writer-vs-reader contract is a single dedupe key.
path_rag
VerbalizationPipeline — LLM-driven verbalisation of a RetrievalPath under a klieo-spec QualityLoop. VerbalizationPipeline — LLM-driven prose summary of a klieo_memory_graph::RetrievalPath under a klieo_spec::QualityLoop refinement budget.
provenance
ProvenanceKnowledgeGraph — wraps a KnowledgeGraph with a klieo-provenance chain bridge (see ADR-038). ProvenanceKnowledgeGraph — wraps any klieo_memory_graph::KnowledgeGraph with a klieo_provenance::ProvenanceRepository so every successful index() mints a signed klieo_provenance::ChainEntry and every recall_paths() attaches the matching entry per klieo_memory_graph::PathHop.
regulation
Regulatory-text ingest source — DORA / AI-Act and friends. RegulationIngestToolImportSource for structured regulatory texts (DORA, AI-Act, …).