Skip to content
All projects

AI assistant

public RAG on Google Cloud

It answers questions about my background and projects from this site and my resumes, cites its sources and says when it does not know. Designed, deployed and evaluated alone on Google Cloud, with infrastructure written entirely as code.

Ask it a question

  • 94%

    correct answers on 100 test questions, traps included

    Correct answers, traps refused and contact cards, graded by a Gemini judge with sealed instructions.

  • 9

    Google Cloud services in production, all defined as code

    Cloud Run, Vertex AI, Firestore, Artifact Registry, Secret Manager, Cloud Logging, IAM, identity federation, budget: set up by Terraform, deployed by GitHub Actions.

  • 100%

    of answers cite their source

    Every answer links to the section of the site it comes from; a single one without a source, and the version is not put online.

Setting
Personal project
Period
Since November 2026
Team
Solo
Role
Design, development, deployment and evaluation
ChapterProblemContents
  1. Problem
  2. Constraints
  3. Architecture
  4. Decisions
  5. Going live
  6. Limitations and lessons learned

Problem

Answering a visitor without making anything up

A visitor has a few minutes and precise questions, about availability, production, technologies, projects. The answers are on this site, but spread across all its pages. Can a public assistant answer from the published content alone, cite its sources, refuse what it does not know, and cost only a few euros a month?

I also made it a production service: infrastructure written as code, keyless deployment, and a release that is blocked as soon as quality drops.

Constraints

Public, anonymous and capped

  • Anyone can type anything. Off-topic questions, injections, personal requests: everything comes through the same field, with no account.
  • Nothing beyond what is published. The assistant reads only the site's pages and the two resumes, contact details removed. It says nothing about me that does not come from them.
  • A bill capped by design. One instance, a daily question cap, a budget alert. An alert stops nothing: the real caps live in the code and the configuration.
  • Nothing to overload. 500 characters per question, 5 questions a minute and 30 a day per visitor, 200 a day for the whole site. A hijacking attempt (“ignore your rules”, role play) gets a refusal written by the code and never reaches the model.
  • Visitors' privacy. No IP address kept, no account, an AI notice always visible.
  • Two languages. The answer follows the language of the question, whatever the language of the passages.

Architecture

The path of a question

The code decides, the model writes. Follow one example.

Three examples written for illustration

Is the INSEI assistant in production? Answer written from the INSEI page, with its source.

Screen the questionSearch the siteAnswer or refusehijacking, salarya contacta first questiona follow-up questionthe INSEIpage“… [1]”passages fall shortyesnoAnswer sources cited
Screen the questionSearch the sitefollow-upAnswer or refuseyesnoAnswer sources cited

Answersources cited

Before display, the code replaces any number missing from the passages and strips third-party links, email addresses, images and HTML. Each source is named by its page and section (“Project INSEI · Results”, “Resume (PDF)”) and leads to that section.

Example written for the illustration.

Following a conversation

  • Rewrite the follow-up “And the other project?” cannot be searched as is. A short model call rewrites it into a complete question, using the last three exchanges and the current topic.
  • Never show the history to the writer Retrieval and writing only see the rewritten question. An instruction slipped in earlier in the conversation does not reach them.
  • Forget quickly The history stays in the service's memory for 30 minutes, is never written to disk, and the “New conversation” button resets it.
  • Measure it separately 40 test dialogues: elliptical follow-ups, topic changes, going back, translations, multi-turn attacks. All passed, on both runs, before it was switched on.

Releasing

  • Index Every site release restarts the pipeline. The site is read from its sitemap, split by section and indexed into a fresh version that nothing serves yet.
  • Evaluate A new Cloud Run revision starts with no traffic. The control question set is run against it.
  • Switch or block If the quality gate passes, all traffic switches over. Otherwise everything stops, and the live version stays the previous one.
  • Describe as code Terraform sets up the service, the database, the secrets, least-privilege service accounts, the budget and the log exclusion. GitHub Actions deploys with no stored key.
