Repository: topoteretes/cognee
File: cognee/api/health.py (Python)

Code before:
                status=HealthStatus.HEALTHY,
                provider=provider,
                response_time_ms=response_time,
                details="Storage accessible",
            )
        except Exception as e:
            response_time = int((time.time() - start_time) * 1000)
            return ComponentHealth(
                status=HealthStatus.UNHEALTHY,
                provider="unknown",
                response_time_ms=response_time,
                details=f"Storage test failed: {str(e)}",
            )

    async def check_llm_provider(self) -> ComponentHealth:
        """Check LLM provider health (non-critical)."""
        start_time = time.time()
        try:
            from cognee.infrastructure.llm.get_llm_client import get_llm_client
            from cognee.infrastructure.llm.config import get_llm_config

            config = get_llm_config()

            # Test actual API connection with minimal request
            client = get_llm_client()
            await client.acomplete("test", max_tokens=1)

            response_time = int((time.time() - start_time) * 1000)
            return ComponentHealth(
                status=HealthStatus.HEALTHY,
                provider=config.llm_provider,
                response_time_ms=response_time,
                details="API responding",
            )
        except Exception as e:
            response_time = int((time.time() - start_time) * 1000)
            return ComponentHealth(
                status=HealthStatus.DEGRADED,
                provider="unknown",
                response_time_ms=response_time,
                details=f"API check failed: {str(e)}",
            )

    async def check_embedding_service(self) -> ComponentHealth:
        """Check embedding service health (non-critical)."""
        start_time = time.time()
        try:
            from cognee.infrastructure.databases.vector.embeddings.get_embedding_engine import (
                get_embedding_engine,
            )


Review comment (suggestion):
this method doesn't exist, please check LLMInterface.

For now, you can replace this with something like `client.show_prompt("test", "test")`
```suggestion
            client.show_prompt("test", "test")
```

Code after:

            response_time = int((time.time() - start_time) * 1000)
            return ComponentHealth(
                status=HealthStatus.HEALTHY,
                provider=provider,
                response_time_ms=response_time,
                details="Storage accessible",
            )
        except Exception as e:
            response_time = int((time.time() - start_time) * 1000)
            return ComponentHealth(
                status=HealthStatus.UNHEALTHY,
                provider="unknown",
                response_time_ms=response_time,
                details=f"Storage test failed: {str(e)}",
            )

    async def check_llm_provider(self) -> ComponentHealth:
        """Check LLM provider health (non-critical)."""
        start_time = time.time()
        try:
            from cognee.infrastructure.llm.get_llm_client import get_llm_client
            from cognee.infrastructure.llm.config import get_llm_config

            config = get_llm_config()

            # Test actual API connection with minimal request
            client = get_llm_client()
            await client.show_prompt("test", "test")

            response_time = int((time.time() - start_time) * 1000)
            return ComponentHealth(
                status=HealthStatus.HEALTHY,
                provider=config.llm_provider,
                response_time_ms=response_time,
                details="API responding",
            )
        except Exception as e:
            response_time = int((time.time() - start_time) * 1000)
            logger.error(f"LLM provider health check failed: {str(e)}", exc_info=True)
            return ComponentHealth(
                status=HealthStatus.DEGRADED,
                provider="unknown",
                response_time_ms=response_time,
                details=f"API check failed: {str(e)}",
            )

    async def check_embedding_service(self) -> ComponentHealth:
        """Check embedding service health (non-critical)."""
        start_time = time.time()
        try: