From d09bf80088e282c659ebc1e9a267ff7a67042829 Mon Sep 17 00:00:00 2001 From: Giancarmine Salucci Date: Wed, 13 May 2026 02:37:59 +0200 Subject: [PATCH] =?UTF-8?q?fix(parser):=20relax=20detection=20prompt=20?= =?UTF-8?q?=E2=80=94=20quantities=20not=20required=20for=20social=20media?= =?UTF-8?q?=20recipes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instagram recipes frequently list ingredients without quantities. The old prompt required 'at least 3 ingredients WITH quantities' which caused valid Italian social-media recipe posts to be rejected. New criteria: dish name + 3 ingredients (any form) + 1 preparation step. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/lib/server/prompts/recipe-extraction.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/lib/server/prompts/recipe-extraction.ts b/src/lib/server/prompts/recipe-extraction.ts index 5e2b849..de58254 100644 --- a/src/lib/server/prompts/recipe-extraction.ts +++ b/src/lib/server/prompts/recipe-extraction.ts @@ -9,32 +9,32 @@ export const RECIPE_DETECTION_PROMPT = `You are a recipe detector for social media posts. -Your task: Determine if the text contains a complete or partial recipe. +Your task: Determine if the text contains a recipe or cooking instructions. -REQUIREMENTS FOR "YES": -1. Recipe name/title is present -2. At least 3 ingredients with quantities (even if approximate) -3. At least 2 cooking steps +REQUIREMENTS FOR "YES" — text must have ALL of: +1. A dish name or title +2. At least 3 ingredients (quantities are NOT required — social media posts often omit them) +3. At least 1 cooking or preparation step IGNORE: - Hashtags (#recipe, #food, etc.) - Mentions (@username) - Emojis - Like counts, comments, social metadata -- Promotional text +- Promotional text ("follow me", "save this", "tag a friend") OUTPUT: Answer with ONLY 'yes' or 'no' - nothing else. EXAMPLES: -Text: "🍝 Pasta al Pomodoro 🍅 Ingredients: 320g pasta, 400g tomatoes, 2 garlic cloves. Boil pasta. Sauté garlic. Add tomatoes. Mix! #italianfood @chef" +Text: "🍝 Pasta al Pomodoro Ingredients: pasta, tomatoes, garlic. Boil pasta. Sauté garlic. Add tomatoes. Mix! #italianfood @chef" Answer: yes Text: "Amazing dinner tonight! 😍 So delicious! 🔥 #foodporn" Answer: no -Text: "You need pasta, tomatoes, and garlic for this recipe" -Answer: no (missing steps) +Text: "Brioche velocissime Per 7 brioche: rotolo di pasta sfoglia, prosciutto cotto, provola. Arrotola la sfoglia con i ripieni, taglia in pezzi, inforna a 180°C." +Answer: yes `; export const RECIPE_EXTRACTION_PROMPT = `You are an EXPERT RECIPE EXTRACTOR specialized in parsing recipes from social media posts.