Reda Makhchan

Portfolio · Ask the Chef

Ask the Chef: an AI recipe assistant that only recommends real recipes

Recipe sites have thousands of recipes, but visitors don't search like a database. They ask "quick chicken dinner, no dairy" or "what can I make with rice, lemons and eggs?". I built Ask the Chef to answer those questions with recipes that really exist on the site. It reads the recipes from NextPress, my publishing platform, indexes them by meaning, and answers through Claude or OpenAI. Diet rules and time limits are hard filters, and every link is checked, so it never invents a recipe. It runs as a live demo, and any site can add it with one script tag. The site's name stays confidential.

Role
Solo: retrieval design, back end, widget, guardrails, DevOps
Timeline
November 2026 to today (live demo since December 2026)
Data
2,289 published recipes from a live recipe website
Type
RAG chatbot, embeddable chat widget
The Ask the Chef chat panel answering a follow-up question with three spicy chicken recipe cards
A follow-up ("make it spicy") keeps the "no dairy" filter

In numbers

recipes searchable by meaning
2,289
average AI cost per question
< 1¢
automated tests
109
languages, including Arabic (RTL)
3

The challenge

A chatbot that "knows recipes" is easy to fake and dangerous to get wrong. A general AI model invents dishes, links to pages that don't exist, and treats "no dairy" as a suggestion. For a food site, one cream recipe sent to someone who asked for dairy-free is worse than no answer.

It also had to stay cheap and safe as a public demo: anyone on the internet can type into it, every question costs money, and the site's own code could not change. The only thing the host site adds is a script tag.

What I built

  • Plain-language questions

    Visitors ask the way they talk: an ingredient they have, a diet, a time limit, a mood ("something warm for a cold night"). Follow-ups such as "make it vegetarian" keep the earlier filters.

  • Real recipes only

    The answer recommends only recipes the search found, shown as cards with photo, cooking time and link. If nothing fits, it says so and offers the closest options.

  • Three languages, right to left

    Questions and answers in English, French and Arabic. The widget switches to a mirrored right-to-left layout for Arabic.

  • One script tag

    A 6 KB widget in a Shadow DOM, so the host site's CSS can't break it. It works on WordPress, Shopify or a custom site, with options for brand colour, language and light mode.

  • Recent chats, no account

    No sign-up and no cookies. The last six chats stay in the visitor's own browser for seven days and can be reopened or deleted.

  • Click tracking

    Each card click is recorded against the question that led to it, so the site owner sees which questions bring readers to which recipes.

Under the hood

  • Hybrid search in one query

    Postgres with pgvector: the embedding decides the order, and SQL decides what is allowed. Excluded ingredients, must-have ingredients and time limits are hard filters, and an HNSW iterative scan keeps returning five results even under strict filters.

  • Plan, search, then answer

    The model first turns the message into a structured JSON search plan, which code checks again. Code runs the search, and the model then writes a streamed answer from those results only. The model never writes SQL, and diet words map to fixed ingredient rules.

  • Grounding check

    Every link in the answer is compared with the recipes the search returned. Anything else is flagged, and only real hits become cards.

  • Claude or OpenAI, one setting

    Both providers sit behind the same interface, with the same prompts, schema and checks. Switching is one environment variable, and cost is logged per call with each provider's own prices.

  • Cheap to keep in sync

    A nightly sync fingerprints each recipe and re-embeds only new or changed ones. The first full sync embedded 2,289 recipes (333,442 tokens) for free on Voyage AI.

  • Guardrails and delivery

    Per-visitor limits on a salted IP hash, a daily spending cap, a CORS allowlist and input limits. 109 automated tests (Vitest, with a real pgvector database) plus Playwright browser tests, and a 31-question eval set for the answers. GitHub Actions deploys to a Linux VPS (PM2, nginx, Cloudflare). I work with Claude Code as an assistant and review every change.

Tech stack

  • Next.js
  • TypeScript
  • PostgreSQL + pgvector
  • Voyage AI
  • Claude
  • OpenAI
  • NGINX
  • GitHub Actions

Contact

Need a product like this?

Tell me who is learning and what you'd like to achieve. I usually reply within 24 hours.

Chat on WhatsApp