jk6653284 / llm_recipe_reco

0 stars 0 forks source link

Prompt engineering for V1 recipe reco - other reco types #6

Open jk6653284 opened 1 year ago

jk6653284 commented 1 year ago

In V1 I wanted 3 main types of recommendations:

  1. ingredient based: given list of ingredient(s), recommend recipes that include all the ingredients
  2. mood/occasion based: given a description of user's mood or a particular occasion, recommend recipes that are appropriate for the query
  3. pairing based: given a dish, recommend recipes that pair well with the dish
    • this would actually be interesting to also chain with 1 and 2, so that once user selects a dish, it could follow up with a good pairing reco

This issue contains prompt experiments for 2 and 3.

jk6653284 commented 1 year ago

Mood or occasion based

first iteration: similar to 3 of ingredient based prompt, but with different input.

user prompt:

You are a recipe recommendation engine. Your task is to give at most 5 recipes that is appropriate for user's input mood or occasion. Return the name of the recipe, type of cuisine if it exists, and a brief description of the dish. If the dish is from a particular cuisine, also include the original language name and english pronunciation of the name. If recipe is not from a specific cuisine, give back 'no specific cuisine' as cuisine type. For description, keep it concise and include things like type of dish, main ingredients, short description of the dish, why the dish is appropriate, and how the dish is typically enjoyed. Give result back in the following format:
- <recipe title> (<original language title>, english pronunciation)
- cuisine type
- description

user input: I want to bring something to an international potluck party.

result:

1. Greek Salad (Χωριάτικη σαλάτα, horiatiki salata)
- Greek cuisine
- This classic Greek dish is a refreshing and healthy mix of tomatoes, cucumbers, onion, feta cheese, and olives. It's perfect for an international potluck because it's easy to make in large quantities, and it's a crowd-pleaser that everyone will love.

2. Guacamole
- Mexican cuisine
- This flavorful dish combines mashed avocados, onion, garlic, tomatoes, and lime juice to create a dip that's perfect for chips or veggies. It's a great way to spice up a potluck with a little taste of Mexico.

3. Sushi Rolls (寿司, su-shi)
- Japanese cuisine
- Sushi rolls are a perfect finger food for a potluck party. You can make them with a variety of fillings, such as cucumber, avocado, crab or smoked salmon. It's easy to prep ahead of time, and people can enjoy a small bite or two while mingling with other guests.
jk6653284 commented 1 year ago

Recipe pairing

first iteration

One noticeable thing is that some of the recommended dishes are close to the input recipe, but are probably not the best pair. For example, given a salad, I don't want to get another salad recommendation. This is probably because 'can be served with' is quite vague.

user prompt:

You are a recipe recommendation engine. Your task is to give at most 5 recipes that can be served with user's input recipe. Return the name of the recipe, type of cuisine if it exists, and a brief description of the dish. If the dish is from a particular cuisine, also include the original language name and english pronunciation of the name. If recipe is not from a specific cuisine, give back 'no specific cuisine' as cuisine type. For description, keep it concise and include things like type of dish, main ingredients, short description of the dish, and why the dish can be enjoyed with input recipe. Give result back in the following format:
- <recipe title> (<original language title>, english pronunciation)
- cuisine type
- description

input recipe: caprese salad

result:

1. Margherita Pizza (Pizza Margherita, pee-za mar-guh-ree-tuh)
- Italian
- A classic pizza topped with tomato sauce, mozzarella cheese, and fresh basil. The simplicity of the flavors in Margherita pizza pairs perfectly with the fresh ingredients in Caprese salad.

2. Panzanella (Panzanella, pan-zuh-nel-luh)
- Italian
- A bread salad made from stale bread, tomatoes, onions, and basil. The juicy tomatoes and tangy dressing of Panzanella compliment the mild flavors of Caprese salad.

3. Greek Salad (Horiatiki Salata, hor-ee-at-ee-kee sah-lah-tah)
- Greek
- A vegetable salad made with tomatoes, cucumbers, red onion, feta cheese, and olives, dressed with olive oil and lemon. The briny feta cheese and crunchy vegetables in Greek Salad add depth to the fresh flavors of Caprese salad.

4. Grilled Chicken Caesar Salad (Caesar Salad, see-zer sah-lad)
- Italian
- A salad made with romaine lettuce, croutons, parmesan cheese, and Caesar dressing, topped with grilled chicken. The creamy dressing and grilled chicken in Caesar salad make it a satisfying accompaniment to the light Caprese salad.

5. Tomatoes Provencal (Tomates à la Provençale, toe-maht ah lah pro-vawn-sal)
- French
- A dish made by baking tomatoes with herbs, garlic, breadcrumbs, and olive oil. The herbaceous and garlicky seasoning of Tomatoes Provencal pairs well with the clean flavors of Caprese salad.

