Files
catalogue_backend/scripts/fast_test.py
Suriyakumarvijayanayagam 52f5d3be1d sheet upload fix
2026-08-28 11:22:53 +05:30

34 lines
1.8 KiB
Python

import sys
sys.path.insert(0, ".")
from app.services.rag_service import retrieve
from app.services.query_intent import extract_max_price, extract_brand_mention, is_count_query, detected_category
print("=== Q1: How many products are there in Cadbury? ===")
print(" Is Count:", is_count_query("How many products are there in Cadbury?"))
print(" Brand Mention:", extract_brand_mention("How many products are there in Cadbury?"))
print(" Category:", detected_category("How many products are there in Cadbury?"))
print("\n=== Q2: Suggest panner less than ₹100 ===")
print(" Is Count:", is_count_query("Suggest panner less than ₹100"))
print(" Brand Mention:", extract_brand_mention("Suggest panner less than ₹100"))
print(" Category:", detected_category("Suggest panner less than ₹100"))
print(" Max Price:", extract_max_price("Suggest panner less than ₹100"))
q2_prods = retrieve("Suggest panner less than ₹100")
for p in q2_prods:
print(f" - [{p.brand}] {p.product_name} | Price: {p.price_range} | Category: {p.category}")
print("\n=== Q3: Recommend Paneer under ₹150 ===")
print(" Is Count:", is_count_query("Recommend Paneer under ₹150"))
print(" Brand Mention:", extract_brand_mention("Recommend Paneer under ₹150"))
print(" Category:", detected_category("Recommend Paneer under ₹150"))
print(" Max Price:", extract_max_price("Recommend Paneer under ₹150"))
q3_prods = retrieve("Recommend Paneer under ₹150")
for p in q3_prods:
print(f" - [{p.brand}] {p.product_name} | Price: {p.price_range} | Category: {p.category}")
print("\n=== Q4: Suggest low sugar biscuits ===")
print(" Category:", detected_category("Suggest low sugar biscuits"))
q4_prods = retrieve("Suggest low sugar biscuits")
for p in q4_prods:
print(f" - [{p.brand}] {p.product_name} | Price: {p.price_range} | Category: {p.category}")