case study
Ask the portfolio: a retrieval-augmented answering app
My role: I built this in 2026 as a demonstration. It is not client work; the source is public.
Scope and constraints
- Ownership
- A solo demonstration. Not client work.
- Scale
- Passages drawn from the case studies.
- Constraints
- No API key required, a small function bundle for the included free-tier Azure template, and no guessing when the site has no answer.
What was delivered and checked
- Right page first for 10 of 12 test questions with keyword search and 11 of 12 with vector search, right page in the top three for 12 of 12 with both, and 3 of 3 off-topic questions refused with both. A smoke test, not a benchmark.
- 14 unit tests, including a model failure and a timeout.
- Azure template build: a 180 KB static site and an 824 KB function bundle, with the native embedding runtime left out. Not deployed or validated against Azure.
What it is
This is a demonstration of retrieval with refusal: a question box that answers only from the case studies on this site, citing the passages it used. It exists to show retrieval-augmented generation (finding the relevant text first, then answering only from it) on a corpus that can be checked by hand.
What does the sample service do when a step fails?
It retries the failed step once, then tells the visitor in plain words and keeps their draft 1. Each retry is written to a log that is reviewed later 2.
Sources used: 2
1Sample page A, section 2
A failed step is retried once before the visitor is told.
2Sample page B, section 4
Every retry is logged, and the log is reviewed on a schedule.
What is the weather in the sample city today?
I could not find that on this site.
Refused: no passage cleared the threshold. Sources: none
How it works
- Case-study pagesSplit by heading into short passages.
- Embed locallyAn open model, no API key.
- Question arrivesChecked, rate limited, embedded the same way.
- Retrieve and checkClosest passages; below the threshold, refuse.
- Answer with citationsThe passages themselves, or a model that may use only them.
Question: What happens when a step fails?
Sample data- Sample page A, section 20.82 Clears, cited 1
- Sample page B, section 40.71 Clears, cited 2
- Sample page C, section 10.48 Below
- Sample page D, section 30.31 Below
Similarity threshold, sample value 0.60.
Two passages clear it and go to the answer. If none cleared it, the reply would be a refusal with no sources.
Embeddings run locally
The passages and the question are embedded (turned into numbers that capture meaning) with an open model in Node, so retrieval works without an API key, costs nothing per question and sends no site content to a third party.
It still works when the model cannot load
If the embedding model is unavailable, search falls back to BM25 keyword ranking with its own threshold. The included Azure template sets this keyword path, because its function bundle leaves out the embedding runtime.
It says when it does not know
If no passage clears the similarity threshold, the answer is a plain "I could not find that on this site" and no sources are shown, instead of a guess.
The language model is optional and constrained
With a key set, the numbered passages go to any OpenAI-compatible chat endpoint, constrained to those passages. A provider error or timeout falls back to search-only.
A guarded API route
The route validates the question and is rate limited.
Azure deployment templates included
The repository includes a Bicep template and a GitHub Actions workflow for Azure Static Web Apps. The workflow runs the tests before deploying, and the build leaves the native embedding runtime out, which keeps the function bundle to 824 KB next to a 180 KB static site, with keyword search. The template and workflow have been written and the build checked, but not deployed or validated against Azure.
What I measured
12 on-topic and 3 off-topic questions against passages from the case studies:
| Search | Right page first | Right page in top 3 | Off-topic refused |
|---|---|---|---|
| Vector | 11 of 12 | 12 of 12 | 3 of 3 |
| Keyword (BM25) | 10 of 12 | 12 of 12 | 3 of 3 |
The question set is small. The BM25 stop words and thresholds were tuned against an earlier version of it, and the questions were then rewritten for the current pages without further tuning, so treat these figures as a smoke test, not a benchmark. The two keyword misses and the one vector miss at rank 1 still have the right page in the top three.
Not measured: answer quality from a real language model (no key was used) and latency under load.
Source
The app runs locally; there is no hosted demo. The source and tests are public in the ask-the-portfolio repository on GitHub under the MIT licence. The corpus is built from the pages of this site, and the evaluation is run with npm run eval.
Stack
- Nuxt 4
- Vue 3
- TypeScript
- Transformers.js
- Vitest
Azure Static Web Apps (template)