Started 16 Mar 2026
CivicRAG
A small retrieval-augmented generation prototype that runs entirely on Cloudflare's edge — embeddings, vector search and a streamed LLM answer.
Cloudflare Workers AI
Cloudflare Vectorize
Pages Functions
Llama 3 8B
bge-base-en-v1.5
What it is
A question goes to a Pages Function, which embeds it with bge-base-en-v1.5 (768 dimensions), finds the three closest passages in a Cloudflare Vectorize index, and streams an answer from llama-3-8b-instruct that is instructed to answer only from those passages.
The corpus is deliberately tiny: five hand-written summaries of US commercial drone rules (registration, altitude and speed limits, visual line of sight, flying over people, and airspace restrictions). It exists to prove the pipeline end to end, not to be a useful search tool.
What I'd change
- Retrieval quality is untested. There is no evaluation set, so I can't say how often the right passage comes back. v2 adds a gold question set and measures recall@k and answer faithfulness.
- Vector search alone misses exact terms. Rule numbers like "Part 107" are better matched by keyword search. v2 adds BM25 alongside vectors and a reranker.
- Five documents can't show chunking problems. v2 indexes real, long public documents.
Try it
Ask something about US commercial drone rules. The model is told to answer only from the retrieved passages and to say so when they don't cover the question — try asking something outside the five topics to see that refusal.