Vector databases store document embeddings and enable fast similarity search. Definable includes seven implementations in theDocumentation Index
Fetch the complete documentation index at: https://docs.definable.ai/llms.txt
Use this file to discover all available pages before exploring further.
definable.vectordb module and a base class for custom backends.
All vector DB classes are imported from
definable.vectordb, not definable.knowledge. The definable.knowledge module re-exports InMemoryVectorDB for backward compatibility but will show a deprecation warning.InMemoryVectorDB
Stores everything in memory. Great for development, testing, and small datasets.- No external dependencies (requires
numpy) - Uses cosine similarity for search
- Data is lost when the process exits
PgVector
Uses PostgreSQL with thepgvector extension. Suitable for production workloads with persistent storage and scalable search.
Requires Your PostgreSQL instance must have the
psycopg[binary] and pgvector. Install with:pgvector extension enabled:Qdrant
High-performance vector search engine.ChromaDb
MongoDb
MongoDB Atlas vector search.RedisDB
Redis with RediSearch for vector similarity.PineconeDb
Pinecone managed vector database.Using with Knowledge
Pass any vector DB instance toKnowledge:
VectorDB Interface
All implementations share the same base interface fromdefinable.vectordb.VectorDB:
| Method | Description |
|---|---|
create() | Create the collection / table if it doesn’t exist |
insert(content_hash, documents) | Insert pre-embedded documents |
upsert(content_hash, documents) | Insert or update pre-embedded documents |
search(query, limit, filters) | Search by text query (backend embeds internally) |
count() -> int | Number of stored documents |
delete_by_id(id) | Delete a document by its ID |
delete() | Delete the entire collection / table |
drop() | Drop the collection / table from the backend |
ainsert(content_hash, documents) | Async insert |
asearch(query, limit, filters) | Async search |
Creating a Custom VectorDB
SubclassVectorDB from definable.vectordb to integrate any vector store. The key abstract methods to implement are:
Choosing a Vector Database
| InMemoryVectorDB | PgVector | Qdrant | ChromaDb | MongoDb | RedisDB | PineconeDb | |
|---|---|---|---|---|---|---|---|
| Setup | None | PostgreSQL + pgvector | Qdrant server | None (in-memory) or local dir | MongoDB Atlas | Redis + RediSearch | Managed |
| Persistence | No | Yes | Yes | Optional | Yes | Yes | Yes |
| Scale | Thousands | Millions | Millions | Thousands–millions | Millions | Millions | Billions |
| Best for | Dev, testing | Existing PG infra | High performance | Local dev | Existing Mongo | Low latency | Serverless |