Open Source

A temporal knowledge graph you can run anywhere

Predicato is an open-source framework for building knowledge graphs that evolve over time. Extract entities and relationships from documents using local ML models, store them with full temporal context, and query across your entire knowledge base — all without sending a single byte to an external API.

Go library with a Python client. Embedded databases. Local ML via Rust FFI. No API keys, no vendor lock-in, no recurring costs.

View on GitHub Learn More
predicato
// Extract knowledge from a document
episode, _ := client.AddEpisode(ctx, "contract.pdf",
  predicato.WithExtraction(true),
  predicato.WithExtendedTriples(true))
// → 47 entities, 83 relationships, 12 rules
// Query with hybrid search
results, _ := client.Search(ctx, "prior auth MRI",
  predicato.WithReranking("rrf"),
  predicato.WithGraphTraversal(2))
// → Aetna requires prior auth for MRI
//   when CPT 70553, outpatient setting
//   Source: contract.pdf, page 14

Why Predicato

Most knowledge systems require cloud APIs for every extraction and query. Predicato runs entirely on your hardware — no API keys, no per-call costs, no data leaving your network.

Fully local ML stack

Embeddings (Qwen3-0.6B), text generation (SmolLM2), NER (GLiNER), and reranking all run locally via Rust FFI. Models auto-download from HuggingFace and cache locally. Zero external API calls required.

Bi-temporal knowledge

Every fact tracks two time dimensions: when it was recorded and when it was actually true. Query "what did we know as of last Tuesday" or "show me facts that were later corrected." Essential for compliance and audit trails.

No recurring costs

No per-query fees. No per-extraction charges. No monthly API bills that scale with usage. Extract once, query forever. Your knowledge, your infrastructure, your budget.

Two-layer architecture

Predicato separates expensive extraction from flexible modeling — extract facts once, build multiple graph views without re-processing.

Layer 1: Fact Store

Documents, conversations, and events are processed through entity extraction (GLiNER + NLP) to produce entities, relationships, embeddings, contextual triples, and conditional rules. These persist durably in PostgreSQL with vector embeddings — extraction is expensive, so you only do it once.

Backends: PostgreSQL + VectorChord (production), DuckDB (embedded)

Layer 2: Knowledge Graph

Facts from the store are resolved (entity deduplication, relationship merging), enriched with community detection, and assembled into a queryable graph. Regenerate the graph with different parameters without re-extracting — experiment freely.

Backends: CozoDB, DuckDB+DuckPGQ, Ladybug (embedded); Neo4j, Memgraph (external)

Example: Payer contract knowledge graph

Aetna PPO Contract
CPT 70553
Brain MRI w/wo contrast
Prior Auth
Required
Outpatient Setting
Emergency
Exempt
Reimbursement: $1,247
Valid: 2026-01-01 → 2026-12-31
covers requires IF setting = UNLESS pays
Entities (colored nodes) connected by typed relationships (edges). Dashed lines indicate conditional rules (IF/UNLESS). Temporal validity shown on the reimbursement node.

Extracted rules

IF CPT 70553 AND outpatient setting
THEN prior authorization required
UNLESS emergency admission
Source: contract.pdf, page 14 · Valid: 2026-01-01 → 2026-12-31
IF diagnosis E11.* (Type 2 Diabetes)
THEN HbA1c testing covered quarterly
Source: contract.pdf, page 22 · Valid: 2026-01-01 → 2026-12-31
IF CPT 99214 AND modifier 25
THEN reimbursement = $130.08
UNLESS bundled with same-day procedure
Source: fee_schedule_2026.pdf, page 3

Temporal facts

Aetna PPO — MRI reimbursement $1,247
Recorded: 2026-01-15 · Valid: 2026-01-01 → 2026-12-31
Aetna PPO — MRI reimbursement $1,189 (-4.6%)
Recorded: 2025-12-01 · Valid: 2025-01-01 → 2025-12-31 (superseded)
Aetna PPO — MRI reimbursement $1,320 (corrected)
Recorded: 2025-03-01 · Valid: 2025-01-01 → 2025-06-30 (retracted — was entered in error)
Bi-temporal: track both when facts were recorded and when they were true. See corrections and superseded values.

What it does

Extract structured knowledge from unstructured sources. Search across it intelligently. Keep it current as the world changes.

Document extraction

Feed in PDFs, text, HTML, or any document. Predicato extracts entities, relationships, contextual triples (with conditions, temporality, certainty, and scope), and conditional rules (IF-THEN-UNLESS patterns) — all with source attribution.

Hybrid search

Combine semantic similarity (cosine on embeddings), BM25 keyword matching, and graph traversal in a single query. Five reranking strategies: RRF, MMR, cross-encoder, node distance, and episode mentions.

Entity resolution

Automatically identify and merge duplicate entities across sources. "Dr. Smith," "John Smith MD," and "J. Smith, Internal Medicine" resolve to the same node in the graph.

Incremental updates

Add new documents to an existing graph without reprocessing everything. Predicato resolves new entities against existing ones and integrates new relationships into the graph incrementally.

Community detection

Discover clusters of related entities automatically. Useful for identifying topic areas, organizational structures, or conceptual groupings within your knowledge base.

Conditional rules

Predicato extracts IF-THEN-UNLESS patterns from documents: "If CPT 70553 AND outpatient setting, THEN prior auth required, UNLESS emergency." These rules are queryable and auditable.

Pluggable everything

Start embedded, scale to external services. Swap any component without changing your application code.

Graph databases

Embedded: CozoDB, DuckDB+DuckPGQ, Ladybug
External: Neo4j, Memgraph

Embeddings

Local: go-candle (Qwen3-0.6B)
Cloud: OpenAI, Gemini

Text generation

Local: go-candle (SmolLM2-360M)
Cloud: OpenAI, any compatible API

Entity extraction

Local: GLiNER (ONNX)
Cloud: GLiNER2 API, LLM-based

Use cases

AI agent memory

Give your AI agents persistent, queryable memory that tracks what they've learned over time. Multi-turn conversations become knowledge that persists across sessions.

RAG systems

Go beyond vector search. Predicato's hybrid search (semantic + keyword + graph traversal) with 5 reranking strategies produces more relevant retrieval than embeddings alone.

Compliance & audit

Bi-temporal tracking means you always know what you knew and when. Source attribution traces every fact back to its origin document. Essential for regulated industries.

Offline deployments

Air-gapped environments, on-premises installations, or simply reducing cloud spend. Predicato's embedded stack means no internet required after initial model download.

Production ready

Built for real workloads, not just demos.

Circuit breakers & fallbacks

If a cloud provider is configured and fails, Predicato falls back to local models automatically. Token usage tracking and cost calculation built in.

Multi-tenancy

GroupID-based isolation lets multiple applications or organizations share a single Predicato instance without data leakage.

WAL recovery & telemetry

Write-ahead logging for embedded databases. Telemetry with DB persistence for operational monitoring. MCP server support for tool integration.