Semantica Storage Backends: Complete Guide to 8 Supported Vector Databases
Semantica supports eight storage backends: faiss, weaviate, qdrant, milvus, pinecone, pgvector, sqlite, and inmemory, each implemented as a pluggable adapter behind the unified VectorStore abstraction.
The semantica-agi/semantica repository provides a flexible vector storage layer designed for AI applications. Whether you need local development convenience or production-scale cloud infrastructure, Semantica's backend system lets you switch persistence layers without changing your application code.
How Semantica Manages Storage Backends
At the core of Semantica's storage system is the VectorStore class defined in semantica/vector_store/vector_store.py. This class maintains a static set called SUPPORTED_BACKENDS (lines 12-13) that enumerates every recognized backend:
# From vector_store.py, lines 12-13
SUPPORTED_BACKENDS = {
"faiss", "weaviate", "qdrant", "milvus",
"pinecone", "pgvector", "sqlite", "inmemory"
}
When you instantiate VectorStore, the constructor validates your backend choice against this set. Supply an unsupported name and you'll receive a clear ValueError (lines 15-19). For valid backends, the private method _init_backend_store handles lazy importing of the appropriate adapter class and passes through configuration parameters.
Complete List of Semantica Storage Backends
FAISS — Local High-Performance Indexing
faiss provides Facebook AI Similarity Search integration for fast, in-process vector indexing. Ideal for single-machine deployments where you need maximum query speed without external dependencies.
Source implementation: semantica/vector_store/faiss_store.py
from semantica.vector_store import VectorStore
store = VectorStore(
backend="faiss",
config={"dimension": 384, "index_path": "/tmp/faiss.idx"}
)
store.store_documents(["doc A", "doc B"])
Weaviate — Managed Vector Database
weaviate supports both cloud-hosted and self-hosted deployments with rich semantic search capabilities. Use this when you need schema management and vector search in one system.
Source implementation: semantica/vector_store/weaviate_store.py
store = VectorStore(
backend="weaviate",
config={
"url": "https://my-weaviate-instance.com",
"api_key": "MY_WEAVIATE_TOKEN",
"dimension": 512,
}
)
store.add_documents(["text 1", "text 2"])
Qdrant — Distributed Vector Engine
qdrant offers distributed vector search with payload filtering. Suitable for applications requiring horizontal scaling and advanced metadata queries.
Source implementation: semantica/vector_store/qdrant_store.py
store = VectorStore(
backend="qdrant",
config={"host": "localhost", "port": 6333, "dimension": 256}
)
store.store_vectors([[0.0, 1.0, 2.0]], metadata=[{"category": "test"}])
Milvus — Billion-Scale Vector Storage
milvus targets high-performance scenarios with billions of vectors. Choose this for large-scale AI applications demanding sub-millisecond latency at scale.
Source implementation: semantica/vector_store/milvus_store.py
store = VectorStore(
backend="milvus",
config={"host": "127.0.0.1", "port": "19530", "dimension": 768}
)
store.store_documents(["sample text"])
Pinecone — Fully Managed SaaS
pinecone provides serverless vector search with automatic scaling. Perfect for teams wanting to eliminate infrastructure management entirely.
Source implementation: semantica/vector_store/pinecone_store.py
store = VectorStore(
backend="pinecone",
config={"api_key": "PINECONE_KEY", "environment": "us-west1-gcp", "dimension": 768}
)
store.store_vectors([[0.5, 0.4, 0.3]], metadata=[{"source": "demo"}])
PgVector — PostgreSQL Native Vectors
pgvector leverages the PostgreSQL extension for vector storage as native column types. Best when you want vectors alongside relational data in an existing Postgres installation.
Source implementation: semantica/vector_store/pgvector_store.py
store = VectorStore(
backend="pgvector",
config={
"connection_string": "postgresql://user:pwd@localhost/vecdb",
"table_name": "my_vectors",
"dimension": 768,
}
)
store.store_vectors([[0.2, 0.1, 0.0]], metadata=[{"label": "pg"}])
SQLite — Lightweight On-Disk Storage
sqlite offers portable, file-based vector persistence without external services. Excellent for edge deployments, mobile applications, or development environments.
Source implementation: semantica/vector_store/sqlite_vec_store.py
store = VectorStore(
backend="sqlite",
config={"db_path": "./vectors.db", "dimension": 128}
)
store.store_documents(["sqlite doc"])
InMemory — Default Fallback
inmemory serves as the default backend using pure Python dictionaries (self.vectors and self.metadata). Requires zero dependencies and persists only for the process lifetime.
Source implementation: Internal to vector_store.py (no separate adapter file)
from semantica.vector_store import VectorStore
store = VectorStore(backend="inmemory", dimension=128)
ids = store.store_vectors([[0.1, 0.2, 0.3]], metadata=[{"type": "demo"}])
Configuration and Error Handling
Each backend accepts configuration through the config dictionary parameter. The _init_backend_store method (lines 71-92) automatically ignores irrelevant keys, so you can safely include extra values.
Missing dependencies trigger descriptive ImportError exceptions. For example, attempting to use faiss without faiss-cpu or faiss-gpu installed produces an error message prompting the correct package installation.
After initialization, all backends expose an identical API: store_vectors(), search(), delete_vectors(), and document-oriented methods like store_documents() and add_documents().
Backend Selection Guidelines
| Use Case | Recommended Backend | Reason |
|---|---|---|
| Prototyping / testing | inmemory | Zero setup, instant start |
| Single-machine production | faiss | Maximum speed, no network overhead |
| Existing PostgreSQL infrastructure | pgvector | Native SQL integration |
| Mobile/edge deployment | sqlite | File-based, minimal footprint |
| Managed service preference | pinecone or weaviate | No operational burden |
| Billion-scale vectors | milvus | Purpose-built for massive scale |
| Distributed microservices | qdrant | Cloud-native architecture |
Key Source Files in semantica-agi/semantica
| File | Purpose |
|---|---|
semantica/vector_store/vector_store.py |
Central façade; SUPPORTED_BACKENDS set, constructor validation, backend dispatch |
semantica/vector_store/faiss_store.py |
FAISS adapter implementation |
semantica/vector_store/weaviate_store.py |
Weaviate client wrapper |
semantica/vector_store/qdrant_store.py |
Qdrant connection handler |
semantica/vector_store/milvus_store.py |
Milvus SDK integration |
semantica/vector_store/pinecone_store.py |
Pinecone API client |
semantica/vector_store/pgvector_store.py |
SQLAlchemy-based Postgres adapter |
semantica/vector_store/sqlite_vec_store.py |
SQLite with vector extension support |
Summary
- Semantica supports eight storage backends: faiss, weaviate, qdrant, milvus, pinecone, pgvector, sqlite, and inmemory
- Backend selection occurs through the
backendparameter inVectorStoreconstructor, validated againstSUPPORTED_BACKENDS - Each backend has a dedicated adapter file in
semantica/vector_store/exceptinmemory, which uses internal dictionary storage - Configuration passes through a unified
configdictionary with backend-specific parameters - The public API remains identical across all backends, enabling seamless migration between storage layers
Frequently Asked Questions
How do I check if a backend is available in my Semantica installation?
Attempt to instantiate VectorStore with your desired backend. If the backend name is unsupported, you'll receive a ValueError immediately. If the backend requires missing dependencies, you'll get an ImportError with installation instructions. The SUPPORTED_BACKENDS set in vector_store.py (lines 12-13) provides the authoritative list.
Can I migrate data between Semantica storage backends?
Semantica does not provide built-in migration utilities. However, because all backends implement the same retrieval API, you can export vectors using search() or internal storage access, then re-import with store_vectors() to your new backend. For production migrations, consider implementing a batch export/import script using the dimension and metadata fields preserved across all adapters.
Does Semantica support multiple backends simultaneously in one application?
Yes. You can create multiple VectorStore instances with different backends in the same process. Each instance maintains independent connections and storage. This pattern enables hybrid architectures—such as using inmemory for caching with pgvector for persistent storage—within a single application.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →