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.

Download files

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

Source Distribution

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

Uploaded Source

File details

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

File metadata

  • Download URL: graphite_database-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_database-0.1.0.tar.gz
Algorithm Hash digest
SHA256 70b11317f556651fd301e53f8804168be96e1bb69f9baf13dbeaf7987d0f4f87
MD5 fff6f51964f61b68850c84283094b50a
BLAKE2b-256 05c245ad003d4114220bb0c7ceab41c347136225f8fd0b2edbcd85309fbb6677

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