diff --git a/CogniwareIms/README.md b/CogniwareIms/README.md index 0488a3c8bd..25a8746cb1 100644 --- a/CogniwareIms/README.md +++ b/CogniwareIms/README.md @@ -77,13 +77,6 @@ This system uses the OPEA megaservice pattern to orchestrate multiple microservi - **Reranking Microservice**: Improve retrieval quality (BAAI/bge-reranker-base) - **DataPrep Microservice**: Document ingestion and processing -## Documentation - -- [Deployment Guide](docs/DEPLOYMENT_GUIDE.md) -- [Data Setup](docs/DATA_SETUP.md) -- [OPEA Compliance](docs/OPEA_COMPLIANCE_SUMMARY.md) -- [Contributing](docs/CONTRIBUTING.md) - ## License Apache 2.0 - See [LICENSE](LICENSE) file for details. diff --git a/CogniwareIms/backend/app/services/dbqna_service.py b/CogniwareIms/backend/app/services/dbqna_service.py index ff1a03c6de..8446f4861c 100644 --- a/CogniwareIms/backend/app/services/dbqna_service.py +++ b/CogniwareIms/backend/app/services/dbqna_service.py @@ -5,6 +5,7 @@ Converts natural language to SQL and executes against inventory database """ +import json import logging import os from typing import Any, Dict, List, Optional diff --git a/CogniwareIms/backend/app/services/opea_client.py b/CogniwareIms/backend/app/services/opea_client.py index 24bbb36b21..f5429808c4 100644 --- a/CogniwareIms/backend/app/services/opea_client.py +++ b/CogniwareIms/backend/app/services/opea_client.py @@ -7,6 +7,7 @@ from typing import Any, Dict, List, Optional import httpx +from fastapi import HTTPException logger = logging.getLogger(__name__) @@ -110,10 +111,23 @@ async def health_check_all(self) -> Dict[str, str]: status = {} for name, url in services.items(): - status[name] = await check_service(url) + status[name] = await self._check_service(url) return status + async def _check_service(self, url: str) -> str: + """Check if a service is healthy.""" + try: + async with httpx.AsyncClient(timeout=self.timeout) as client: + response = await client.get(f"{url}/health") + if response.status_code == 200: + return "healthy" + else: + return f"unhealthy (status: {response.status_code})" + except Exception as e: + logger.error(f"Health check failed for {url}: {e}") + return f"unhealthy (error: {str(e)})" + # Global OPEA client instance opea_client = OPEAClient()