From 0fbe218eefb51349b9f583c480fce1417e2c42ed Mon Sep 17 00:00:00 2001 From: hajdul88 <52442977+hajdul88@users.noreply.github.com> Date: Mon, 18 Aug 2025 18:36:04 +0200 Subject: [PATCH] chore: fixes ruff --- cognee/modules/retrieval/base_feedback.py | 2 +- cognee/modules/retrieval/user_qa_feedback.py | 3 +-- cognee/modules/search/methods/search.py | 21 +++++++++++++++----- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/cognee/modules/retrieval/base_feedback.py b/cognee/modules/retrieval/base_feedback.py index 62ad443ee..7da55d374 100644 --- a/cognee/modules/retrieval/base_feedback.py +++ b/cognee/modules/retrieval/base_feedback.py @@ -8,4 +8,4 @@ class BaseFeedback(ABC): @abstractmethod async def add_feedback(self, feedback_text: str) -> Any: """Add user feedback to the system.""" - pass \ No newline at end of file + pass diff --git a/cognee/modules/retrieval/user_qa_feedback.py b/cognee/modules/retrieval/user_qa_feedback.py index 39f8c25f5..bca59e7f8 100644 --- a/cognee/modules/retrieval/user_qa_feedback.py +++ b/cognee/modules/retrieval/user_qa_feedback.py @@ -26,7 +26,6 @@ class UserQAFeedback(BaseFeedback): self.last_k = last_k async def add_feedback(self, feedback_text: str) -> List[str]: - feedback_sentiment = await LLMGateway.acreate_structured_output( text_input=feedback_text, system_prompt="You are a sentiment analysis assistant. For each piece of user feedback you receive, return exactly one of: Positive, Negative, or Neutral classification", @@ -75,4 +74,4 @@ class UserQAFeedback(BaseFeedback): graph_engine = await get_graph_engine() await graph_engine.add_edges(relationships) - return [feedback_text] \ No newline at end of file + return [feedback_text] diff --git a/cognee/modules/search/methods/search.py b/cognee/modules/search/methods/search.py index 5f5371af7..f5f2a793a 100644 --- a/cognee/modules/search/methods/search.py +++ b/cognee/modules/search/methods/search.py @@ -68,7 +68,7 @@ async def search( system_prompt_path=system_prompt_path, top_k=top_k, save_interaction=save_interaction, - last_k=last_k + last_k=last_k, ) query = await log_query(query_text, query_type.value, user.id) @@ -82,7 +82,7 @@ async def search( node_type=node_type, node_name=node_name, save_interaction=save_interaction, - last_k=last_k + last_k=last_k, ) await log_result( @@ -188,7 +188,14 @@ async def authorized_search( # Searches all provided datasets and handles setting up of appropriate database context based on permissions search_results = await specific_search_by_context( - search_datasets, query_text, query_type, user, system_prompt_path, top_k, save_interaction, last_k=last_k + search_datasets, + query_text, + query_type, + user, + system_prompt_path, + top_k, + save_interaction, + last_k=last_k, ) await log_result(query.id, json.dumps(search_results, cls=JSONEncoder), user.id) @@ -211,7 +218,9 @@ async def specific_search_by_context( Not to be used outside of active access control mode. """ - async def _search_by_context(dataset, user, query_type, query_text, system_prompt_path, top_k, last_k): + async def _search_by_context( + dataset, user, query_type, query_text, system_prompt_path, top_k, last_k + ): # Set database configuration in async context for each dataset user has access for await set_database_global_context_variables(dataset.id, dataset.owner_id) search_results = await specific_search( @@ -233,7 +242,9 @@ async def specific_search_by_context( tasks = [] for dataset in search_datasets: tasks.append( - _search_by_context(dataset, user, query_type, query_text, system_prompt_path, top_k, last_k) + _search_by_context( + dataset, user, query_type, query_text, system_prompt_path, top_k, last_k + ) ) return await asyncio.gather(*tasks)