Grocery shopping list struggles

hey guys
I want to feed it a long list of items on sale at my local supermarket (about 5000 tokens) and ask it to create a list of grocery items based on certain criteria.

But it failed. Anyone knows how to do this?

Yesterday, I’ve feed it a shorter list, maybe 1000 tokens, and it does a much better job but with more data today it’s struggling. :frowning:

Hi there! Could you share details of your prompt? Otherwise it‘s a bit difficult to pinpoint potential root causes :grimacing:

Prompt 1: you’re a nutritionist, I will provide you a long list of grocery items on sale at my super market. your job is to go through this list and provide me some recommendations for a meal plan for the up coming week. I want each meal to be healthy and nutritious and each to fill an adult or child. got it?

Prompt 2: paste in a grocery details

Prompt 3: I want a meal plan for a family of 4, 2 adults and 2 children age 10 and 5. I want each meal to be nutritious and healthy. we have a budget of $50 per day, I want you to come minimise the cost whenever possible, take advantage of the two for $X deal and any special offers. take into account not just the cost but how much quantity we are getting for that product. e.g. if one product cost $10 but it’s for 2kg vs 1 product cost $7 but for 1kg, obviously the $10 is a better deal so take this into consideration. ideally I want to stay under budget. create this for first 3 days in step one then next 4 days in step two

ChatGPT: Certainly! With your budget and preferences in mind, I’ll create a nutritious and cost-effective meal plan for your family for the first three days. I’ll make sure to use the “two for” deals and consider the quantity-to-price ratio for better value.

Let’s start with the meal plan for the first three days:

Day 1:

  • Breakfast:
    • Scrambled eggs with spinach and mushrooms (using the Coles Free Range Eggs and the Coles Sliced Mushrooms).
    • Wholemeal toast (using the Tip Top Thins Wholemeal 6 Pack, pick any 2 for $6, so we get another pack for later).
  • Lunch:
    • Chicken wraps with Caesar salad (using Coles RSPCA Approved Chicken Tenderloins and Coles Kitchen Caesar Salad Kit, pick any 2 salad kits for $9, so we can use another one for dinner another day).
    • Sliced apples on the side (using the Coles Pink Lady Apples 1kg).
  • Dinner:
    • Beef and vegetable stir-fry (using Coles Beef & Pork Meatballs and a mix of Coles Baby Broccoli, Coles Washed Potatoes, and Coles Fresh Loose Cup Mushrooms).
    • Brown rice (stock from pantry).
  • Snacks:
    • Banana muffins (using the Coles Banana Muffins, pick any 2 for $8, saving one pack for another day).
    • Fresh fruit salad (using the Coles White Seedless Grapes, Coles Black Plums, and remaining Coles Pink Lady Apples).

Day 2:

  • Breakfast:
    • Greek yogurt with mixed berries (using Coles Raspberries and any plain Greek yogurt, stock from pantry).
    • Hot cross buns (using Coles Hot Cross Buns Traditional Fruit, pick any 2 for $6).
  • Lunch:
    • Ham and cheese sandwiches (using Coles Free Range Pork Loin Medallions thinly sliced, with the other pack of Tip Top Thins Wholemeal from breakfast Day 1).
    • Carrot and cucumber sticks (stock from pantry).
  • Dinner:
    • Lemon-baked fish with a side salad (using Coles Deli Thawed Basa Fillets, Coles Medium Lemons, and Coles 4 Leaf Salad Mix, pick any 2 salad bags for $4.50, using the second one).
  • Snacks:
    • Sliced cucumbers and hummus (stock from pantry).
    • Medjool dates (using Coles Medjool Dates).

Day 3:

  • Breakfast:
    • Oatmeal with sliced bananas and honey (oats and honey, stock from pantry).
    • Toasted muffins with butter (using the remaining pack of Coles Hot Cross Buns Traditional Fruit).
  • Lunch:
    • Turkey and salad sandwiches (using leftover Coles Free Range Pork Loin Medallions as turkey alternative, and Coles Baby Leaf Salad Mix).
    • Avocado (using Coles Shepard Avocados).
  • Dinner:
    • Roast chicken with vegetables (using Coles RSPCA Approved Free Range Chicken, Coles Wrapped Butternut Pumpkin, and any remaining vegetables).
    • Quinoa or couscous (stock from pantry).
  • Snacks:
    • Apple slices with peanut butter (stock from pantry).
    • Leftover fruit salad from Day 1.

