Fix AI returning 'unknown' stock status for unavailable items

Updated prompts to explicitly require 'out_of_stock' when the AI's
reasoning mentions the product is not available, coming soon, pre-order,
or has a future availability date.

The AI was returning 'unknown' even when its reason clearly stated
"not available for purchase right now" - now it must use 'out_of_stock'.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
clucraft 2026-01-25 20:39:30 -05:00
parent f1a055c3b9
commit 84d088a8d1

View file

@ -65,9 +65,11 @@ Return a JSON object with:
- confidence: number from 0 to 1 - confidence: number from 0 to 1
- suggestedPrice: the correct price as a number (or null if scraped price is correct) - suggestedPrice: the correct price as a number (or null if scraped price is correct)
- suggestedCurrency: currency code if suggesting a different price - suggestedCurrency: currency code if suggesting a different price
- stockStatus: "in_stock", "out_of_stock", or "unknown" - based on whether the product can be purchased RIGHT NOW - stockStatus: MUST be "in_stock" or "out_of_stock" - use "out_of_stock" if the product cannot be purchased RIGHT NOW (including pre-order, coming soon, future availability dates). Only use "unknown" if there is absolutely no availability information on the page.
- reason: brief explanation of your decision (mention both price and availability) - reason: brief explanation of your decision (mention both price and availability)
IMPORTANT: If you mention in your reason that the product is "not available", "coming soon", "pre-order", or has a future date, you MUST set stockStatus to "out_of_stock", NOT "unknown".
Only return valid JSON, no explanation text outside the JSON. Only return valid JSON, no explanation text outside the JSON.
HTML Content: HTML Content:
@ -96,10 +98,12 @@ Signs the $VARIANT_PRICE$ variant is OUT OF STOCK:
- A different price is shown as the main purchasable option - A different price is shown as the main purchasable option
Return a JSON object with: Return a JSON object with:
- stockStatus: "in_stock", "out_of_stock", or "unknown" - stockStatus: MUST be "in_stock" or "out_of_stock". Only use "unknown" if there is absolutely no availability information.
- confidence: number from 0 to 1 - confidence: number from 0 to 1
- reason: brief explanation focusing on the $VARIANT_PRICE$ variant specifically - reason: brief explanation focusing on the $VARIANT_PRICE$ variant specifically
IMPORTANT: If your reason mentions the product is unavailable, coming soon, pre-order, or has a future date, set stockStatus to "out_of_stock".
Only return valid JSON, no explanation text outside the JSON. Only return valid JSON, no explanation text outside the JSON.
HTML Content: HTML Content: