SQLite as a Vector Store with SQLiteVec
This notebook covers how to get started with the SQLiteVec vector store.
SQLite-Vec is an
SQLite
extension designed for vector search, emphasizing local-first operations and easy integration into applications without external servers. It is the successor to SQLite-VSS by the same author. It is written in zero-dependency C and designed to be easy to build and use.
This notebook shows how to use the SQLiteVec
vector database.
Setup
You'll need to install langchain-community
with pip install -qU langchain-community
to use this integration
# You need to install sqlite-vec as a dependency.
%pip install --upgrade --quiet sqlite-vec
Credentials
SQLiteVec does not require any credentials to use as the vector store is a simple SQLite file.
Initialization
from langchain_community.embeddings.sentence_transformer import (
SentenceTransformerEmbeddings,
)
from langchain_community.vectorstores import SQLiteVec
embedding_function = SentenceTransformerEmbeddings(model_name="all-MiniLM-L6-v2")
vector_store = SQLiteVec(
table="state_union", db_file="/tmp/vec.db", embedding=embedding_function
)
API Reference:SentenceTransformerEmbeddings | SQLiteVec