JholaBuild carts

The model picks. Code counts.

Jhola turns one sentence into three ready-to-order grocery carts from 1,006 real Indian grocery products. A language model chooses what goes in each cart; ordinary code checks every choice and does all the maths, so the app never shows an invented product or price.

From one line to three carts

Splitting the work keeps answers fast: each cart call writes a third of the output, and all three run at the same time. Everything mechanical is done in code, where it is instant, exact and tested.

  1. Plan

    One model call reads the request and decides three genuinely different carts (by price tier, cooking style or dish), each as a plain shopping list with amounts: “paneer 400 g; tomato 500 g…”. It also reads any budget, item count or main ingredient every cart must have, and says no to things that aren't groceries.

  2. Pick products, three at once

    Three model calls run in parallel, one per cart, each mapping its list to catalog product IDs and how much of each is needed. A budget turns into a spend limit for each cart.

  3. Code does the maths

    Code turns amounts into whole packs (400 g of 200 g packs is 2) and picks the cheapest pack size that covers them (a 1 kg bag of rice for 400 g, not 5 kg). It also merges duplicate lines, swaps out-of-stock picks for a twin, marks pantry staples optional, fits carts to the budget and makes near-identical carts different.

  4. Check every rule

    Every product must exist and be in stock, quantities must be 1 to 10, budgets and counts must hold, every cart must contain the dish's main ingredient, and no two carts can share 70% of their products. Only a cart that still breaks a rule goes back to the model, once.

  5. Price from the catalog

    Prices and totals come from the catalog, never from the model, so an invented product or price can't reach the screen.

Measured, not guessed

A 30-query evaluation runs the real pipeline on recipes, meal ideas, budget and gift requests, and edge cases, and scores every answer in code. Latest run: 2026-10-25.

Valid after at most one repair
100%
every product real and in stock, every rule met
Budgets and item counts met
100%
in all three carts
Ingredients covered
97%
the key ingredients each request needs
Carts distinct
75% different
average product overlap between carts
Edge cases handled
5 of 5
sushi, a laptop, a one-word query, a long query, a prompt injection
Typical time
5.4 s
95% of answers within 8.5 s
Cost per answer
$0.017
about ₹1.5, thanks to prompt caching

Built with

The full design, the eval history and what each change improved are in the README.

  • Next.js + TypeScript

    one app for the page and the API

  • OpenAI gpt-5.4-mini

    structured JSON output, checked with Zod

  • Upstash Redis

    rate limits, a 30-day answer cache, generation log

  • Tailwind CSS

    styling, with every colour pair checked for WCAG AA

  • Vitest

    unit tests with fake model answers, no live API calls

  • Vercel

    hosting, deployed from GitHub on every push