updates on the backend

This commit is contained in:
sriram
2026-08-11 19:16:01 +05:30
commit c2af4556c6
131 changed files with 546007 additions and 0 deletions

34
scripts/fast_test.py Normal file
View File

@@ -0,0 +1,34 @@
import sys
import os
sys.path.insert(0, ".")
from app.services.rag_service import retrieve, answer_query
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}")