Skip to content

Commit

Permalink
fix: formatter and linter
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-paliychuk committed Sep 24, 2024
1 parent 8678c59 commit de526d5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
12 changes: 6 additions & 6 deletions graphiti_core/utils/maintenance/community_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ async def generate_summary_description(llm_client: LLMClient, summary: str) -> s


async def build_community(
llm_client: LLMClient, community_cluster: list[EntityNode]
llm_client: LLMClient, community_cluster: list[EntityNode]
) -> tuple[CommunityNode, list[CommunityEdge]]:
summaries = [entity.summary for entity in community_cluster]
length = len(summaries)
Expand All @@ -168,7 +168,7 @@ async def build_community(
*[
summarize_pair(llm_client, (str(left_summary), str(right_summary)))
for left_summary, right_summary in zip(
summaries[: int(length / 2)], summaries[int(length / 2):]
summaries[: int(length / 2)], summaries[int(length / 2) :]
)
]
)
Expand Down Expand Up @@ -196,7 +196,7 @@ async def build_community(


async def build_communities(
driver: AsyncDriver, llm_client: LLMClient
driver: AsyncDriver, llm_client: LLMClient
) -> tuple[list[CommunityNode], list[CommunityEdge]]:
community_clusters = await get_community_clusters(driver)

Expand Down Expand Up @@ -227,7 +227,7 @@ async def remove_communities(driver: AsyncDriver):


async def determine_entity_community(
driver: AsyncDriver, entity: EntityNode
driver: AsyncDriver, entity: EntityNode
) -> tuple[CommunityNode | None, bool]:
# Check if the node is already part of a community
records, _, _ = await driver.execute_query(
Expand Down Expand Up @@ -288,7 +288,7 @@ async def determine_entity_community(


async def update_community(
driver: AsyncDriver, llm_client: LLMClient, embedder, entity: EntityNode
driver: AsyncDriver, llm_client: LLMClient, embedder, entity: EntityNode
):
community, is_new = await determine_entity_community(driver, entity)

Expand All @@ -307,4 +307,4 @@ async def update_community(

await community.generate_name_embedding(embedder)

await community.save(driver)
await community.save(driver)
5 changes: 4 additions & 1 deletion server/graph_service/routers/retrieve.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from datetime import datetime
from typing import List, Optional, cast

from fastapi import APIRouter, status

Expand All @@ -17,7 +18,9 @@
@router.post('/search', status_code=status.HTTP_200_OK)
async def search(query: SearchQuery, graphiti: ZepGraphitiDep):
relevant_edges = await graphiti.search(
group_ids=query.group_ids,
group_ids=cast(
Optional[List[Optional[str]]], query.group_ids
), # Cast query.group_ids to match the expected type in graphiti.search
query=query.query,
num_results=query.max_facts,
)
Expand Down

0 comments on commit de526d5

Please sign in to comment.