second iteration: purpose update + limit dish type

This seems to give a result that's closer to what I want. One thing I do noticed is that when it comes to describing why the dish was recommended, the reasons are downright useless. It's just a copy and paste of 'because it complements without much of an explanation'.

user prompt:

You are a recipe recommendation engine. Your task is to give at most 5 recipes that can be served with user's input recipe for a full meal. If possible, do not return recipe of same type of dish. Return the name of the recipe, type of cuisine if it exists, and a brief description of the dish. If the dish is from a particular cuisine, also include the original language name and english pronunciation of the name. If recipe is not from a specific cuisine, give back 'no specific cuisine' as cuisine type. For description, keep it concise and include things like type of dish, main ingredients, short description of the dish, and why the dish can be enjoyed with input recipe. Give result back in the following format:
- <recipe title> (<original language title>, english pronunciation)
- cuisine type
- description

input recipe: caprese salad

result:

1. Grilled Pesto Shrimp Skewers (Brochetas de camarones al pesto, BROH-cheh-tahs deh cah-mah-ROH-ness ahl PEHS-toh)
- Italian cuisine 
- These grilled shrimp skewers are brushed with a flavorful pesto sauce and are a great addition to a Caprese salad as they add a protein element to the meal. 

2. Lemon Garlic Roasted Chicken (Poulet rôti au citron et à l'ail, pOO-leh roh-tee oh see-trOHn ay ah-EE)
- French cuisine
- This roasted chicken dish is bursting with flavor from the lemon and garlic. It is a great complement to a light and refreshing Caprese salad. 

3. Vegetable Fried Rice (Biryani jaipur, bih-RYAH-nee jay-POOR)
- Indian cuisine
- This flavorful vegetable fried rice can add a heartiness to the meal and is a perfect side dish to accompany a light Caprese salad. 

4. Mediterranean Grilled Vegetables (Grigliata di verdure mediterranee, gree-lyah-tah dee vehr-doo-reh meh-deh-teh-rah-NEH-eh)
- Mediterranean cuisine 
- These grilled vegetables, including eggplant, zucchini, and bell peppers, are full of flavor and can complement the freshness of a Caprese salad. 

5. Sourdough Garlic Bread (Pan con ajo, pahn kohn AH-hoh)
- Spanish cuisine 
- This crispy, garlic sourdough bread can be a great addition to a Caprese salad for a bit of crunch and texture contrast.

3rd iteration

Changed the prompt a little to 'often served with user's input recipe', and updated the description part not to make it so useless. Getting similar results, and at least it's not 5 different salads for a salad input. One potential downside is that when the input recipe is from a specific cuisine, often the recommended dish are also from the same cuisine, which makes sense, but could lead to boring, predictable results. This prompt has this problem in particular, probably due to 'often served with' phrase.

user prompt

You are a recipe recommendation engine. Your task is to give at most 5 recipes that is often served with user's input recipe. Return the name of the recipe, type of cuisine if it exists, and a brief description of the dish. If the dish is from a particular cuisine, also include the original language name and english pronunciation of the name. If recipe is not from a specific cuisine, give back 'no specific cuisine' as cuisine type. For description, keep it concise and include things like type of dish, main ingredients, short description of the dish, and why it is served together. Give result back in the following format:
- <recipe title> (<original language title>, english pronunciation)
- cuisine type
- description

input recipe: caprese salad

result

1. Margherita Pizza (Pizza Margherita, peet-sah mah-guh-ree-tah)
- Italian cuisine
- A classic pizza featuring tomato sauce, mozzarella cheese, and fresh basil leaves on a thin crust. It is often served alongside caprese salad as they both feature similar ingredients such as tomato and basil.

2. Bruschetta (Brus-ket-ta)
- Italian cuisine
- Toasted bread topped with chopped tomatoes, basil, olive oil, and garlic. It is a perfect appetizer to serve alongside caprese salad as they both feature similar fresh ingredients like tomatoes and basil.

3. Panzanella (Pahn-zah-nella)
- Italian cuisine
- A Tuscan salad made with chunks of bread, tomatoes, onion, and basil, dressed with olive oil and vinegar. It is often served with caprese salad as they both use similar ingredients and are refreshing summer dishes.

4. Gazpacho (Gahz-pah-cho)
- Spanish cuisine
- A cold soup made with fresh vegetables such as tomatoes, peppers, onions, and cucumber, as well as olive oil and vinegar. It is often served alongside caprese salad as they both are refreshing summer dishes with similar fresh ingredients.

5. Grilled Chicken Caesar Salad
- no specific cuisine
- A classic Caesar salad topped with grilled chicken breast and served with creamy dressing made with anchovies, garlic, and Parmesan cheese. It is often served alongside caprese salad as they both make a light and tasty lunch or dinner option.