diff --git a/cognee/modules/pipelines/operations/run_tasks.py b/cognee/modules/pipelines/operations/run_tasks.py index b022883382..952f601fce 100644 --- a/cognee/modules/pipelines/operations/run_tasks.py +++ b/cognee/modules/pipelines/operations/run_tasks.py @@ -1,7 +1,7 @@ import inspect import json import logging -from uuid import UUID +from uuid import UUID, uuid4 from typing import Any from cognee.modules.pipelines.operations import ( @@ -269,7 +269,12 @@ async def run_tasks_with_telemetry(tasks: list[Task], data, pipeline_name: str): raise error -async def run_tasks(tasks: list[Task], dataset_id: UUID, data: Any, pipeline_name: str): +async def run_tasks( + tasks: list[Task], + dataset_id: UUID = uuid4(), + data: Any = None, + pipeline_name: str = "unknown_pipeline", +): pipeline_id = uuid5(NAMESPACE_OID, pipeline_name) pipeline_run = await log_pipeline_run_start(pipeline_id, dataset_id, data) diff --git a/evals/eval_swe_bench.py b/evals/eval_swe_bench.py index c3178ce40c..07036ccd26 100644 --- a/evals/eval_swe_bench.py +++ b/evals/eval_swe_bench.py @@ -13,7 +13,7 @@ from cognee.modules.retrieval.description_to_codepart_search import ( code_description_to_code_part_search, ) -from evals.eval_utils import download_github_repo, retrieved_edges_to_string +from evals.eval_utils import download_github_repo def check_install_package(package_name): diff --git a/evals/qa_context_provider_utils.py b/evals/qa_context_provider_utils.py index c7e5ba15dc..6663b1d4a0 100644 --- a/evals/qa_context_provider_utils.py +++ b/evals/qa_context_provider_utils.py @@ -122,7 +122,7 @@ async def get_context_with_brute_force_triplet_search(instance: dict) -> str: found_triplets = await brute_force_triplet_search(instance["question"], top_k=5) - search_results_str = retrieved_edges_to_string(found_triplets) + search_results_str = await retrieved_edges_to_string(found_triplets) return search_results_str diff --git a/examples/python/graphiti_example.py b/examples/python/graphiti_example.py index 2a79110ea7..eba9ccea7b 100644 --- a/examples/python/graphiti_example.py +++ b/examples/python/graphiti_example.py @@ -51,7 +51,7 @@ async def main(): args = { "question": query, - "context": retrieved_edges_to_string(triplets), + "context": await retrieved_edges_to_string(triplets), } user_prompt = render_prompt("graph_context_for_question.txt", args) diff --git a/notebooks/cognee_graphiti_demo.ipynb b/notebooks/cognee_graphiti_demo.ipynb index 1ac2bfb6b1..857a72c16d 100644 --- a/notebooks/cognee_graphiti_demo.ipynb +++ b/notebooks/cognee_graphiti_demo.ipynb @@ -3,7 +3,9 @@ { "cell_type": "markdown", "metadata": {}, - "source": "# Cognee Graphiti integration demo" + "source": [ + "# Cognee Graphiti integration demo" + ] }, { "cell_type": "markdown", @@ -12,7 +14,9 @@ "languageId": "plaintext" } }, - "source": "First we import the necessary libaries" + "source": [ + "First we import the necessary libaries" + ] }, { "cell_type": "code", @@ -90,7 +94,9 @@ { "cell_type": "markdown", "metadata": {}, - "source": "## Input texts with temporal information" + "source": [ + "## Input texts with temporal information" + ] }, { "cell_type": "code", @@ -113,7 +119,9 @@ { "cell_type": "markdown", "metadata": {}, - "source": "## Running graphiti + transforming its graph into cognee's core system (graph transformation + vector embeddings)" + "source": [ + "## Running graphiti + transforming its graph into cognee's core system (graph transformation + vector embeddings)" + ] }, { "cell_type": "code", @@ -181,11 +189,13 @@ { "cell_type": "markdown", "metadata": {}, - "source": "## Retrieving and generating answer from graphiti graph with cognee retriever" + "source": [ + "## Retrieving and generating answer from graphiti graph with cognee retriever" + ] }, { "cell_type": "code", - "execution_count": 5, + "execution_count": null, "metadata": { "ExecuteTime": { "end_time": "2025-01-15T10:44:27.844438Z", @@ -213,7 +223,7 @@ ")\n", "\n", "# Step 3: Preparing the Context for the LLM\n", - "context = retrieved_edges_to_string(triplets)\n", + "context = await retrieved_edges_to_string(triplets)\n", "\n", "args = {\"question\": query, \"context\": context}\n", "\n",