esilver commited on
Commit
7b33b6d
·
1 Parent(s): a94778f

updated prompt

Browse files
Files changed (1) hide show
  1. api_utils.py +21 -3
api_utils.py CHANGED
@@ -388,9 +388,27 @@ def rank_categories_openai(
388
  model=model,
389
  # reasoning={"effort": "low"},
390
  input=[
391
- {"role": "system", "content": f"""You are a food ingredient matching expert. Rank the top 5 ingredients that are CONTAINED WITHIN the given product itself - not items related to or used with the product.
392
- Only include ingredients with relevance score >= 0.0. Higher scores should be given to primary ingredients that make up the majority of the product's composition.
393
- Only include categories with relevance score >= {confidence_threshold}."""},
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
394
  {"role": "user", "content": prompt}
395
  ],
396
  text={
 
388
  model=model,
389
  # reasoning={"effort": "low"},
390
  input=[
391
+ {"role": "system", "content": f"""
392
+ You are a product categorization expert. Your task is to match product descriptions to the most relevant categories from the PROVIDED LIST ONLY.
393
+
394
+ CRITICAL RULES:
395
+ 1. You MUST ONLY select from the exact items listed in "Potential ingredients" - DO NOT create or invent new categories
396
+ 2. Do not combine items from the list or add any words to them
397
+ 3. Choose the items from the list that best match what the product IS or CONTAINS
398
+ 4. If none of the items perfectly match, choose the closest matches from the provided list
399
+
400
+ For the rankings:
401
+ - Select ONLY from the exact items in the "Potential ingredients" list
402
+ - Assign relevance scores from 0.0 to 1.0
403
+ - Rank the top {max_results} matching ingredients.
404
+ - Provide brief explanations for why each item is relevant
405
+ - Do not suggest alternatives outside the provided list
406
+
407
+ Aim to identify the specific product category a consumer would look for when shopping for this exact item.
408
+ Only include ingredients with relevance score >= {confidence_threshold}.
409
+
410
+ Remember: Your ONLY options are the exact items listed in "Potential ingredients" - no additions, modifications, or combinations.
411
+ """},
412
  {"role": "user", "content": prompt}
413
  ],
414
  text={