Ask this site
Ask about services, projects or anything in the blog. The answer comes only from this site, with the page each part came from. Open "See how it works" for the search, the prompt and the cost.
How it works
- 01
Index built with the site
After the site is built, a script reads each page, splits it at section headings and creates a vector for each excerpt with the bge-m3 model. An excerpt that did not change keeps its old vector, so updating the index only pays for new text.
- 02
Two searches
The question becomes a vector with the same model and is compared with every excerpt in the page language. In parallel, a keyword search (BM25) catches exact names such as "NFS-e" or "DeuOk" that vectors sometimes miss.
- 03
Fusion
Both lists are merged by reciprocal rank fusion (RRF): an excerpt ranked well in both moves up. The top five go to the model, numbered.
- 04
Answer with citations
The model (Llama 4 Scout) is told to answer only from the excerpts and cite each one as [n]. If the answer is not there, it says it could not find it. Citations become links to the right page and section.
- 05
Cost and privacy
Everything runs on Cloudflare Workers AI, on the free plan, with its own daily limit well below the allowance. Questions are not stored, and Cloudflare states it does not use submitted content to train models.
Parts
- Astro
- PHP
- Cloudflare Workers AI
- bge-m3
- Llama 4 Scout
- BM25
- RRF
Evaluation
A fixed set of questions, each with the page that should answer it, runs against the live system. The numbers below come from that test.
- Questions in the test
- 16
- Right page ranked 1st by the search
- 100%
- Right page among the 5 excerpts sent
- 100%
- Answer cites the right page
- 100%
- Off-site question declined
- 3/3
- Median answer time
- 5.0 s