sqlite-vec
is a vector search extension for SQLite with install options for Node.js, Python, Rust, rqlite and more. I previously used SQLite to store embeddings when investigating the viability of using a text embedding model to recommend related posts on the blog. However, back then I'd calculated the cosine similarity between each embedding which is compute intensive. Using this extension would allow me to dynamically retrieve the distance between an embedding and the embeddings stored in the database.
The extension can be compiled on various platforms but currently the PyPI package does not have an ARM release.
I also encountered an error when trying to retrieve distances for embeddings: "OperationalError: A LIMIT or 'k = ?' constraint is required on vec0 knn queries"
. I wasn't alone in this the workaround is to use k
instead of LIMIT
in the query. In the coming few weeks I'll be playing around with this extension some more, looks very promising so far.