From d7ff762e05fb5fd4199e18913643de093254d53f Mon Sep 17 00:00:00 2001 From: estelle Date: Thu, 2 Jan 2025 09:59:05 +0100 Subject: [PATCH] First argument must be the function + ruff --- src/neo4j_graphrag/experimental/pipeline/kg_builder.py | 6 ++++-- src/neo4j_graphrag/utils.py | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/neo4j_graphrag/experimental/pipeline/kg_builder.py b/src/neo4j_graphrag/experimental/pipeline/kg_builder.py index e459fb25..34d2a3fd 100644 --- a/src/neo4j_graphrag/experimental/pipeline/kg_builder.py +++ b/src/neo4j_graphrag/experimental/pipeline/kg_builder.py @@ -126,6 +126,8 @@ async def run_async( """ return await self.runner.run({"file_path": file_path, "text": text}) - def run(self, file_path: Optional[str] = None, text: Optional[str] = None) -> PipelineResult: + def run( + self, file_path: Optional[str] = None, text: Optional[str] = None + ) -> PipelineResult: """Run pipeline synchronously""" - return run_sync(self, file_path=file_path, text=text) + return run_sync(self.run_async, file_path=file_path, text=text) diff --git a/src/neo4j_graphrag/utils.py b/src/neo4j_graphrag/utils.py index 1962630f..20901d2c 100644 --- a/src/neo4j_graphrag/utils.py +++ b/src/neo4j_graphrag/utils.py @@ -14,10 +14,10 @@ # limitations under the License. from __future__ import annotations -from functools import wraps -from typing import Optional import asyncio import concurrent.futures +from functools import wraps +from typing import Optional def validate_search_query_input( @@ -38,4 +38,5 @@ def async_to_sync(func): @wraps(func) def wrapper(*args, **kwargs): return run_sync(func, *args, **kwargs) + return wrapper