|
|
| """
|
| Comprehensive system verification script for the Agentic AI System.
|
| Checks all components, dependencies, and connections.
|
| """
|
|
|
| import sys
|
| import importlib
|
| from pathlib import Path
|
| from typing import List, Dict, Any
|
|
|
|
|
| sys.path.insert(0, str(Path(__file__).parent / "src"))
|
|
|
| def check_component(name: str, module_path: str, class_name: str = None) -> Dict[str, Any]:
|
| """Check if a component can be imported and instantiated."""
|
| try:
|
| module = importlib.import_module(module_path)
|
|
|
| if class_name:
|
| cls = getattr(module, class_name)
|
|
|
| instance = cls()
|
| return {"status": "β
", "message": f"{name} working", "instance": instance}
|
| else:
|
| return {"status": "β
", "message": f"{name} module imported"}
|
|
|
| except ImportError as e:
|
| return {"status": "β", "message": f"{name} import failed: {e}"}
|
| except Exception as e:
|
| return {"status": "β οΈ", "message": f"{name} instantiation failed: {e}"}
|
|
|
| def verify_system() -> None:
|
| """Perform comprehensive system verification."""
|
|
|
| print("π Agentic AI System - Comprehensive Verification")
|
| print("=" * 60)
|
|
|
|
|
| components = [
|
|
|
| ("Settings", "config.settings", None),
|
|
|
|
|
| ("SpaCy Parser", "src.parsers.spacy_parser", "SpacyParser"),
|
| ("Keyword Extractor", "src.parsers.keyword_extractor", "KeywordExtractor"),
|
|
|
|
|
| ("API Matcher", "src.api_clients.api_matcher", "APIMatcher"),
|
| ("CDMS Client", "src.api_clients.cdms_client", "CDMSClient"),
|
|
|
|
|
| ("Base Agent", "src.agents.base_agent", None),
|
| ("Supervisor Agent", "src.agents.supervisor_agent", "SupervisorAgent"),
|
| ("Query Parser Agent", "src.agents.worker_agents", "QueryParserAgent"),
|
| ("API Matcher Agent", "src.agents.worker_agents", "APIMatcherAgent"),
|
| ("API Executor Agent", "src.agents.worker_agents", "APIExecutorAgent"),
|
| ("Result Formatter Agent", "src.agents.worker_agents", "ResultFormatterAgent"),
|
|
|
|
|
| ("Reflection Evaluator", "src.evaluators.reflection_evaluator", "ReflectionEvaluator"),
|
| ("Quality Assessor", "src.evaluators.quality_assessor", "QualityAssessor"),
|
| ("Memory Manager", "src.evaluators.memory_manager", "MemoryManager"),
|
|
|
|
|
| ("Hybrid RAG System", "src.rag.hybrid_rag", "HybridRAGSystem"),
|
|
|
|
|
| ("Logging Config", "src.utils.logging_config", None),
|
| ]
|
|
|
| print("\\nπ¦ Component Verification:")
|
| print("-" * 40)
|
|
|
| results = []
|
| for name, module_path, class_name in components:
|
| result = check_component(name, module_path, class_name)
|
| results.append((name, result))
|
| print(f"{result['status']} {name}: {result['message']}")
|
|
|
|
|
| print("\\nπ§ Dependency Verification:")
|
| print("-" * 40)
|
|
|
| dependencies = [
|
| ("FastAPI", "fastapi"),
|
| ("Uvicorn", "uvicorn"),
|
| ("spaCy", "spacy"),
|
| ("LangChain", "langchain"),
|
| ("LangGraph", "langgraph"),
|
| ("KeyBERT", "keybert"),
|
| ("RapidFuzz", "rapidfuzz"),
|
| ("Sentence Transformers", "sentence_transformers"),
|
| ("Qdrant Client", "qdrant_client"),
|
| ("NumPy", "numpy"),
|
| ("Pydantic", "pydantic"),
|
| ("Requests", "requests"),
|
| ]
|
|
|
| dep_results = []
|
| for name, module in dependencies:
|
| try:
|
| importlib.import_module(module)
|
| print(f"β
{name}: Available")
|
| dep_results.append((name, True))
|
| except ImportError:
|
| print(f"β {name}: Missing")
|
| dep_results.append((name, False))
|
|
|
|
|
| print("\\nπ§ NLP Model Verification:")
|
| print("-" * 40)
|
|
|
| try:
|
| import spacy
|
| nlp = spacy.load("en_core_web_sm")
|
| print("β
spaCy en_core_web_sm: Available")
|
| spacy_model = True
|
| except OSError:
|
| print("β spaCy en_core_web_sm: Missing")
|
| print(" Run: python -m spacy download en_core_web_sm")
|
| spacy_model = False
|
|
|
|
|
| print("\\nπ File Structure Verification:")
|
| print("-" * 40)
|
|
|
| required_files = [
|
| "api_server.py",
|
| "run_api.py",
|
| "test_api_simple.py",
|
| "requirements.txt",
|
| "README.md",
|
| "config/settings.py",
|
| "src/__init__.py",
|
| "src/agents/__init__.py",
|
| "src/parsers/__init__.py",
|
| "src/api_clients/__init__.py",
|
| "src/evaluators/__init__.py",
|
| "src/rag/__init__.py",
|
| "src/utils/__init__.py",
|
| "tests/test_parsers.py",
|
| "tests/evaluation_harness.py",
|
| ]
|
|
|
| file_results = []
|
| for file_path in required_files:
|
| path = Path(file_path)
|
| if path.exists():
|
| print(f"β
{file_path}: Exists")
|
| file_results.append((file_path, True))
|
| else:
|
| print(f"β {file_path}: Missing")
|
| file_results.append((file_path, False))
|
|
|
|
|
| print("\\nπ API Server Verification:")
|
| print("-" * 40)
|
|
|
| try:
|
| from api_server import app
|
| print("β
API Server: Import successful")
|
| api_server = True
|
| except Exception as e:
|
| print(f"β API Server: Import failed - {e}")
|
| api_server = False
|
|
|
|
|
| print("\\nπ§ͺ Evaluation Harness Verification:")
|
| print("-" * 40)
|
|
|
| try:
|
| from tests.evaluation_harness import EvaluationHarness
|
| print("β
Evaluation Harness: Import successful")
|
| eval_harness = True
|
| except Exception as e:
|
| print(f"β Evaluation Harness: Import failed - {e}")
|
| eval_harness = False
|
|
|
|
|
| print("\\n" + "=" * 60)
|
| print("π VERIFICATION SUMMARY")
|
| print("=" * 60)
|
|
|
|
|
| component_success = len([r for _, r in results if r["status"] == "β
"])
|
| component_total = len(results)
|
| print(f"π¦ Components: {component_success}/{component_total} working")
|
|
|
|
|
| dep_success = len([r for _, r in dep_results if r])
|
| dep_total = len(dep_results)
|
| print(f"π§ Dependencies: {dep_success}/{dep_total} available")
|
|
|
|
|
| file_success = len([r for _, r in file_results if r])
|
| file_total = len(file_results)
|
| print(f"π Files: {file_success}/{file_total} present")
|
|
|
|
|
| overall_score = (component_success + dep_success + file_success) / (component_total + dep_total + file_total)
|
|
|
| print(f"\\nπ― Overall System Health: {overall_score:.1%}")
|
|
|
| if overall_score >= 0.9:
|
| print("π SYSTEM READY TO GO! β¨")
|
| print("\\nπ Quick Start:")
|
| print(" 1. python run_api.py")
|
| print(" 2. python test_api_simple.py")
|
| print(" 3. python tests/evaluation_harness.py")
|
| elif overall_score >= 0.7:
|
| print("β οΈ SYSTEM MOSTLY READY - Minor issues detected")
|
| print("\\nπ‘ Check missing components above")
|
| else:
|
| print("β SYSTEM NOT READY - Major issues detected")
|
| print("\\nπ§ Install missing dependencies:")
|
| print(" pip install -r requirements.txt")
|
| if not spacy_model:
|
| print(" python -m spacy download en_core_web_sm")
|
|
|
|
|
| print("\\nπ Advanced Features Status:")
|
| print("-" * 40)
|
|
|
| advanced_features = [
|
| ("Self-Critique Reflection", "src.evaluators.reflection_evaluator"),
|
| ("Persistent Memory", "src.evaluators.memory_manager"),
|
| ("Quality Assessment", "src.evaluators.quality_assessor"),
|
| ("Hybrid RAG System", "src.rag.hybrid_rag"),
|
| ("Evaluation Harness", "tests.evaluation_harness"),
|
| ]
|
|
|
| for name, module in advanced_features:
|
| try:
|
| importlib.import_module(module)
|
| print(f"β
{name}: Available")
|
| except ImportError:
|
| print(f"β {name}: Not available")
|
|
|
| print("\\n" + "=" * 60)
|
|
|
| if __name__ == "__main__":
|
| verify_system()
|
|
|