demo / test_agent.py
Crytonix's picture
Upload folder using huggingface_hub
de495e8 verified
Raw
History Blame Contribute Delete
2.15 kB
import sys
import os
from pathlib import Path
# Add current folder to path
sys.path.insert(0, str(Path(__file__).parent.resolve()))
def run_cross_verification():
print("==================================================")
print("[*] RUNNING COMPREHENSIVE CROSS-VERIFICATION TESTS")
print("==================================================")
# 1. Config verification
from config import Config, build_system_prompt
print("1. [Config] R2 Configured:", Config.r2_configured())
print(" [Config] LLM Base URL:", Config.LLM_BASE_URL)
print(" [Config] LLM Model:", Config.LLM_MODEL)
# 2. R2 Memory Manager verification
from r2_manager import R2MemoryManager
r2 = R2MemoryManager()
print("2. [R2Manager] Connection status:", r2.is_connected)
state = r2.load_state()
memory = r2.load_memory()
print(" [R2Manager] State loaded status:", state.get("status"))
print(" [R2Manager] Memory entries count:", len(memory.get("entries", [])))
# 3. Hermes Agent verification
from agent import HermesAgent
agent = HermesAgent()
boot_msg = agent.boot()
print("3. [Agent] Boot message:", boot_msg.encode('ascii', 'ignore').decode('ascii'))
assert agent.booted is True, "Agent must be booted"
prompt = agent.get_system_prompt()
assert "System Architecture & Environment" in prompt
print(" [Agent] System prompt rendered successfully (Length:", len(prompt), "chars)")
# 4. Chat verification with mock history
mock_history = [("Hello", "Hi there!"), ("What is your status?", "I am ready.")]
reply = agent.chat("Are you working?", mock_history)
print("4. [Agent] Chat response preview:", reply[:100].encode('ascii', 'ignore').decode('ascii'))
# 5. Gradio App component verification
from app import demo
print("5. [Gradio App] Demo component initialized successfully!")
print("\n==================================================")
print("[+] ALL CROSS-VERIFICATION TESTS PASSED CLEANLY!")
print("==================================================")
if __name__ == "__main__":
run_cross_verification()