From 1b4aa5c67b0412b134e903855f1ad3d12c7eab0e Mon Sep 17 00:00:00 2001 From: Igor Ilic Date: Wed, 5 Nov 2025 15:15:15 +0100 Subject: [PATCH 01/10] fix: resolve issue with cypher search --- cognee/modules/retrieval/cypher_search_retriever.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cognee/modules/retrieval/cypher_search_retriever.py b/cognee/modules/retrieval/cypher_search_retriever.py index 9978f2536..b8cbce558 100644 --- a/cognee/modules/retrieval/cypher_search_retriever.py +++ b/cognee/modules/retrieval/cypher_search_retriever.py @@ -49,8 +49,9 @@ class CypherSearchRetriever(BaseRetriever): if is_empty: logger.warning("Search attempt on an empty knowledge graph") return [] + from fastapi.encoders import jsonable_encoder - result = await graph_engine.query(query) + result = jsonable_encoder(await graph_engine.query(query)) except Exception as e: logger.error("Failed to execture cypher search retrieval: %s", str(e)) raise CypherSearchError() from e From 1c142734b4f031e466d5a7b111f3ed2e55e338c3 Mon Sep 17 00:00:00 2001 From: Igor Ilic Date: Wed, 5 Nov 2025 15:22:23 +0100 Subject: [PATCH 02/10] refactor: change import to top of file --- cognee/modules/retrieval/cypher_search_retriever.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cognee/modules/retrieval/cypher_search_retriever.py b/cognee/modules/retrieval/cypher_search_retriever.py index b8cbce558..01816f3df 100644 --- a/cognee/modules/retrieval/cypher_search_retriever.py +++ b/cognee/modules/retrieval/cypher_search_retriever.py @@ -1,4 +1,6 @@ from typing import Any, Optional +from fastapi.encoders import jsonable_encoder + from cognee.infrastructure.databases.graph import get_graph_engine from cognee.modules.retrieval.base_retriever import BaseRetriever from cognee.modules.retrieval.utils.completion import generate_completion @@ -49,7 +51,6 @@ class CypherSearchRetriever(BaseRetriever): if is_empty: logger.warning("Search attempt on an empty knowledge graph") return [] - from fastapi.encoders import jsonable_encoder result = jsonable_encoder(await graph_engine.query(query)) except Exception as e: From cc60141c8dec285e48a05e8550782cb4708eb6ad Mon Sep 17 00:00:00 2001 From: Andrej Milicevic Date: Thu, 6 Nov 2025 11:46:34 +0100 Subject: [PATCH 03/10] test: change key for wighted edges example --- .github/workflows/weighted_edges_tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/weighted_edges_tests.yml b/.github/workflows/weighted_edges_tests.yml index 874ef6ea4..0425ac797 100644 --- a/.github/workflows/weighted_edges_tests.yml +++ b/.github/workflows/weighted_edges_tests.yml @@ -109,12 +109,12 @@ jobs: LLM_PROVIDER: openai LLM_MODEL: gpt-5-mini LLM_ENDPOINT: https://api.openai.com/v1/ - LLM_API_KEY: ${{ secrets.LLM_API_KEY }} + LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }} LLM_API_VERSION: "2024-02-01" EMBEDDING_PROVIDER: openai EMBEDDING_MODEL: text-embedding-3-small EMBEDDING_ENDPOINT: https://api.openai.com/v1/ - EMBEDDING_API_KEY: ${{ secrets.LLM_API_KEY }} + EMBEDDING_API_KEY: ${{ secrets.OPENAI_API_KEY }} EMBEDDING_API_VERSION: "2024-02-01" steps: - name: Check out repository From cdb06d2157d2602bd0e3f9c696d38368e119a8e4 Mon Sep 17 00:00:00 2001 From: Andrej Milicevic Date: Thu, 6 Nov 2025 11:50:58 +0100 Subject: [PATCH 04/10] test: add workflow_dispatch for test purposes --- .github/workflows/weighted_edges_tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/weighted_edges_tests.yml b/.github/workflows/weighted_edges_tests.yml index 0425ac797..10778d1a0 100644 --- a/.github/workflows/weighted_edges_tests.yml +++ b/.github/workflows/weighted_edges_tests.yml @@ -17,6 +17,7 @@ on: - 'cognee/tests/unit/interfaces/graph/test_weighted_edges.py' - 'examples/python/weighted_edges_example.py' - '.github/workflows/weighted_edges_tests.yml' + workflow_dispatch: env: RUNTIME__LOG_LEVEL: ERROR From 5dc8d4e8a1206e9ce4fbf4df157ac945b83283c7 Mon Sep 17 00:00:00 2001 From: Andrej Milicevic Date: Thu, 6 Nov 2025 11:52:39 +0100 Subject: [PATCH 05/10] test: remove workflow_dispatch --- .github/workflows/weighted_edges_tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/weighted_edges_tests.yml b/.github/workflows/weighted_edges_tests.yml index 10778d1a0..0425ac797 100644 --- a/.github/workflows/weighted_edges_tests.yml +++ b/.github/workflows/weighted_edges_tests.yml @@ -17,7 +17,6 @@ on: - 'cognee/tests/unit/interfaces/graph/test_weighted_edges.py' - 'examples/python/weighted_edges_example.py' - '.github/workflows/weighted_edges_tests.yml' - workflow_dispatch: env: RUNTIME__LOG_LEVEL: ERROR From 4567ffcfff6ca850252fcced54c9324698484f9b Mon Sep 17 00:00:00 2001 From: Andrej Milicevic Date: Thu, 6 Nov 2025 12:27:10 +0100 Subject: [PATCH 06/10] test: change endpoint --- .github/workflows/weighted_edges_tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/weighted_edges_tests.yml b/.github/workflows/weighted_edges_tests.yml index 0425ac797..d571d354f 100644 --- a/.github/workflows/weighted_edges_tests.yml +++ b/.github/workflows/weighted_edges_tests.yml @@ -108,12 +108,12 @@ jobs: env: LLM_PROVIDER: openai LLM_MODEL: gpt-5-mini - LLM_ENDPOINT: https://api.openai.com/v1/ + LLM_ENDPOINT: https://api.openai.com/v1 LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }} LLM_API_VERSION: "2024-02-01" EMBEDDING_PROVIDER: openai EMBEDDING_MODEL: text-embedding-3-small - EMBEDDING_ENDPOINT: https://api.openai.com/v1/ + EMBEDDING_ENDPOINT: https://api.openai.com/v1/embeddings EMBEDDING_API_KEY: ${{ secrets.OPENAI_API_KEY }} EMBEDDING_API_VERSION: "2024-02-01" steps: From 286584eef0039686ac9ad62f0be0a0a7a9637edc Mon Sep 17 00:00:00 2001 From: Andrej Milicevic Date: Thu, 6 Nov 2025 12:35:37 +0100 Subject: [PATCH 07/10] test: change embedding config --- .github/workflows/weighted_edges_tests.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/weighted_edges_tests.yml b/.github/workflows/weighted_edges_tests.yml index d571d354f..b722c5e7c 100644 --- a/.github/workflows/weighted_edges_tests.yml +++ b/.github/workflows/weighted_edges_tests.yml @@ -111,11 +111,11 @@ jobs: LLM_ENDPOINT: https://api.openai.com/v1 LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }} LLM_API_VERSION: "2024-02-01" - EMBEDDING_PROVIDER: openai - EMBEDDING_MODEL: text-embedding-3-small - EMBEDDING_ENDPOINT: https://api.openai.com/v1/embeddings - EMBEDDING_API_KEY: ${{ secrets.OPENAI_API_KEY }} - EMBEDDING_API_VERSION: "2024-02-01" + EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }} + EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }} + EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }} + EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }} + steps: - name: Check out repository uses: actions/checkout@v4 From 6b81559bb65d8501dc698761ed2fb51ee7c0d839 Mon Sep 17 00:00:00 2001 From: Andrej Milicevic Date: Thu, 6 Nov 2025 13:04:01 +0100 Subject: [PATCH 08/10] test: changed endpoints in other tests --- .github/workflows/weighted_edges_tests.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/weighted_edges_tests.yml b/.github/workflows/weighted_edges_tests.yml index b722c5e7c..0b263cdcf 100644 --- a/.github/workflows/weighted_edges_tests.yml +++ b/.github/workflows/weighted_edges_tests.yml @@ -32,7 +32,7 @@ jobs: env: LLM_PROVIDER: openai LLM_MODEL: gpt-5-mini - LLM_API_KEY: ${{ secrets.LLM_API_KEY }} + LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }} steps: - name: Check out repository @@ -67,14 +67,13 @@ jobs: env: LLM_PROVIDER: openai LLM_MODEL: gpt-5-mini - LLM_ENDPOINT: https://api.openai.com/v1/ - LLM_API_KEY: ${{ secrets.LLM_API_KEY }} + LLM_ENDPOINT: https://api.openai.com/v1 + LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }} LLM_API_VERSION: "2024-02-01" - EMBEDDING_PROVIDER: openai - EMBEDDING_MODEL: text-embedding-3-small - EMBEDDING_ENDPOINT: https://api.openai.com/v1/ - EMBEDDING_API_KEY: ${{ secrets.LLM_API_KEY }} - EMBEDDING_API_VERSION: "2024-02-01" + EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }} + EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }} + EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }} + EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }} steps: - name: Check out repository uses: actions/checkout@v4 @@ -115,7 +114,7 @@ jobs: EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }} EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }} EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }} - + steps: - name: Check out repository uses: actions/checkout@v4 From 62c599a4994c4e78c33c66925fb879b72c4ff338 Mon Sep 17 00:00:00 2001 From: Andrej Milicevic Date: Thu, 6 Nov 2025 13:13:35 +0100 Subject: [PATCH 09/10] test: add dev to CI config for weighted edges tests --- .github/workflows/weighted_edges_tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/weighted_edges_tests.yml b/.github/workflows/weighted_edges_tests.yml index 0b263cdcf..2b4a043bf 100644 --- a/.github/workflows/weighted_edges_tests.yml +++ b/.github/workflows/weighted_edges_tests.yml @@ -2,7 +2,7 @@ name: Weighted Edges Tests on: push: - branches: [ main, weighted_edges ] + branches: [ main, dev, weighted_edges ] paths: - 'cognee/modules/graph/utils/get_graph_from_model.py' - 'cognee/infrastructure/engine/models/Edge.py' @@ -10,7 +10,7 @@ on: - 'examples/python/weighted_edges_example.py' - '.github/workflows/weighted_edges_tests.yml' pull_request: - branches: [ main ] + branches: [ main, dev ] paths: - 'cognee/modules/graph/utils/get_graph_from_model.py' - 'cognee/infrastructure/engine/models/Edge.py' From 234b13a8c9a62ecd7e85c5d250c37b13bd8dace3 Mon Sep 17 00:00:00 2001 From: Andrej Milicevic Date: Fri, 7 Nov 2025 17:39:42 +0100 Subject: [PATCH 10/10] feat:add emptiness check to neptune adapter --- .../hybrid/neptune_analytics/NeptuneAnalyticsAdapter.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cognee/infrastructure/databases/hybrid/neptune_analytics/NeptuneAnalyticsAdapter.py b/cognee/infrastructure/databases/hybrid/neptune_analytics/NeptuneAnalyticsAdapter.py index 5357f3d7c..1e16642b5 100644 --- a/cognee/infrastructure/databases/hybrid/neptune_analytics/NeptuneAnalyticsAdapter.py +++ b/cognee/infrastructure/databases/hybrid/neptune_analytics/NeptuneAnalyticsAdapter.py @@ -416,6 +416,15 @@ class NeptuneAnalyticsAdapter(NeptuneGraphDB, VectorDBInterface): self._client.query(f"MATCH (n :{self._VECTOR_NODE_LABEL}) DETACH DELETE n") pass + async def is_empty(self) -> bool: + query = """ + MATCH (n) + RETURN true + LIMIT 1; + """ + query_result = await self._client.query(query) + return len(query_result) == 0 + @staticmethod def _get_scored_result( item: dict, with_vector: bool = False, with_score: bool = False