Skip to main content

Knowledge graph + vector search + SQL analytics in SQLite

Project description

ChimeraDB

Knowledge graph + vector search + SQL analytics in SQLite.

For LLM apps that need structured memory: RAG, AI agents, question answering, recommendations.

Python 3.8+ License: MIT

ExamplesDocs


Quick Start

pip install chimeradb
from chimeradb import KnowledgeGraph

# Auto-embeddings enabled by default
kg = KnowledgeGraph("my.db")

# Create nodes with Cypher
kg.cypher("CREATE (d:Document {text: 'LLMs are transforming software'})")
kg.cypher("CREATE (d:Document {text: 'RAG combines retrieval with generation'})")

# Or bulk insert with SQL
import json
kg.execute(
    "INSERT INTO graph_nodes (labels, properties) VALUES (?, ?)",
    (json.dumps(["Document"]), json.dumps({"text": "Vector databases enable semantic search"}))
)
kg.commit()

# Semantic search
results = kg.search("how do AI apps work?", top_k=3)
for r in results:
    print(f"{r['properties']['text'][:50]}: {r['similarity']:.1%}")

# Graph traversal
network = kg.traverse("node_id", direction="outgoing", max_depth=3)

# SQL analytics
stats = kg.query("SELECT COUNT(*) FROM graph_nodes")

What You Get

  • Semantic search: Embeddings auto-generated on every insert
  • Graph queries: Cypher for patterns, SQL for complex analytics
  • Zero infrastructure: Single SQLite file, runs anywhere
  • Any language: Pure SQL extensions work with Python, Node.js, Go, Rust, etc.

Installation

Python Package

pip install chimeradb

Or from source:

git clone https://github.com/codimusmaximus/chimeradb.git
cd chimeradb
./setup.sh && source .venv/bin/activate

SQL Only (Any Language)

# macOS ARM64
mkdir -p extensions
curl -L https://github.com/agentflare-ai/sqlite-graph/releases/latest/download/libgraph.dylib -o extensions/libgraph.dylib
curl -L https://github.com/sqliteai/sqlite-vector/releases/latest/download/vector-macos-arm64.dylib -o extensions/vector.dylib

Then load in any SQLite client:

.load extensions/libgraph
.load extensions/vector

Use from Python, Node.js, Go, Rust, Java, C++, or any language with SQLite support.

Python API

from chimeradb import KnowledgeGraph

# Create database
kg = KnowledgeGraph("my_graph.db")  # Or ":memory:"

# Optional: disable embeddings or use different model
# kg = KnowledgeGraph("my.db", embedding_model=None)
# kg = KnowledgeGraph("my.db", embedding_model="text-embedding-3-small")

# Add nodes
kg.add_entity(
    entity_id="person1",
    labels=["Person"],
    properties={"name": "Alice", "bio": "AI researcher"},
    embed_field="bio"
)

# Add relationships
kg.add_relationship(
    from_id="person1",
    to_id="company1",
    relation_type="WORKS_AT",
    properties={"since": 2020}
)

# Semantic search
results = kg.search("machine learning expert", top_k=10)

# Graph traversal
network = kg.traverse("person1", direction="outgoing", max_depth=3)

# SQL queries
data = kg.query("""
    SELECT json_extract(properties, '$.name') as name
    FROM graph_nodes
    WHERE json_extract(properties, '$.role') = 'Engineer'
""")

kg.close()

Examples

Performance

M1 MacBook Pro:

  • Inserts: 10,000+ nodes/second
  • Vector search: < 1ms for 100k embeddings
  • Storage: ~500 bytes per node (with 384-dim embeddings)

Good for:

  • Prototypes and MVPs
  • Small-to-medium apps (millions of nodes)
  • Edge AI and on-device intelligence

Not designed for:

  • Billions of nodes
  • Distributed systems
  • High-write concurrent workloads

Requirements

  • Python 3.8+
  • macOS (ARM64 or Intel) - Linux and Windows coming soon
  • sentence-transformers (auto-installed by setup.sh)

Documentation

Tech Stack

Built on:

License

MIT - see LICENSE

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

chimeradb-0.1.0.tar.gz (230.9 kB view details)

Uploaded Source

Built Distribution

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

chimeradb-0.1.0-py3-none-any.whl (228.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: chimeradb-0.1.0.tar.gz
  • Upload date:
  • Size: 230.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for chimeradb-0.1.0.tar.gz
Algorithm Hash digest
SHA256 da932edb94a25986db99cd7dcadcee11da5004942d03cb5ddc7e399563a4d9ce
MD5 61109342e8ad95c6f2b7dab6ed033b9c
BLAKE2b-256 d4a3b308c56f29e6b3bf74c90a9344cb3e6485642a5a873c746395b8a80f5879

See more details on using hashes here.

File details

Details for the file chimeradb-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: chimeradb-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 228.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for chimeradb-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9f20fbf0ccd1313a823afac63474dfeb6fc0a9aff28bc221a67b5e12929b2f95
MD5 87c9d4fcf366873aa04fe361882a50dd
BLAKE2b-256 6bf28ad8a38ff7b2e6a3aec85de07c3c37c763b28c8e1f635fbe9d635ea337da

See more details on using hashes here.

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