Skip to content

Add LodeDB vector database adapter - #130

Open
Davidobot wants to merge 2 commits into
topoteretes:mainfrom
Davidobot:feat/lodedb-vector-adapter
Open

Add LodeDB vector database adapter#130
Davidobot wants to merge 2 commits into
topoteretes:mainfrom
Davidobot:feat/lodedb-vector-adapter

Conversation

@Davidobot

Copy link
Copy Markdown

Summary

Adds cognee-community-vector-adapter-lodedb, registering LodeDB as a cognee vector_db_provider. LodeDB is a local-first, on-disk, in-process vector store (no server, no account, no API key): an exact brute-force scan by default, optional IVF-style ANN for large corpora, hybrid (vector + BM25) retrieval, and O(changed) delta persistence for fast incremental writes.

How it works

cognee owns embedding (its EmbeddingEngine), so the adapter uses LodeDB's vector-in path:

  • One LodeDB index per cognee collection under vector_db_url (a local directory, created if absent).
  • The serialized DataPoint payload is kept in LodeDB's raw-text sidecar, so retrieve and include_payload searches return it.
  • belongs_to_set membership is stored as scalar metadata presence keys, so node_name (NodeSet) filtering pushes into LodeDB's metadata planner rather than post-filtering in Python.
  • cognee ranks by cosine distance (lower is better), so results report 1 - cosine_similarity.

Implements the full VectorDBInterface (has_collection, create_collection, create_data_points, search, batch_search, retrieve, delete_data_points, create_vector_index, index_data_points, prune, embed_data) plus remove_belongs_to_set_tags and upsert_raw_vectors.

The adapter implementation ships in the lodedb package (lodedb.local.integrations.cognee, added in lodedb 1.3.1) where it is maintained and tested against LodeDB's API; this package registers it via use_vector_adapter("lodedb", ...).

Usage

import cognee
from cognee_community_vector_adapter_lodedb import register  # noqa: F401

cognee.config.set_vector_db_config(
    {"vector_db_provider": "lodedb", "vector_db_url": "./.lodedb"}
)

Or via env (.env.example): VECTOR_DB_PROVIDER=lodedb, VECTOR_DB_URL=./.lodedb.

Contents

  • cognee_community_vector_adapter_lodedb/register module + adapter re-export
  • pyproject.toml (lodedb>=1.3.1, cognee>=1.1.0,<2), README.md, example.py, .env.example
  • tests/test_lodedb.py — offline tests (deterministic stub embedding, no LLM or network): provider registration, create/search/retrieve roundtrip, and node_name (belongs_to_set) filtering.

Notes

I held off on adding a test_lodedb.yml workflow and a committed lockfile, since CI wiring depends on the org's LLM/embedding secrets and your preferred lock tooling. Happy to add a per-package workflow following the milvus/qdrant pattern (the included tests are offline and need no secrets) and a poetry.lock if you'd like.

Davidobot added 2 commits July 5, 2026 11:24
Register LodeDB (local-first, on-disk, in-process vector store) as a cognee
vector_db_provider under packages/vector/lodedb. The adapter implementation ships
in the lodedb package (lodedb.local.integrations.cognee.CogneeLodeDBAdapter), where
it is maintained and tested against LodeDB's API; this package registers it via
use_vector_adapter("lodedb", ...).

cognee owns embedding, so the adapter uses LodeDB's vector-in path: one LodeDB index
per collection under vector_db_url, the serialized DataPoint payload in LodeDB's
raw-text sidecar, and belongs_to_set membership as scalar presence keys for node_name
filtering. Includes register/adapter/__init__ modules, pyproject, README, example,
.env.example, and offline tests.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant