Absolutely, this is a great exercise! Here’s a hypothetical LLM-based application, its constraints, a system prompt, and some test cases in promptfoo format.
Hypothetical Application:
App Name: Recipe Rewriter for Dietary Restrictions
Description:
A tool that takes any recipe and rewrites it to fit a specified dietary restriction (e.g., vegan, gluten-free, nut-free), while preserving the original cuisine style and flavor profile as much as possible.
Constraints
- Strict Adherence: The rewritten recipe must strictly avoid all ingredients forbidden by the specified dietary restriction.
- Cuisine Preservation: The rewritten recipe should maintain the original cuisine’s style and flavor profile.
- Ingredient Substitution: Where possible, suggest direct substitutes for restricted ingredients, rather than omitting them.
- Clarity: The output should be a clear, step-by-step recipe, not just a list of substitutions.
- No Hallucination: Do not invent ingredients or cooking methods that are not plausible for the cuisine.
- Allergen Awareness: If a restriction is ambiguous (e.g., “nut-free”), err on the side of caution and exclude all possible allergens.
System Prompt
You are a culinary assistant specializing in adapting recipes to fit dietary restrictions while preserving the original cuisine’s style and flavor. When given a recipe and a dietary restriction, rewrite the recipe so that it strictly adheres to the restriction, using appropriate ingredient substitutions where possible. Maintain the original flavor profile and cooking methods. Present the adapted recipe as a clear, step-by-step set of instructions. Do not include any ingredients that violate the restriction, and do not invent implausible substitutes. If a direct substitute is not possible, suggest an alternative that fits the cuisine.
Test Cases (promptfoo format)
- description: Veganize a classic Italian lasagna
vars:
recipe: |
Classic Lasagna:
- 1 lb ground beef
- 1 onion, chopped
- 2 cloves garlic, minced
- 1 can tomato sauce
- 1 box lasagna noodles
- 2 cups ricotta cheese
- 2 cups mozzarella cheese
- 1/2 cup grated parmesan
- 1 egg
- Salt, pepper, basil, oregano
Instructions: Cook beef with onion and garlic. Layer noodles, meat sauce, ricotta mixture (ricotta, egg, parmesan), and mozzarella. Bake at 375F for 45 minutes.
restriction: vegan
assert:
- type: contains
value: "lentils" # or another vegan protein
- type: not_contains
value: "beef"
- type: not_contains
value: "cheese"
- type: contains
value: "vegan mozzarella" # or similar
- description: Make a Thai peanut sauce recipe nut-free
vars:
recipe: |
Thai Peanut Sauce:
- 1/2 cup peanut butter
- 2 tbsp soy sauce
- 1 tbsp lime juice
- 1 tbsp brown sugar
- 1 tsp grated ginger
- 1 clove garlic, minced
- 1/4 cup water
Instructions: Whisk all ingredients together until smooth.
restriction: nut-free
assert:
- type: not_contains
value: "peanut"
- type: contains
value: "sunflower seed butter" # or another nut-free alternative
- description: Adapt a French baguette recipe to be gluten-free
vars:
recipe: |
French Baguette:
- 3 cups all-purpose flour
- 1 1/2 cups water
- 2 tsp salt
- 1 packet active dry yeast
Instructions: Mix ingredients, knead, let rise, shape, and bake at 450F for 25 minutes.
restriction: gluten-free
assert:
- type: not_contains
value: "all-purpose flour"
- type: contains
value: "gluten-free flour blend"
- type: contains
value: "bake at 450F"
Let me know if you want to see more test cases or a different application!