For each day, I’ve taken advantage of the “two for” deals, focused on getting more for the money where possible, and used items across multiple meals to reduce waste and cost. The specific prices of each item aren’t provided, but I’ve made choices to keep the total cost under your daily budget of $50, considering the meals will share many common ingredients. I’ll adjust and create the plan for the next four days once we review this initial plan.

Prompt 4: your plan above is missing a lot of data, you need to show me the cost of the item and is there enough to serve 4 people? you need to break down each item, the cost and figure out if the quantity that you’re suggesting is enough to feed 4 people, if not, you need to increase the quantity


Understood, let’s break it down with cost and quantities for the first three days to ensure there’s enough food for four people and that we stay within budget.

Day 1:

  • Breakfast:
    • Scrambled eggs with spinach and mushrooms:
      • Coles Free Range Eggs (assuming a dozen from stock): $4.00 (est.)
      • Coles Sliced Mushrooms 200g: $4.00 (pick any 2 for $6.50, we’ll use the second pack later)
      • Coles Baby Spinach 120g: $3.00 (pick any 2 for $4.50, second one for salads)
      • Tip Top Thins Wholemeal 6 Pack: $3.00 (part of pick any 2 for $6 deal, other pack for Day 2)
  • Lunch:
    • Chicken wraps with Caesar salad:
      • Coles RSPCA Approved Chicken Tenderloins 600g: $10.00 (one pack enough for 4 wraps)
      • Coles Kitchen Caesar Salad Kit 290g: $5.50 (pick any 2 for $9, other for Day 2 lunch)
  • Dinner:
    • Beef and vegetable stir-fry:
      • Coles Beef & Pork Meatballs 560g: $8.00 (enough for 4 servings)
      • Coles Baby Broccoli: $2.90 (1 pack should suffice)
      • Coles Washed Potatoes 2kg: $5.50 (we’ll use 1kg for this meal, the rest on Day 3)
      • Remaining Coles Sliced Mushrooms from breakfast
  • Snacks:
    • Banana muffins:
      • Coles Banana Muffins 9 Pack: $4.70 (pick any 2 for $8, second pack for Day 3)
    • Fresh fruit salad:
      • Coles White Seedless Grapes approx 800g: $3.60
      • Remaining Coles Pink Lady Apples from 1kg: $4.50

Total for Day 1: $47.70

Day 2:

  • Breakfast:
    • Greek yogurt with mixed berries:
      • Coles Raspberries 125g: $4.00
      • Greek yogurt (assuming a 1kg tub from stock): $5.00 (est.)
    • Hot cross buns:
      • Coles Hot Cross Buns Traditional Fruit 6 pack: $4.00 (second of the 2 for $6 deal from Day 1)
  • Lunch:
    • Ham and cheese sandwiches (using the other pack of Tip Top Thins Wholemeal from Day 1)
  • Dinner:
    • Lemon-baked fish with a side salad:
      • Coles Deli Thawed Basa Fillets approx 200g each: $1.60 x 2 = $3.20 for 400g
      • Coles Medium Lemons 5 Pack: $3.50 (using 2 lemons, rest for Day 3)
      • Coles 4 Leaf Salad Mix 200g: $3.00 (second of the pick any 2 for $4.50 from Day 1)
  • Snacks:
    • Medjool dates:
      • Coles Medjool Dates loose approx 200g: $4.40

Total for Day 2: $24.10 + leftover from Day 1 ($2.30) = $26.40

Day 3:

  • Breakfast:
    • Oatmeal with bananas and honey:
      • Oats (from stock): $2.00 (est.)
      • Remaining bananas from Coles Banana Muffins pack.
      • Honey (from stock): $1.00 (est.)
  • Lunch:
    • Turkey and salad sandwiches:
      • Remaining pork loin medallions from Day 1: $0.00 (already accounted for)
      • Coles Baby Leaf Salad Mix 120g: $3.00 (pick any 2 for $4.50 with another mix)
  • Dinner:
    • Roast chicken with vegetables:
      • Coles RSPCA Approved Free Range Chicken approx 1.6kg: $8.80 (whole chicken for the family)
      • Remaining Coles Washed Potatoes from Day 1: $0.00 (already accounted for)
      • Coles Wrapped Butternut Pumpkin approx 700g: $1.05
  • Snacks:
    • Remaining Coles Banana Muffins from Day 1: $0.00 (already accounted for)

Total for Day 3: $15.85 + leftover from Day 2 ($23.60) = $39.45

