The prompt
Step 1, system instruction:
Your task is to extract to a list all the groceries with its quantities based on the provided recipe.
Make sure that groceries are in the order of appearance.
Step 2, system instruction:
You are given a list of groceries. Complete the following:
- Organize groceries into categories for easier shopping.
- List each item one under another with a checkbox [].
Step 2, user prompt:
LIST: 3 tomatoes, 1 turkey, 4 tomatoes
OUTPUT:
## VEGETABLES
- [ ] 7 tomatoes
## MEAT
- [ ] 1 turkey
LIST: {list from step 1}
OUTPUT: What it is
A two-step chain: extract groceries and quantities from a recipe, then sort them by category into a checkbox shopping list with a small format example. The source uses it to show information extraction in a defined structure. The prompt text comes from the Google Gemini API cookbook (Apache-2.0, Copyright 2026 Google LLC). Changes we made: The three strings are joined with step labels we added, and {grocery_list.text} is renamed {list from step 1}. Original author: Google (google-gemini/cookbook).
Who it's for
- Home cooks
- Developers learning prompt chaining
سلسلة من خطوتين: استخراج المشتريات وكمياتها من وصفة، ثم ترتيبها حسب الفئة في قائمة تسوق بمربعات اختيار وفق مثال تنسيق صغير.
Examples
Shopping list output (excerpt)
Prompt## VEGETABLES
- [ ] 3 garlic cloves
- [ ] knob of fresh ginger
- [ ] 3 spring onions
- [ ] 20 button mushrooms
- [ ] 20 cherry tomatoes
- [ ] 2 large red peppersExpected output: From the output printed in the source for a chicken kebab recipe.
Tips
- The source says complex tasks work better when divided into separate steps.
- It gives a couple of format examples (few-shot prompting) so the model follows your list format.