tahamajs's picture
download
raw
4.49 kB
#!/usr/bin/env python3
import sys
import os
from pathlib import Path
sys.path.append(str(Path(__file__).parent / "src"))
def test_imports():
print("๐Ÿงช Testing imports...")
try:
from src.agents.react_agent import ReActAgent, ReActResult
print("โœ… ReAct agent imported successfully")
from src.utils.llm_interface import LLMInterface
print("โœ… LLM interface imported successfully")
from src.utils.environment import TravelEnvironment
print("โœ… Travel environment imported successfully")
from src.core.memory import MemorySystem, EpisodicMemory
print("โœ… Memory system imported successfully")
from src.core.communication import MessageBroker
print("โœ… Communication system imported successfully")
return True
except ImportError as e:
print(f"โŒ Import error: {e}")
return False
def test_llm_interface():
print("\n๐Ÿงช Testing LLM interface...")
try:
from src.utils.llm_interface import LLMInterface
llm = LLMInterface(primary_provider="mock")
response = llm.generate("Test prompt")
if response:
print("โœ… LLM interface working correctly")
return True
else:
print("โŒ LLM interface returned empty response")
return False
except Exception as e:
print(f"โŒ LLM interface error: {e}")
return False
def test_environment():
print("\n๐Ÿงช Testing travel environment...")
try:
from src.utils.environment import TravelEnvironment
env = TravelEnvironment()
result = env.search_flights("Paris", "2025-11-10")
if isinstance(result, dict) and "success" in result:
print("โœ… Travel environment working correctly")
return True
else:
print("โŒ Travel environment returned invalid result")
return False
except Exception as e:
print(f"โŒ Travel environment error: {e}")
return False
def test_react_agent():
print("\n๐Ÿงช Testing ReAct agent...")
try:
from src.agents.react_agent import ReActAgent
from src.utils.llm_interface import LLMInterface
from src.utils.environment import TravelEnvironment
llm = LLMInterface(primary_provider="mock")
env = TravelEnvironment()
def mock_tool(param: str) -> str:
return f"โœ… Mock result: {param}"
tools = {"mock_tool": mock_tool}
agent = ReActAgent(
tools=tools, llm_interface=llm, max_steps=3, agent_id="test_agent"
)
result = agent.execute("Test task")
if hasattr(result, "success") and hasattr(result, "steps"):
print("โœ… ReAct agent working correctly")
return True
else:
print("โŒ ReAct agent returned invalid result")
return False
except Exception as e:
print(f"โŒ ReAct agent error: {e}")
return False
def test_memory_system():
print("\n๐Ÿงช Testing memory system...")
try:
from src.core.memory import MemorySystem, EpisodicMemory
memory_system = MemorySystem(db_path="test_memory.db")
episodic_memory = EpisodicMemory(memory_system)
memory_id = episodic_memory.store_experience(
content="Test experience",
context={"test": True},
outcome="success",
lessons=["test lesson"],
)
if memory_id:
print("โœ… Memory system working correctly")
return True
else:
print("โŒ Memory system failed to store experience")
return False
except Exception as e:
print(f"โŒ Memory system error: {e}")
return False
def main():
print("๐Ÿš€ Starting Quick Test Suite")
print("=" * 50)
tests = [
test_imports,
test_llm_interface,
test_environment,
test_react_agent,
test_memory_system,
]
passed = 0
total = len(tests)
for test in tests:
if test():
passed += 1
print("\n" + "=" * 50)
print(f"๐Ÿ“Š Test Results: {passed}/{total} tests passed")
if passed == total:
print("๐ŸŽ‰ All tests passed! Pipeline is ready to run.")
return 0
else:
print("โŒ Some tests failed. Check the errors above.")
return 1
if __name__ == "__main__":
sys.exit(main())

Xet Storage Details

Size:
4.49 kB
ยท
Xet hash:
78b9a392079c1dcec75faea56e810b4361787ca4ebc067b5cf6322584d905d0d

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.