suggestion_bot / verify_simple_agent.py
Sanjay Ram A
Upload 52 files
75788a5 verified
Raw
History Blame Contribute Delete
1.64 kB
"""Verify simple agent works without LangChain."""
print("Testing simple agent import...")
try:
from simple_agent import simple_agent
print("βœ… Simple agent imported successfully")
print(f" - Has API key: {bool(simple_agent.api_key)}")
print(f" - Has SerpApi key: {bool(simple_agent.serpapi_key)}")
print()
print("Testing extraction logic...")
category, budget = simple_agent._extract_info("i need a mobile under 6k")
print(f"βœ… Extraction works: category={category}, budget={budget}")
print()
print("Testing database...")
from database import db, Platform
user = db.get_user(Platform.TELEGRAM, "test_user_999")
print(f"βœ… Database works: user={'found' if user else 'not found'}")
print()
print("="*60)
print("πŸŽ‰ All checks passed!")
print("="*60)
print()
print("Your simple agent is ready to use.")
print()
print("⚠️ IMPORTANT: You MUST restart the server!")
print()
print("Steps:")
print("1. Press CTRL+C in the terminal running the bot")
print("2. Run: .\\clear_cache.ps1 (optional but recommended)")
print("3. Run: python main.py --mode all")
print("4. Test: Send 'i need a mobile under 6k' to your bot")
print()
except ImportError as e:
print(f"❌ Import failed: {e}")
print()
print("This might be a LangChain dependency issue.")
print("The simple_agent should NOT import LangChain.")
print()
print("Check simple_agent.py and remove any LangChain imports.")
except Exception as e:
print(f"❌ Error: {e}")
import traceback
traceback.print_exc()