Docs
CommunityJev Cookbooks
Shopping Cart Cookbook
Runnable cookbook that turns a natural-language cafe order into a structured cart: a shrinking-options loop of Choice questions finds each item, then one batched request per item fills its known fields.
- Format
- Docs
- Reading time
- 2 min
- Published by
- Community
- Added
- Nov 23, 2026
Highlights
- Two stages: a shrinking-options loop of Choice questions finds items, then one batched request per item fills fields.
- Every item request includes a nothing_else sentinel option so the loop stops when no menu item remains.
- MAX_ITEM_REQUESTS is 6, a hard stop so a bad answer can never loop forever.
- Runs as published without an API key by replaying saved answers from cart_from_primitives_cache.json.
- Numbers came from jev-1.14.0 on 2026-10-29; the menu has four items and only the latte has fields.
Questions about this entry
Short answers drawn from the linked project or page.
Open it in Colab or run the page as a single .py file locally. Install with pip install ipython 'cooksafe>=0.3.0,<0.4.0'. The code replays saved answers, so it runs as published without an API key.
No for the published run, because the code replays cached answers. To change a request, set TYPESAFE_API_KEY; in Colab you can add it in the Secrets panel.
It repeatedly asks which remaining menu item the order mentions, removes each selected item from the next request's options, and sends the full order again with the shorter option list. The loop stops when Jev selects nothing_else.
Once the items are known, each found item gets one request with a Choice question per known field. The latte has size and milk fields; the blueberry muffin has no fields, so it needs no field request.
MAX_ITEM_REQUESTS is set to 6, described as a hard stop so a bad answer can never loop forever.
The numbers came from jev-1.14.0 on 2026-10-29. TYPESAFE_MODEL is set to jev-1.14.0, and jev-latest runs the newest model live.
It runs on a small four-item cafe menu and one hard-coded order, so it demonstrates the shrinking-options loop and field-filling pattern rather than a general cart system.
From the Jev guides
Original write-ups on what this entry is for.
From the Jev AI model community
Posts from builders shipping with Jev right now.