LlamaIndex Integration
vectlite.llamaindex.VectLiteVectorStore implements the LlamaIndex VectorStore protocol. Plug it into VectorStoreIndex, query engines, chat engines, and any LlamaIndex flow that takes a vector store.
pip install vectlite llama-index-core
llama-index-core is an optional dependency of vectlite — installing it unlocks the integration.
Quick start
from vectlite.llamaindex import VectLiteVectorStore
from llama_index.core import StorageContext, VectorStoreIndex, Document
store = VectLiteVectorStore(path="my.vdb", dimension=1536)
storage_ctx = StorageContext.from_defaults(vector_store=store)
documents = [
Document(text="Auth setup guide for SSO", metadata={"source": "docs"}),
Document(text="Billing FAQ", metadata={"source": "faq"}),
]
index = VectorStoreIndex.from_documents(documents, storage_context=storage_ctx)
query_engine = index.as_query_engine()
response = query_engine.query("How do I configure SSO?")
print(response)
Supported methods
| Method | Description |
|---|---|
add(nodes) | Insert LlamaIndex BaseNode objects with their embeddings. |
delete(ref_doc_id) | Remove all nodes belonging to a reference document. |
query(query) | Vector / metadata search, returns a VectorStoreQueryResult. |
Persistence across runs
Because vectlite persists to a .vdb file, you don't need to re-ingest on every run. Reopen the existing store and rebuild the index from it:
store = VectLiteVectorStore(path="my.vdb")
index = VectorStoreIndex.from_vector_store(store)
query_engine = index.as_query_engine()
Chat engine example
chat_engine = index.as_chat_engine(chat_mode="condense_question")
response = chat_engine.chat("What does the docs say about SSO?")
Filtering
Pass MetadataFilters through the query engine — they map to vectlite metadata filters:
from llama_index.core.vector_stores import MetadataFilter, MetadataFilters
filters = MetadataFilters(filters=[
MetadataFilter(key="source", value="docs")
])
query_engine = index.as_query_engine(filters=filters)
When to pick vectlite over other LlamaIndex stores
- No external dependency — a single
.vdbfile ships with your app. No Postgres + pgvector, no Pinecone account. - Crash-safe persistence — the WAL means an OS crash mid-ingest doesn't corrupt the index.
- Built-in hybrid search — combine LlamaIndex's structured retrieval with vectlite's sparse + dense fusion.
Combining with vectlite-native features
The underlying database is reachable via store.db — use it for TTL, payload indexes, quantization, or any feature outside LlamaIndex's protocol:
store.db.create_index("source", "keyword")
store.db.enable_quantization("scalar")