- RAG – Grounded Answers, Citations and Saying "Not Covered"
A prompt with explicit rules for full, partial and missing coverage, and the Claude API's citations feature returning the exact source span behind each statement. Measured on 40 questions: padded refusals go from 3 to 0, and the new partial answers turn out to be honest reports of a retrieval gap.
- RAG – Hybrid Search, Reranking and Pooled Judging
Keyword search in Postgres (and the missing IDF that made it score 3%), reciprocal rank fusion, a local cross-encoder reranker and a per-post cap, each measured. Why the reranker first looked worse than it was, how pooled judging fixed the golden set, and the result: the simplest setup with the better embedding model wins.
- RAG – Measuring Retrieval with a Golden Question Set
Stop eyeballing results. Write questions with known answers, score hit@1, hit@5 and MRR, and compare. Hand-written versus Claude-generated questions (generated ones flatter search by 14 points), the five labelling mistakes found by reading misses, and why no similarity threshold can tell an answerable question from an off-topic one.
- RAG – Storing Embeddings in Postgres with pgvector
Move the vectors from a NumPy file into Postgres: the table, the HNSW index, the cosine-distance query, and what a bigger embedding model costs. Plus two bugs worth learning from: a NUL byte Postgres refuses to store, and a psycopg transaction that silently turned the index off and made a benchmark compare exact search with itself.
- RAG – Chunking by Structure, Not by Character Count
Split at headings, keep code blocks whole and exact, drop the Copy buttons, put the post title and section in every chunk, skip stub posts, and respect the embedding model's 512-token limit. Same model, same search, same prompt as the naive version: the Python decorators post goes from third to first.