ALL PROJECTS/HAIN AI RECIPE GENERATOR

Overview

The brief was a consumer cooking app: someone types what is in their kitchen, and the app tells them what they can make with it. That much is a single model call. What makes it a product rather than a demo is everything around that call — the person has an account, they keep the recipes they liked, they rate them, and they can take one out of the app as a file.

The harder half is the generation itself. Ask a model for a recipe from a handful of ingredients and it will give you one. Ask it three times and it will give you three near-identical versions of the same dish, because nothing told it what it had already said. Making the three answers actually differ is a design problem, not a prompting accident.

Built for an Upwork client over a short engagement in May 2024.

Problem

Three answers, not one answer three times. A single prompt run repeatedly has no memory of its own output. Without something carrying the previous answers forward, the second and third suggestions collapse onto the first, and the user is looking at one recipe wearing three hats.

A model will happily cook anything you type. Real users type the contents of their fridge, which includes things that are not food, and sometimes a finished dish rather than an ingredient. A generator with no rules about its input produces either nonsense or something genuinely unsafe.

The output has to arrive in a shape you can work with. The recipes are not just displayed — they are saved, listed, rated, and turned into documents. Every one of those needs to find the same few things in the same place, which means the structure has to be part of what is asked for, so the same few fields land in the same place every time.

System Design

How It Works

01/04
01

One prompt becomes three recipes

The core of the product — why the three answers are not the same dish restated.

  1. 1The ingredients are handed to a chain of three prompt stages
  2. 2The first stage produces a recipe from the ingredients alone
  3. 3Each later stage receives the earlier recipes and is asked for something that is not them
  4. 4A dish, a variation on it, and a third asked to depart from both
02

The kitchen is treated as messy input

What happens to the things people actually type.

  1. 1Whatever was typed is passed in as written
  2. 2Anything not fit to eat is dropped by the generation rules
  3. 3A finished dish typed as an ingredient is kept whole rather than broken down
  4. 4Only a bounded number of ingredients may be added beyond what was typed
03

A recipe becomes something you own

How a generated answer turns into a kept one.

  1. 1A recipe is saved against the signed-in account
  2. 2The save checks first whether that recipe is already there
  3. 3The saved list is read back for the signed-in account, with the ratings left on each recipe shown beneath it
  4. 4A rating can be left once per person per recipe
04

The answer leaves as a file

How a recipe leaves the app as a file of your own.

  1. 1A recipe is chosen for download, fresh from the generator or from the kept list
  2. 2It is rendered into a document as the page draws the download control
  3. 3The document is built in memory rather than written to disk
  4. 4A generated recipe leaves as a word-processor file; a kept one leaves as a PDF

Key Features

  • Three recipes from a single list of ingredients, produced by one chained generation
  • Each stage told what the previous stages produced, so each is asked to differ from the text of the ones before it
  • A per-stage allowance for invented ingredients, tightest in the middle and widest at the end
  • Input rules carried in the prompt: inedible items dropped, a named dish kept whole
  • A fixed output contract — the same named sections, in the same order, asked of every stage
  • Accounts, so the recipes someone keeps are there on the next visit
  • Saved recipes and star ratings, each guarded against duplicates at the write
  • Export in two document formats — a word-processor file for a generated recipe, a PDF for a kept one — each built in memory

Outcomes

  • Turned a single-call demo into a product: one list of ingredients returns three recipes that are not the same dish restated, because each stage is told what the ones before it produced
  • Made divergence something the design works at rather than something a repeated prompt would produce by accident, by passing earlier outputs forward as inputs and reserving the widest invention budget for the final stage
  • Handled the input real users actually give — non-food items and finished dishes — at the point of generation rather than downstream
  • Gave everything after the model a shape it could rely on by making the output contract part of the prompt
  • Kept the target deliberately narrow — one cuisine, one serving size — so three distinct answers were something the chain could realistically produce
  • Delivered accounts, saved recipes, ratings and document export around the generator, so a recipe someone liked can be kept and taken away

More work

MVP100Hours preview
AI GROWTH PLATFORM

MVP100Hours

An AI-powered lead-to-close platform — silent visitor intelligence to autonomous AI voice outreach

VIEW PROJECT