Skip to main content

LlamaIndex Graph Stores Integration: FalkorDB

FalkorDB is a fast, low-latency property graph database built on a sparse-matrix engine and queried with Cypher. This package provides two integrations:

  • FalkorDBPropertyGraphStore — the modern PropertyGraphStore used by PropertyGraphIndex
  • FalkorDBGraphStore — the legacy triplet-based GraphStore

Installation

pip install llama-index-graph-stores-falkordb

Running FalkorDB

docker run -p 6379:6379 -p 3000:3000 -v $PWD/data:/data falkordb/falkordb:latest

The browser UI is then available on http://localhost:3000. A managed instance is also available on FalkorDB Cloud.

Usage

from llama_index.core import Document
from llama_index.core.indices.property_graph import PropertyGraphIndex
from llama_index.graph_stores.falkordb import FalkorDBPropertyGraphStore

graph_store = FalkorDBPropertyGraphStore(
    url="redis://localhost:6379",
    database="falkor",  # the graph name
)

index = PropertyGraphIndex.from_documents(
    [Document(text="Alice works for Acme since 2023.")],
    property_graph_store=graph_store,
)

retriever = index.as_retriever(include_text=True)
print(retriever.retrieve("Who does Alice work for?"))

The store is also a context manager, so the connection is released deterministically:

with FalkorDBPropertyGraphStore(url="redis://localhost:6379") as graph_store:
    graph_store.upsert_nodes([...])

Connecting to a secured instance

Any additional keyword argument is forwarded to the FalkorDB client:

graph_store = FalkorDBPropertyGraphStore(
    url="redis://my-instance.falkordb.cloud:6379",
    username="falkordb",
    password="...",
    ssl=True,
    socket_timeout=30,
)

Configuration

Argument Default Description
url Connection URL, e.g. redis://localhost:6379.
database "falkor" Name of the graph to read from and write to.
refresh_schema True Read the graph schema on startup.
sanitize_query_output True Strip oversized values (such as embeddings) from query results.
create_indexes True Create the range and vector indexes used for lookups and vector search.
timeout None Per-query timeout in milliseconds.

Indexes

With create_indexes=True (the default) the store creates a range index on __Entity__.id and Chunk.id, which is what makes ingestion MERGEs and id lookups fast. A vector index on __Entity__.embedding is created lazily, the first time a node with an embedding is written, using that embedding's dimension and cosine similarity. vector_query uses the index when no metadata filters are supplied and falls back to an exact scan otherwise.

If the graph already contains a vector index with a different dimension, the store logs a warning and falls back to the exact scan — recreate the index (or the graph) when you change embedding model.

Schema

refresh_schema() enumerates every label and relationship type in the graph, then samples up to 1000 nodes per label to infer property types, and up to 1000 relationships per type to infer which labels they connect. Labels and relationship types are therefore always complete, while the reported property types and (:Start)-[:REL]->(:End) pairs are a best-effort sample — a combination that occurs in fewer than 1 in 1000 relationships of its type may be missed. The embedding property is excluded so it never reaches the text-to-Cypher prompt.

Sampling matters because PropertyGraphIndex refreshes the schema after every ingestion batch; traversing all relationships instead would make ingestion cost grow with the size of the graph.

Ingestion performance

Every read this store issues is scoped to __Entity__ or Chunk so FalkorDB's label-scoped range indexes apply. This is what keeps the per-batch deduplication that PropertyGraphIndex performs (get() twice, plus a schema refresh) from degrading into full-graph scans as the graph grows.

Legacy graph store

from llama_index.graph_stores.falkordb import FalkorDBGraphStore

graph_store = FalkorDBGraphStore(url="redis://localhost:6379")
graph_store.upsert_triplet("Alice", "works_for", "Acme")

Testing

The tests start a throwaway FalkorDB container automatically (Docker required):

pytest tests

Set FALKORDB_TEST_URL to run them against an already running instance instead:

FALKORDB_TEST_URL=redis://localhost:6379 pytest tests

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llama_index_graph_stores_falkordb-0.7.0.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file llama_index_graph_stores_falkordb-0.7.0.tar.gz.

File metadata

  • Download URL: llama_index_graph_stores_falkordb-0.7.0.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for llama_index_graph_stores_falkordb-0.7.0.tar.gz
Algorithm Hash digest
SHA256 747294d21f3feee91eff3fcd8185f4be93f31dbbead899bb1a136e54e2d7b563
MD5 22c92d46fd67337275339291e122005d
BLAKE2b-256 96038f8a714152635d52c20f5ecd75a8aa2a08fe888c1b7cf161c56cb2b88e38

See more details on using hashes here.

File details

Details for the file llama_index_graph_stores_falkordb-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: llama_index_graph_stores_falkordb-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 17.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.7 {"installer":{"name":"uv","version":"0.12.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for llama_index_graph_stores_falkordb-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b898364b49e5b94b451b2b03aaa904bcb0dcee52bfe1254c2318a87811c6d22
MD5 32ac795b9d2db73988fcf5f2ca90e151
BLAKE2b-256 a8e32a61fa74175b8df5c59596ffd405cbe38278cc0acdedd0233fd01097b445

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 files

0.6.0

2 files

0.5.0

2 files

0.4.2

2 files

0.4.1

2 files

0.4.0

2 files

0.3.0

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.1

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page