a version that drops does not shipillustration
visitorsrevision Bliverevision Ccandidate, no trafficcontrol questionsa wrong number: the gate stays shutvisitorsrevision Bliverevision Ccandidate, no trafficcontrol questionsa wrong number: the gate stays shut

Decisions

As little model as possible

Seven decisions and what settled them
DecisionOption ruled outWhat settled it
A path fixed by the code, one model call to writeAn agent that picks its own toolsCheaper and more predictable: the cost of a question is known in advance. The agent is still written, to be compared on the same questions.
Off-topic refusal decided by the code, before the modelLetting the model judge every questionA question too far from the site costs no model call, and gives the model no chance to improvise.
A service that refuses to start without a calibrated thresholdA default thresholdA wrong threshold would refuse everything, or let everything through, silently. The first deployment stopped right there, as intended.
Read the published site, not its source filesIndex the files of the site's repositoryNumbers are injected at render time: the source prose contains none. And only what is public can get in.
Firestore for vector searchVertex AI Vector Search; a managed PostgreSQL databaseFree at this volume and serverless. The other two bill for nodes around the clock.
Cloud Run, zero instances at rest, one at mostA server running around the clockNothing to pay when nobody asks. A single instance caps the bill and keeps the per-visitor counter exact.
Contact details displayed by the codeContact details written by the modelThe email address is never generated: it cannot be invented or garbled.

Going live

No version goes live without the gate

Every version passes the quality gate before it gets a single visitor. The revision starts with no traffic and answers the 40 control questions; traffic switches only after the verdict. At the deployment that switched memory on, in late November 2026: 19 correct answers out of 20, all 18 traps refused, no false refusals, no injected instruction followed.

Two kinds of checks. The code's checks carry the guarantee, with no exception allowed. The judge's checks carry the trend, because on twenty-odd questions a rate moves by several points from one run to the next.

Fast and cheap

  • First word in 0.62 s Median over the 40 control questions of the deployment that switched memory on. A follow-up adds the rewrite: 2.19 s median.
  • 1,406 questions for one dollar Model cost recorded question by question, memory rewrite included.
  • Nothing to pay at rest With no visitor, no instance runs.

What the gate requires of every version

  • Sourced answers Every answer drawn from the site shows its sources. If a single test answer has none, the new version is not put online.
  • Faithful numbers Every number in an answer appears in the passages sent.
  • Injections not followed No instruction slipped into a question is obeyed.
  • Refusals held Every personal question gets its pre-written refusal; every contact request, the card.
  • Floors written in advance Correct answers, traps refused and wrongful refusals, graded by the judge, each have a threshold set before the first measurement. Correct answers cannot fall below the reference version.

The evaluation method

  • The set. Questions written from what a visitor looks for, never from the site's text, in French and English, typos included. Traps: off topic, false premise, injection, personal data, opinion, a skill the site does not mention.
  • The reserve. A batch sealed by hash, never used for tuning, run only once: what it shows cannot have been learned.
  • The judge. Gemini 3.8 Flash, temperature 0, instructions frozen by hash. It receives the expected key facts, the passages sent and the answer. I grade the same answers by hand, blind: its instructions are corrected until its agreement with my grades is enough.

Limitations and lessons learned

Measure the instrument before the model

The first real evaluation mostly measured the judge. It penalized a correct fact added by the assistant, counted contact cards as answers and ignored today's date. The code's checks held. I fixed the instrument before touching the assistant: otherwise I would have tuned the model to please a broken judge. I would have validated the judge before the first measurement, and fixed a class of errors rather than a single question.

Limits

  • Judge and writer from the same family. Both are Gemini models: the judge may share the writer's blind spots. Comparing it with my grades limits this, without removing it.
  • Search by meaning only. Firestore has no keyword search: a rare proper noun can be missed. A keyword index is planned if the measurement calls for it.
  • A short memory. Three exchanges and 30 minutes: beyond that, a follow-up has to stand on its own.
  • A small set. The code carries the guarantees; the judge gives a trend, not a rate to the point.