SQLite Gets Into Vector Search |
Written by Nikos Vaggalis | |||
Thursday, 05 September 2024 | |||
This is thanks to sqlite-vec, a new vector search extension for SQLite written entirely in C and with no dependencies. Vendors are eager to add vector search to their dbms products. This is because vector search gets AI and LLMs one step closer to the database by providing relevant, contextual information to the LLM workflows. In the simplest of terms, a vector or embedding takes a chunk of text and creates a numerical representation of that text, so that text with similar content will have similar vectors in this numeric space. What that means is that we can then compare those vectors and find pieces of text that are similar. Of course there's need for an optimized backend to store those vectors , hence pg_vector, the extension for PostgreSQL that renders it as a viable alternative to specialized vector stores like ChromaDB. MariaDB on the other hand adds vector search not as an extension but directly into its core part of the native syntax. Now and not far behind comes SQLite. Although there already was a vector search extension, that of sqlite-vss by the same author of sqlite-vec, he wrote sqlite-vec as a replacement of the former because it was not optimized enough and facing issues with:
In contrast the new counterpart is a no-dependency SQLite extension, it is written entirely in a single C file and is extremely portable working on most operating systems and environments, as in working on MacOS, Linux, Windows, Android, Raspberry Pis and other small devices, and in the browser through WebAssembly! That aside it's also MIT/Apache-2 dual licensed. Installation wise You have several options to include it into your projects, including PyPi packages for Python, NPM packages for Node. js, Gems for Ruby, and more.
For instance, to use sqlite-vec from Python, install the sqlite-vec PyPi package using your favorite Python package manager: pip install sqlite-vec and once installed, use the sqlite_vec.load() function to load sqlite-vec SQL functions into a SQLite connection. Alternatively you can load it inside a SQLite instance for using it under raw sql: Magic. Caveat only that the current version only supports brute force/exhaustive full-scan vector search and no "approximate nearest neighbors" (ANN) options by means of HNSW Index Storage. Fear not however since that support is on the tool's roadmap, which looks paved rich with opportunities for achievement since quite recently SQLite Cloud announced that they sponsor the development of the extension sqlite-vec to enable for privacy-first mobile GenAI Applications. The future looks bright! More InformationSponsoring sqlite-vec for privacy-first mobile GenAI Applications Related ArticlesTurn PostgreSQL Into A Vector Store MariaDB Introduces Vector Search
To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.
Comments
or email your comment to: comments@i-programmer.info |
|||
Last Updated ( Thursday, 05 September 2024 ) |