The budget for three days totals to approximately $113.55, averaging about $37.85 per day, which is under the $50 daily budget. This includes taking advantage of multi-buy deals and assuming that certain staple items like eggs, oats, and honey are in stock or are purchased as part of pantry staples. If they need to be purchased, the costs could be slightly higher. Some of the larger items, like the 2kg potatoes and 1.6kg chicken, are spread over multiple meals, ensuring enough quantity to feed four people. Let’s proceed with this plan for now, and I can then plan out the next four days.

I think it struggle with the budgeting aspect of it. Splitting an item over multiple days makes it hard for it to keep track? If you do the maths on the daily budget, it doesnt adds up lol
Plus it hallucinate about what’s left over. On day 3, it said there’s left over pork loin from day 1

Nice prompt you got there, but I’m afraid you are on spot here. GPT4 is not exactly good at math and it has become very very lazy, so the amount of data you are feeding it with your prompt will most likely make it hallucinate. I’d give Claude 3 Opus a try for probably better results.

Thanks. It’s difficult to make a reliable test without an actual or synthetic data set of the size you were referring to. That said, I did do some adjustments to your prompt and based on a test of a small set of items using GPT-4, I got decent results. Where I was essentially going with this is that I forced it to break down the cost and ingredients at an even more granular level and to separate out the calculation part in the hopes that this would reduce errors. Given the lack of a larger data set I obviously can’t say this will hold up but it might just give you an additional idea on how to approach it.

Here’s the main prompt I used:

You are a nutritionist, Your task is to prepare a recommendation for a meal plan for the upcoming week based on the provided ingredients.

Conditions and constraints for the meal plan are as follows:

  1. The meal plan is for a family of four, consisting of two adults and two children age 10 and 5.
  2. The meal plan must be healthy and nutritious and must ensure that all individuals get filled up.
  3. There should be three meals per day (breakfast, lunch, dinner).
  4. The goal is to minimize cost and stay below the daily budget of USD 50.
  5. Where possible, you take advantage of deals such as buy two for USD X or other special offers
  6. You furthermore take into account the cost - quantity ratio, e.g. a product of 2kg for USD 10 is preferable over a product of 1kg at USD 7

Your output consists of a list of meals for three full days. The list must containt the type of meal (i.e. breakfast, lunch, dinner), the proposed meal and associated ingredients, the quantities and costs associated with the ingredients. Additionally you must calcuate the full cost for the day.

An example output for one day then looked as follows (I noted one inconsistencies here but rest looked fine):

Day 1

  • Breakfast: Oatmeal with sliced bananas and honey.
    • Ingredients: Oats (1 bag) - $4.54, Bananas (3 lb) - $5.26 (using 1 lb), Honey (assume a pantry item).
    • Cost: $4.54 (oats) + $1.75 (bananas, approx) = $6.29
  • Lunch: Turkey and cheese sandwiches with lettuce, and carrot sticks on the side.
    • Ingredients: Bread (2 bag) - $5.78, Turkey (1 lb) - $7.63, Cheese (2 pack) - $6.29, Lettuces (1 lb) - $2.86, Carrots (1 lb) - $1.51.
    • Cost: $5.78 (bread) + $7.63 (turkey) + $3.15 (cheese, half pack) + $2.86 (lettuce) + $1.51 (carrots) = $20.93
  • Dinner: Grilled chicken breasts with quinoa and steamed broccoli.
    • Ingredients: Chicken Breasts (3 lb) - $4.78, Quinoa (3 bag) - $7.09, Broccoli (3 lb) - $4.38 (using 1 lb).
    • Cost: $4.78 (chicken) + $7.09 (quinoa) + $1.46 (broccoli, approx) = $13.33

Total Day 1 Cost: $6.29 (breakfast) + $20.93 (lunch) + $13.33 (dinner) = $40.55

This is quite the prompt here. Very detailed as well. With the current state of OpenAI’s model, have you considered moving this into a custom GPT instead of a single prompt? You might have a better time getting the results you want.

My suggestion would look something like this;

Step #1

Create a new custom GPT..

Step #2

Start with converting your list of items into a CSV, or excel doc with all the tabled data on your ingredients, weight, cost, etc… Then, upload that CSV into your GPT as a “source of knowledge.”

Step #3

Give your custom GPT some instructions outlining a procedure of what you want the GPT to do. In your case something like…

GPT’s Instructions:

