Doing RAG with postgres is a very popular approach, but it requires some infrastructure to get running. Namely a postgres server, and a running compute instance that can run the postgres DB.
The advantage of SQLite is that it's a single file, and you can easily copy it around. And storing the vectors, and being able to query them, is the only real requirement for basic RAG. And it's also a great way to get started with RAG if you don't want to deal with server setups as well.
To start this process off, we'll install sqlite cli, sqlite-utils, and the sqlite-vec extension. sqlite-utils lets us manage extensions, and sqlite-vec is the extension that lets us store and query vectors in SQLite.
This will give you a sqlite3 command that you can use to interact with a SQLite database. So, let's create a database called rag.db and an embeddings table.
Ollama is a lightweight, open-source, and easy-to-use way to run LLMs in your local environment. If you haven't already, you'll need to install Ollama.