From ada375353402b6143d92b8be290c706f389c7580 Mon Sep 17 00:00:00 2001 From: Daulet Amirkhanov Date: Tue, 7 Oct 2025 21:18:00 +0100 Subject: [PATCH 1/2] fix: fix broken check_llm_provider healthcheck method --- cognee/api/health.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/cognee/api/health.py b/cognee/api/health.py index 1b1e45efa..14ebb8043 100644 --- a/cognee/api/health.py +++ b/cognee/api/health.py @@ -193,8 +193,17 @@ class HealthChecker: config = get_llm_config() - # Test actual API connection with minimal request - LLMGateway.show_prompt("test", "test.txt") + from pydantic import BaseModel + + class TestResponse(BaseModel): + status: str + + # Use a simple test to verify LLM connectivity + await LLMGateway.acreate_structured_output( + text_input="Respond with status: ok", + system_prompt="You are a test assistant. Respond with a simple status.", + response_model=TestResponse, + ) response_time = int((time.time() - start_time) * 1000) return ComponentHealth( From 405b65f85754f2a7631d3919ffe03c72e6227613 Mon Sep 17 00:00:00 2001 From: Daulet Amirkhanov Date: Tue, 7 Oct 2025 21:26:22 +0100 Subject: [PATCH 2/2] refactor: Simplify health check methods by using utility functions for LLM and embedding connections --- cognee/api/health.py | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/cognee/api/health.py b/cognee/api/health.py index 14ebb8043..0241a0712 100644 --- a/cognee/api/health.py +++ b/cognee/api/health.py @@ -189,21 +189,12 @@ class HealthChecker: start_time = time.time() try: from cognee.infrastructure.llm.config import get_llm_config - from cognee.infrastructure.llm import LLMGateway config = get_llm_config() - from pydantic import BaseModel + from cognee.infrastructure.llm.utils import test_llm_connection - class TestResponse(BaseModel): - status: str - - # Use a simple test to verify LLM connectivity - await LLMGateway.acreate_structured_output( - text_input="Respond with status: ok", - system_prompt="You are a test assistant. Respond with a simple status.", - response_model=TestResponse, - ) + await test_llm_connection() response_time = int((time.time() - start_time) * 1000) return ComponentHealth( @@ -226,13 +217,9 @@ class HealthChecker: """Check embedding service health (non-critical).""" start_time = time.time() try: - from cognee.infrastructure.databases.vector.embeddings.get_embedding_engine import ( - get_embedding_engine, - ) + from cognee.infrastructure.llm.utils import test_embedding_connection - # Test actual embedding generation with minimal text - engine = get_embedding_engine() - await engine.embed_text(["test"]) + await test_embedding_connection() response_time = int((time.time() - start_time) * 1000) return ComponentHealth(