Hello there,
I am trying to use ChatGPT to extract recipes from websites to have them in a consistent format for my app. I tried it on playground with serveral promts to get the best answer, but the answer always contains wrong ingredients, does not follow the cooking steps defined on the website and overall is not really usable.
Is the model just really bad at extracting recipes correctly or is there something wrong with my prompts? I tried the 4o-mini and the 4o.
My Messages:
[
{
"role": "system",
"content": "You will receive a URL to a recipe page. Your task is to extract only the relevant details for the recipe and present them in a structured format. Avoid including unnecessary or irrelevant information. Pay special attention to the accuracy of ingredient quantities, units, and cooking times. Make sure to extract the number of servings and ensure that the descriptions of the steps remain faithful to the original while being concise. Ensure that the ingredients and steps are correctly formatted according to the given schema."
},
{
"role": "user",
"content": "Following website: \"https://www.hirokoliston.com/teriyaki-tofu-don/\"; Output language: German"
}
]
Messages created by Playground:
[
{
"role": "system",
"content": [
{
"type": "text",
"text": "Convert details from a website into a structured recipe format.\n\n- Identify and extract key pieces of information from the website that are typically included in a recipe. This may include the recipe title, ingredients list, quantities, preparation steps, cooking times, serving size, and any additional notes.\n- Ensure that extracted information is organized logically as it would appear in a well-written recipe.\n\n# Steps\n\n1. **Copy Page**: Copy the page to local Temp\n1. **Extract Information**: Identify and extract relevant data points from the local copy. Focus on elements typically found in a recipe.\n2. **Organize Data**: Arrange these extracted elements into a structured format similar to a common recipe layout.\n3. **Verify Completeness**: Ensure that all core components of a recipe are captured and correctly formatted.\n\n# Output Format\n\nThe output must be structured like the response format \"get_ recipe\"\n\n# Examples\n\n**Input:** Following website: \\\"https://www.hirokoliston.com/teriyaki-tofu-don/\\\"; Output language: German\n\n**Output:**\n```json\n{\n \"name\": \"Teriyaki Tofu Don\",\n \"difficulty\": \"easy\",\n \"time\": \"PT30M\",\n \"servings\": 2,\n \"ingredients\": [\n {\n \"name\": \"Tofu\",\n \"quantity\": 300,\n \"unit\": \"g\"\n },\n {\n \"name\": \"Küchenstärke\",\n \"quantity\": 4,\n \"unit\": \"EL\"\n },\n {\n \"name\": \"Öl\",\n \"quantity\": 2,\n \"unit\": \"EL\"\n },\n {\n \"name\": \"Sojasauce\",\n \"quantity\": 4,\n \"unit\": \"EL\"\n },\n {\n \"name\": \"Mirin\",\n \"quantity\": 2,\n \"unit\": \"EL\"\n },\n {\n \"name\": \"Zucker\",\n \"quantity\": 1,\n \"unit\": \"EL\"\n },\n {\n \"name\": \"Frischer Ingwer\",\n \"quantity\": 2,\n \"unit\": \"cm\"\n },\n {\n \"name\": \"Reis\",\n \"quantity\": 1,\n \"unit\": \"Tasse\"\n },\n {\n \"name\": \"Wasser\",\n \"quantity\": 1.5,\n \"unit\": \"Tassen\"\n },\n {\n \"name\": \"Frühlingszwiebeln\",\n \"quantity\": 2,\n \"unit\": \"Stück\"\n },\n {\n \"name\": \"Sesam\",\n \"quantity\": 1,\n \"unit\": \"EL\"\n }\n ],\n \"steps\": [\n {\n \"title\": \"Tofu vorbereiten\",\n \"description\": \"Den Tofu in Würfel schneiden und die Küchenstärke gleichmäßig darüber streuen.\"\n },\n {\n \"title\": \"Öl erhitzen\",\n \"description\": \"Öl in einer Pfanne erhitzen und den Tofu von allen Seiten goldbraun braten.\"\n },\n {\n \"title\": \"Teriyaki-Sauce zubereiten\",\n \"description\": \"In einer Schüssel Sojasauce, Mirin und Zucker vermengen. Die Mischung in die Pfanne geben und den Tofu darin schwenken.\"\n },\n {\n \"title\": \"Reis kochen\",\n \"description\": \"Reis mit Wasser in einem Topf zum Kochen bringen und 15 Minuten bei niedriger Hitze garen.\"\n },\n {\n \"title\": \"Anrichten\",\n \"description\": \"Reis in Schalen verteilen, Tofu darauflegen, mit Frühlingszwiebeln und Sesam garnieren.\"\n }\n ]\n}\n```\n\n*(Real examples may vary in content and complexity but will follow this structure.)*\n\n# Notes\n\n- Consider any unusual formats or data structures when extracting information from the website.\n- Pay attention to variations in terminology or structure encountered on different websites. Adjust extraction techniques as necessary.\n- Be aware of commonly occurring issues such as incorrect data types, missing fields, or improperly formatted times and numbers. Ensure robustness in data handling."
}
]
},
{
"role": "user",
"content": [
{
"type": "text",
"text": "Following website: \\\"https://www.hirokoliston.com/teriyaki-tofu-don/\\\"; Output language: German"
}
]
}
]
Neither of them really worked as they always gave the wrong output.
Here is one of the outputs ChatGPT gave, if you check the recipe you will see that the steps and ingredients are different from what ChatGPT found:
{
"name": "Teriyaki Tofu Don",
"difficulty": "easy",
"time": "PT30M",
"servings": 2,
"ingredients": [
{
"name": "Tofu",
"quantity": 300,
"unit": "g"
},
{
"name": "Küchenstärke",
"quantity": 4,
"unit": "EL"
},
{
"name": "Öl",
"quantity": 2,
"unit": "EL"
},
{
"name": "Sojasauce",
"quantity": 4,
"unit": "EL"
},
{
"name": "Mirin",
"quantity": 2,
"unit": "EL"
},
{
"name": "Zucker",
"quantity": 1,
"unit": "EL"
},
{
"name": "Frischer Ingwer",
"quantity": 2,
"unit": "cm"
},
{
"name": "Reis",
"quantity": 1,
"unit": "Tasse"
},
{
"name": "Wasser",
"quantity": 1.5,
"unit": "Tassen"
},
{
"name": "Frühlingszwiebeln",
"quantity": 2,
"unit": "Stück"
},
{
"name": "Sesam",
"quantity": 1,
"unit": "EL"
}
],
"steps": [
{
"title": "Tofu vorbereiten",
"description": "Den Tofu in Würfel schneiden und die Küchenstärke gleichmäßig darüber streuen."
},
{
"title": "Öl erhitzen",
"description": "Öl in einer Pfanne erhitzen und den Tofu von allen Seiten goldbraun braten."
},
{
"title": "Teriyaki-Sauce zubereiten",
"description": "In einer Schüssel Sojasauce, Mirin und Zucker vermengen. Die Mischung in die Pfanne geben und den Tofu darin schwenken."
},
{
"title": "Reis kochen",
"description": "Reis mit Wasser in einem Topf zum Kochen bringen und 15 Minuten bei niedriger Hitze garen."
},
{
"title": "Anrichten",
"description": "Reis in Schalen verteilen, Tofu darauflegen, mit Frühlingszwiebeln und Sesam garnieren."
}
]
}
Here my JSON-Scheme:
{
"name": "get_recipe",
"strict": true,
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the recipe"
},
"difficulty": {
"type": "string",
"enum": [
"easy",
"medium",
"hard"
],
"description": "The difficulty level of the recipe"
},
"time": {
"type": "string",
"description": "The total time required for the recipe, in ISO 8601 duration format (e.g., PT30M)"
},
"servings": {
"type": "integer",
"description": "The number of servings the recipe is intended for"
},
"ingredients": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "The name of the ingredient"
},
"quantity": {
"type": "number",
"description": "The quantity of the ingredient"
},
"unit": {
"type": "string",
"description": "The unit of measurement (e.g., grams, liters, cups, portions)"
}
},
"required": [
"name",
"quantity",
"unit"
],
"additionalProperties": false
},
"description": "A list of ingredients needed for the recipe"
},
"steps": {
"type": "array",
"items": {
"type": "object",
"properties": {
"title": {
"type": "string",
"description": "The title or brief description of the step"
},
"description": {
"type": "string",
"description": "A detailed explanation of the step"
}
},
"required": [
"title",
"description"
],
"additionalProperties": false
},
"description": "Step-by-step cooking instructions"
}
},
"required": [
"name",
"difficulty",
"time",
"servings",
"ingredients",
"steps"
],
"additionalProperties": false
}
}
Does anyone have any tips on how to achieve what I really want?
Thanks in advance.