Skip to main content

Quickstart

Get from zero to a working knowledge graph in under 5 minutes.

pip install retrico

For additional dependencies (LLM extraction, PDF support, vector stores, etc.), see Installation.

Build a Knowledge Graph

import retrico

result = retrico.build_graph(
texts=[
"Albert Einstein was born in Ulm, Germany in 1879.",
"Marie Curie conducted pioneering research on radioactivity at the University of Paris.",
],
entity_labels=["person", "organization", "location"],
relation_labels=["born in", "works at"],
)

writer = result.get("writer_result")
print(f"Entities: {writer['entity_count']}, Relations: {writer['relation_count']}")

That's it — your texts are now a knowledge graph in a local database (FalkorDB Lite, zero-config). Switch to Neo4j, FalkorDB server, or Memgraph with a single store_config — see Databases.

Query the Knowledge Graph

result = retrico.query_graph(
query="Where was Einstein born?",
entity_labels=["person", "location"],
api_key="sk-...", # any OpenAI-compatible API key
model="gpt-4o-mini",
)

print(result.answer)
print(result.subgraph.entities)
print(result.subgraph.relations)

Without an api_key, you still get the retrieved subgraph — just without the LLM-generated answer.

Next Steps

  • Installation — optional extras, database drivers, dev setup
  • Introduction — architecture, design philosophy, and why RetriCo
  • Building — builder API, YAML configs, LLM and mixed pipelines
  • Databases — Neo4j, FalkorDB, Memgraph setup
  • Retrieving — 8+ retrieval strategies
  • CLI — command-line interface for all operations