Skip to main content

LlamaIndex PropertyGraphStore backed by GrafeoDB embedded graph database

Project description

CI codecov PyPI License

grafeo-llamaindex

LlamaIndex PropertyGraphStore backed by GrafeoDB — an embedded graph database with native vector search.

Build knowledge graphs from documents, query them with GQL, and run vector similarity search — all in a single .db file. No servers, no infrastructure.

Install

pip install grafeo-llamaindex

Quickstart

from llama_index.core import PropertyGraphIndex, SimpleDirectoryReader
from grafeo_llamaindex import GrafeoPropertyGraphStore

documents = SimpleDirectoryReader("./data").load_data()

graph_store = GrafeoPropertyGraphStore(db_path="./knowledge_graph.db")

index = PropertyGraphIndex.from_documents(
    documents,
    property_graph_store=graph_store,
    embed_kg_nodes=True,
)

retriever = index.as_retriever(include_text=True)
nodes = retriever.retrieve("What are the key relationships?")

Features

  • Full PropertyGraphStore — all 8 abstract methods implemented (get, get_triplets, get_rel_map, upsert_nodes, upsert_relations, delete, structured_query, vector_query)
  • Structured + vector queriessupports_structured_queries = True and supports_vector_queries = True in a single store
  • Embedded database — no Docker, no cloud, no external services. Just pip install grafeo
  • Single-file persistence — your entire knowledge graph lives in one .db file
  • Native HNSW vector search — embeddings stored alongside graph nodes, no separate vector DB needed
  • Multi-language queries — GQL, Cypher, Gremlin, GraphQL, and SPARQL all supported
  • Built-in graph algorithms — PageRank, Louvain, shortest paths, centrality, and 30+ more via graph_store.client.algorithms

API Reference

GrafeoPropertyGraphStore

from grafeo_llamaindex import GrafeoPropertyGraphStore

store = GrafeoPropertyGraphStore(
    db_path=None,                # str | None — path for persistent storage, None for in-memory
    embedding_dimensions=1536,   # int — vector dimensions for HNSW index
    embedding_metric="cosine",   # str — "cosine", "euclidean", "dot_product", or "manhattan"
)

Properties:

  • store.client — access the underlying grafeo.GrafeoDB instance for direct queries and algorithms
  • store.supports_structured_queriesTrue
  • store.supports_vector_queriesTrue

Methods (PropertyGraphStore interface):

Method Description
upsert_nodes(nodes) Insert or update EntityNode / ChunkNode objects
upsert_relations(relations) Insert edges between existing nodes
get(properties, ids) Retrieve nodes by ID or property filter
get_triplets(entity_names, relation_names, ids) Get (source, relation, target) triplets
get_rel_map(graph_nodes, depth, ignore_rels) BFS traversal from seed nodes
delete(entity_names, relation_names, ids) Remove nodes and/or edges
structured_query(query) Execute raw GQL/Cypher (or Gremlin with g. prefix)
vector_query(query) HNSW similarity search over node embeddings
get_schema() / get_schema_str() Inspect graph labels, edge types, and properties
persist(path) Save in-memory database to disk
close() Close the database connection

Comparison

Neo4j FalkorDB Grafeo
Requires server Yes Yes No (embedded)
Vector search Plugin (5.x+) Limited Native HNSW
Graph algorithms GDS plugin ($) Built-in Built-in (30+)
Query languages Cypher Cypher GQL, Cypher, Gremlin, GraphQL, SPARQL
Deployment Docker/Cloud Docker/Cloud pip install grafeo
Persistence Server-managed Server-managed Single .db file

Examples

See the examples/ directory:

Development

uv sync                  # install deps
uv run pytest -v         # run tests
uv run ruff check .      # lint
uv run ruff format .     # format
uv run ty check          # type check

License

Apache-2.0

Project details


Download files

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

Source Distribution

grafeo_llamaindex-0.1.1.tar.gz (149.5 kB view details)

Uploaded Source

Built Distribution

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

grafeo_llamaindex-0.1.1-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file grafeo_llamaindex-0.1.1.tar.gz.

File metadata

  • Download URL: grafeo_llamaindex-0.1.1.tar.gz
  • Upload date:
  • Size: 149.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for grafeo_llamaindex-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f12d695fad7ad71ac9d1022915228938138e4384792326d2d315d887f7750e30
MD5 3453cfb0f1a0436e9594c2f1f8ffd51c
BLAKE2b-256 07d33db25175f6f1d219b08ae3cdd5bd7bd36b5db9501c715246ee1ecc7370f1

See more details on using hashes here.

Provenance

The following attestation bundles were made for grafeo_llamaindex-0.1.1.tar.gz:

Publisher: pypi.yml on GrafeoDB/grafeo-llamaindex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file grafeo_llamaindex-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for grafeo_llamaindex-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fb265fcc6bda3d795cd00b03b20144e1b5e7cb9fff3c0fdd1c2c18a9f6d7b637
MD5 8def5ea888592d4c2467de32751d8386
BLAKE2b-256 411c910acce1ec3fa278ece0e4cd02724ec4b4136270307ba64c4de46e3a46b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for grafeo_llamaindex-0.1.1-py3-none-any.whl:

Publisher: pypi.yml on GrafeoDB/grafeo-llamaindex

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page