Skip to main content

Graphite Logo

Graphite Python SDK

Native Python bindings for the Graphite embedded GraphRAG engine

PyPI License Documentation

Graphite DB combines Knowledge Graphs, SIMD AVX2 Vector Search, BM25 Lexical Indexing, and Token-Budgeted Context Synthesis into a single-file .graphite database with zero-copy memory mapping.


Installation

pip install graphite-db

Quickstart

import graphite_db as graphite

# 1. Open or create an embedded database
db = graphite.open("knowledge.graphite", dim=384, max_tokens=400)

# 2. Insert entities and create connections
id_auth = db.insert("AuthService", entity_type="Module", description="Validates JWT tokens")
id_db = db.insert("UsersDB", entity_type="Database", description="PostgreSQL primary cluster")
db.connect("AuthService", "UsersDB", relation="CONNECTS_TO", weight=0.95)
db.flush()

# 3. Query GraphRAG context with automatic local FastEmbed embedding
result = db.query("How does authentication connect to the database?")

print(f"Retrieved {result.token_count} tokens:")
print(result.markdown)

In-Memory Ephemeral Storage

import graphite_db as graphite

with graphite.in_memory(dim=384) as db:
    db.remember("User prefers concise Portuguese responses.", category="UserPreference")
    result = db.query("What language does the user prefer?")
    print(result.markdown)

Direct Vector Operations & Custom Embeddings

import graphite_db as graphite

# Generate 384-dimensional vector locally on CPU
vector = graphite.embed("How does authentication work?")

db = graphite.in_memory(dim=384)
result = db.retrieve_context(vector, query_text="authentication", max_tokens=300)
print(result.markdown)

License

Dual-licensed under MIT or Apache-2.0.

Download files

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

Source Distribution

graphite_rag-0.1.0.tar.gz (113.1 kB view details)

Uploaded Source

File details

Details for the file graphite_rag-0.1.0.tar.gz.

File metadata

  • Download URL: graphite_rag-0.1.0.tar.gz
  • Upload date:
  • Size: 113.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.7

File hashes

Hashes for graphite_rag-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4629e455d1facd127d39278ad43b16c1b8bcca7db20f13d0dfcdf98cccd8a9ca
MD5 67a1ea0e228d7630703fad46c7fead46
BLAKE2b-256 76fa2d690e0e4e34ed34b6aaf7a61643e455f145312831ea6f404d0e749d5ddf

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 file

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