SLSAGENT / test_agent.py
jarvisemitra
feat: add PDF export button, conversational welcome message, green theme, and verbose debug logging
c75ff62
Raw
History Blame Contribute Delete
1.52 kB
import os
import sys
from dotenv import load_dotenv
load_dotenv()
# Test 1: Check env vars
print("=== ENV CHECK ===")
print(f"NVIDIA_API_KEY: {'SET' if os.getenv('NVIDIA_API_KEY') else 'NOT SET'}")
print(f"GEMINI_API_KEY: {'SET' if os.getenv('GEMINI_API_KEY') else 'NOT SET'}")
# Test 2: Import and run agent
print("\n=== AGENT INIT ===")
try:
from app.agent import get_agent
agent = get_agent()
print("Agent initialized successfully!")
except Exception as e:
print(f"Agent init FAILED: {e}")
import traceback
traceback.print_exc()
sys.exit(1)
# Test 3: Process a message
print("\n=== PROCESS MESSAGE ===")
from app.models import Message
messages = [Message(role="user", content="hi")]
try:
response = agent.process(messages)
print(f"Reply: {response.reply}")
print(f"Recommendations: {response.recommendations}")
print(f"End of convo: {response.end_of_conversation}")
except Exception as e:
print(f"Process FAILED: {e}")
import traceback
traceback.print_exc()
# Test 4: Process with more detail
print("\n=== PROCESS WITH DETAIL ===")
messages2 = [Message(role="user", content="I need a Java developer assessment")]
try:
response2 = agent.process(messages2)
print(f"Reply: {response2.reply}")
print(f"Recommendations: {len(response2.recommendations)} items")
for rec in response2.recommendations:
print(f" - {rec.name}: {rec.url}")
except Exception as e:
print(f"Process FAILED: {e}")
import traceback
traceback.print_exc()