| #!/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.