chore: ruff ruff

This commit is contained in:
hajdul88 2025-08-19 16:50:50 +02:00
parent 4a5d5f70d0
commit f5d8fc6e81
4 changed files with 13 additions and 15 deletions

View file

@ -1656,15 +1656,15 @@ class KuzuAdapter(GraphDBInterface):
return id_list return id_list
async def apply_feedback_weight( async def apply_feedback_weight(
self, self,
node_ids: List[str], node_ids: List[str],
weight: float, weight: float,
) -> None: ) -> None:
""" """
Increment `feedback_weight` inside r.properties JSON for edges where Increment `feedback_weight` inside r.properties JSON for edges where
relationship_name = 'used_graph_element_to_answer'. relationship_name = 'used_graph_element_to_answer'.
""" """
# Step 1: fetch matching edges # Step 1: fetch matching edges
query = """ query = """
MATCH (n:Node)-[r:EDGE]->() MATCH (n:Node)-[r:EDGE]->()

View file

@ -1347,9 +1347,9 @@ class Neo4jAdapter(GraphDBInterface):
return id_list return id_list
async def apply_feedback_weight( async def apply_feedback_weight(
self, self,
node_ids: List[str], node_ids: List[str],
weight: float, weight: float,
) -> None: ) -> None:
""" """
Increment `feedback_weight` on relationships `:used_graph_element_to_answer` Increment `feedback_weight` on relationships `:used_graph_element_to_answer`

View file

@ -73,14 +73,11 @@ class UserQAFeedback(BaseFeedback):
) )
to_node_ids.append(str(target_id_2)) to_node_ids.append(str(target_id_2))
if len(relationships) > 0: if len(relationships) > 0:
graph_engine = await get_graph_engine() graph_engine = await get_graph_engine()
await graph_engine.add_edges(relationships) await graph_engine.add_edges(relationships)
await graph_engine.apply_feedback_weight( await graph_engine.apply_feedback_weight(
node_ids=to_node_ids, node_ids=to_node_ids, weight=feedback_sentiment.score
weight=feedback_sentiment.score
) )
return [feedback_text] return [feedback_text]

View file

@ -4,6 +4,7 @@ from cognee.modules.engine.models.node_set import NodeSet
from enum import Enum from enum import Enum
from pydantic import BaseModel, Field, confloat from pydantic import BaseModel, Field, confloat
class CogneeUserInteraction(DataPoint): class CogneeUserInteraction(DataPoint):
"""User - Cognee interaction""" """User - Cognee interaction"""
@ -32,8 +33,8 @@ class UserFeedbackSentiment(str, Enum):
class UserFeedbackEvaluation(BaseModel): class UserFeedbackEvaluation(BaseModel):
"""User - User feedback evaluation""" """User - User feedback evaluation"""
score: confloat(ge=-5, le=5) = Field( score: confloat(ge=-5, le=5) = Field(
..., ..., description="Sentiment score from -5 (negative) to +5 (positive)"
description="Sentiment score from -5 (negative) to +5 (positive)"
) )
evaluation: UserFeedbackSentiment evaluation: UserFeedbackSentiment