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-rag

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.

Metadata

Release files for graphite-database 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for graphite-database 0.1.0
File Size Uploaded Provenance Actions
graphite_database-0.1.0.tar.gz 113.1 kB Without provenance Details for graphite_database-0.1.0.tar.gz

Release files / graphite_database-0.1.0.tar.gz

Download URL graphite_database-0.1.0.tar.gz
Size 113.1 kB
Tags Source
SHA-256 checksum
How to use checksums
70b11317f556651fd301e53f8804168be96e1bb69f9baf13dbeaf7987d0f4f87
BLAKE2b-256 checksum
How to use checksums
05c245ad003d4114220bb0c7ceab41c347136225f8fd0b2edbcd85309fbb6677
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.7

Security for graphite-database 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

1 release file No provenance

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