← AI Lab

Build a small retrieval-augmented (RAG) Q&A

September 26, 2026

The question

  • How can I create a create a chatbot and use it as a small RAG over my case studies?

Setup

  • postgreSQL, python, pgvector, OpenAI

Results

What I Learned

  • pgvector allows PostgreSQL to store vectors... very handy
  • Anthropic does not provide its own embedding API, Voyageai is recommended for embedding. (i.e. You need Voyageai to create your vectors). OpenAI, on the other hand, does include embedding logic.
  • The amount of context in your embeddings greatly dictates the search results.
  • Embeddings are about semantic similarity, not reasoning.

GIT Repository

Log

  • 2026-09-26 — Researched the RAG methodology; Started the search code... doc ingesting, chunking, vectorization, ask question, return highest similarity chunk.
  • 2026-09-27 - Updated postgres to 17 in order to support pgvector, installed pgvector, created mini-rag database.
  • 2026-09-28 - Tweaked doc parsing to recognize my markdown sections so each chunk is a section, not just 50 chars. Created the SQL to insert each section name, content, and vector. Finished the ingestion side of my mini_rag database.