Files
B.Tech-Project-III/negot8/test/test_personal_agent.py
2026-04-05 00:43:23 +05:30

38 lines
1.8 KiB
Python

import asyncio
import json
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'backend'))
from agents.personal_agent import PersonalAgent
from personality.profiles import get_personality_modifier
async def test():
agent = PersonalAgent()
# Test 1: Scheduling
r1 = await agent.extract_preferences("Find time for coffee with Priya next week. I'm free Mon-Wed afternoons.")
print("TEST 1 (scheduling):", r1.get("feature_type"), "" if r1.get("feature_type") == "scheduling" else "")
# Test 2: Expenses (with UPI mention)
r2 = await agent.extract_preferences("Split our Goa trip costs. I paid 12K hotel, 3K fuel. Fuel should be 60-40 since I drove. My UPI is rahul@paytm")
print("TEST 2 (expenses):", r2.get("feature_type"), "" if r2.get("feature_type") == "expenses" else "")
print(" UPI extracted:", "rahul@paytm" in json.dumps(r2), "" if "rahul@paytm" in json.dumps(r2) else "⚠️ UPI not found")
# Test 3: Marketplace
r3 = await agent.extract_preferences("I want to sell my PS5 to this guy. Asking 35K, minimum 30K, has 2 controllers.")
print("TEST 3 (marketplace):", r3.get("feature_type"), "" if r3.get("feature_type") == "marketplace" else "")
# Test 4: Generic
r4 = await agent.extract_preferences("Figure out with @dave who brings what to the BBQ party Saturday")
print("TEST 4 (generic):", r4.get("feature_type"), "" if r4.get("feature_type") in ("generic", "collaborative") else "")
# Test 5: Personality profiles load
for p in ["aggressive", "people_pleaser", "analytical", "empathetic", "balanced"]:
mod = get_personality_modifier(p)
print(f"PERSONALITY {p}: {'' if len(mod) > 50 else ''} ({len(mod)} chars)")
print("\nFull output Test 2:", json.dumps(r2, indent=2))
asyncio.run(test())