You're a nutritionist. It's your goal to create a weekly meal plan based on a list of grocery items, and provide me recommendation for a weekly meal plan. You have access to the ingredients.xls file, which provides info on what ingredients, their cost, and their weight is you have at your disposal. The meal plan details should align with the following requirements:
- It must feed a family of 4. Use this when considering how many calories a given food item has.
- It must stay under a budget of $50/day in total
- Take into account the weight of the item (in kg) and the price. Always assume the cheaper-per-kg is the better option."
- *Other details your GPT should consider....*

<Objective & Procedure>
Always follow this procedure when creating your meal plans:
1. Assess and understand what ingredients and their details you have at your disposal.
2. Create each meal plan one day at a time, ensuring it matches the requirements listed.
3. Once you've completed a first pass of the proposed meal plan, double check your work.
4. Provide a table of all the ingredients you've used so they have a nice shopping list. Include the individual prices, and a total price for the shopping list.
5. Create and provide a table, broken down by day including a breakdown of what meals will be created on those days, and which ingredients will be used.
6. Ask the user for input once you've provided your tables, and work with them to make adjustments or improvements.

In summary, what you’re doing here is giving the GPT some context in the shape of “data” vs just a long list of items. This’ll reduce the total token count the GPT is using in the context window, and I’ve found tends to get the model to behave better when working on data sets if your prompt follows a framework, and you upload the data in a table or some structured way.

In my example, I’ve used a simplified version of the COSTAR prompting framework. More on that here if you’re interested.

have you tried this for more than 1 day? I think it does ok for 1 day but to do it for 3 days, it struggle. The problem with planning this out is that it doesn’t know how much food is needed per person and how much is left over. I think we have to give it very detail instructions e.g. like a bag of bread is enough to make 10 sandwiches, this is enough for 5 people (in your example, it assume that a bag of bread is only enough for 2 people).

Hey yes - I did do for all three days in one go; the first one was just posted as example of the three.

Here’s the rest of the output for reference. I have not had the chance to review everything in detail but on the surface it looked like it was right.

Day 2

  • Breakfast: Yogurt with blueberries and honey.
    • Ingredients: Yogurt (3 pack) - $6.72, Blueberries (2 lb) - $4.37 (using 1 lb), Honey (assume a pantry item).
    • Cost: $6.72 (yogurt) + $2.19 (blueberries, approx) = $8.91
  • Lunch: Tuna salad (canned tuna, assumed pantry item) on top of a bed of mixed greens (lettuce and cucumber) with crackers on the side.
    • Ingredients: Lettuces (1 lb) - $2.86, Cucumbers (1 lb) - $8.70 (using half), Crackers (2 box) - $5.75 (using one box).
    • Cost: $2.86 (lettuce) + $4.35 (cucumber, half) + $2.88 (crackers, half box) = $10.09
  • Dinner: Pasta with a tomato and ground beef sauce and a side of steamed carrots.
    • Ingredients: Pasta (1 bag) - $5.57, Tomatoes (2 lb) - $5.58 (assuming pantry items for sauce), Ground Beef (3 lb) - $6.99 (using 1 lb), Carrots (1 lb) - $1.51.
    • Cost: $5.57 (pasta) + $2.79 (tomatoes, half) + $2.33 (beef, approx) + $1.51 (carrots) = $12.20

Total Day 2 Cost: $8.91 (breakfast) + $10.09 (lunch) + $12.20 (dinner) = $31.20

Day 3

  • Breakfast: Scrambled eggs with toast and orange juice.
    • Ingredients: Eggs (1 pack) - $3.19, Bread (2 bag) - $5.78 (using half), Juice (1 bottle) - $2.22.
    • Cost: $3.19 (eggs) + $2.89 (bread, half) + $2.22 (juice) = $8.30
  • Lunch: Cheese and vegetable quesadillas (using tortillas, assumed pantry item) with salsa (assumed pantry item).
    • Ingredients: Cheese (2 pack) - $6.29 (using half), Peppers (1 lb) - $7.95 (using half), Tomatoes (2 lb) - $5.58 (using half for salsa).
    • Cost: $3.15 (cheese, half) + $3.98 (peppers, half) + $2.79 (tomatoes, half) = $9.92
  • Dinner: Baked salmon fillets with rice and frozen peas (assumed pantry item).
    • Ingredients: Salmon Fillets (2 lb) - $1.68, Rice (1 bag) - $8.85 (using half), Frozen Peas (assumed pantry item).
    • Cost: $1.68 (salmon) + $4.43 (rice, half) = $6.11

Total Day 3 Cost: $8.30 (breakfast) + $9.92 (lunch) + $6.11 (dinner) = $24.33