Spaces:
Sleeping
Sleeping
updated prompt
Browse files- 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"""
|
392 |
-
|
393 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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={
|