Skip to content

Commit 1f5a1b8

Browse files
authored
cleanup (#894)
* cleanup * update * remove unused imports
1 parent c0fcc82 commit 1f5a1b8

File tree

11 files changed

+64
-284
lines changed

11 files changed

+64
-284
lines changed

graphiti_core/graphiti.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@
8989
)
9090
from graphiti_core.utils.maintenance.graph_data_operations import (
9191
EPISODE_WINDOW_LEN,
92-
build_dynamic_indexes,
9392
build_indices_and_constraints,
9493
retrieve_episodes,
9594
)
@@ -451,7 +450,6 @@ async def add_episode_endpoint(episode_data: EpisodeData):
451450

452451
validate_excluded_entity_types(excluded_entity_types, entity_types)
453452
validate_group_id(group_id)
454-
await build_dynamic_indexes(self.driver, group_id)
455453

456454
previous_episodes = (
457455
await self.retrieve_episodes(

graphiti_core/migrations/neo4j_node_group_labels.py

Lines changed: 0 additions & 114 deletions
This file was deleted.

graphiti_core/models/nodes/node_db_queries.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ def get_episode_node_save_query(provider: GraphProvider) -> str:
5252
case _: # Neo4j
5353
return """
5454
MERGE (n:Episodic {uuid: $uuid})
55-
SET n:$($group_label)
5655
SET n = {uuid: $uuid, name: $name, group_id: $group_id, source_description: $source_description, source: $source, content: $content,
5756
entity_edges: $entity_edges, created_at: $created_at, valid_at: $valid_at}
5857
RETURN n.uuid AS uuid
@@ -96,7 +95,6 @@ def get_episode_node_save_bulk_query(provider: GraphProvider) -> str:
9695
return """
9796
UNWIND $episodes AS episode
9897
MERGE (n:Episodic {uuid: episode.uuid})
99-
SET n:$(episode.group_label)
10098
SET n = {uuid: episode.uuid, name: episode.name, group_id: episode.group_id, source_description: episode.source_description, source: episode.source, content: episode.content,
10199
entity_edges: episode.entity_edges, created_at: episode.created_at, valid_at: episode.valid_at}
102100
RETURN n.uuid AS uuid

graphiti_core/nodes.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,9 +299,6 @@ async def save(self, driver: GraphDriver):
299299
'source': self.source.value,
300300
}
301301

302-
if driver.provider == GraphProvider.NEO4J:
303-
episode_args['group_label'] = 'Episodic_' + self.group_id.replace('-', '')
304-
305302
result = await driver.execute_query(
306303
get_episode_node_save_query(driver.provider), **episode_args
307304
)
@@ -471,7 +468,7 @@ async def save(self, driver: GraphDriver):
471468
)
472469
else:
473470
entity_data.update(self.attributes or {})
474-
labels = ':'.join(self.labels + ['Entity', 'Entity_' + self.group_id.replace('-', '')])
471+
labels = ':'.join(self.labels + ['Entity'])
475472

476473
if driver.provider == GraphProvider.NEPTUNE:
477474
driver.save_to_aoss('node_name_and_summary', [entity_data]) # pyright: ignore reportAttributeAccessIssue

graphiti_core/search/search.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,7 @@ async def node_search(
325325
search_tasks = []
326326
if NodeSearchMethod.bm25 in config.search_methods:
327327
search_tasks.append(
328-
node_fulltext_search(
329-
driver, query, search_filter, group_ids, 2 * limit, config.use_local_indexes
330-
)
328+
node_fulltext_search(driver, query, search_filter, group_ids, 2 * limit)
331329
)
332330
if NodeSearchMethod.cosine_similarity in config.search_methods:
333331
search_tasks.append(
@@ -338,7 +336,6 @@ async def node_search(
338336
group_ids,
339337
2 * limit,
340338
config.sim_min_score,
341-
config.use_local_indexes,
342339
)
343340
)
344341
if NodeSearchMethod.bfs in config.search_methods:
@@ -434,9 +431,7 @@ async def episode_search(
434431
search_results: list[list[EpisodicNode]] = list(
435432
await semaphore_gather(
436433
*[
437-
episode_fulltext_search(
438-
driver, query, search_filter, group_ids, 2 * limit, config.use_local_indexes
439-
),
434+
episode_fulltext_search(driver, query, search_filter, group_ids, 2 * limit),
440435
]
441436
)
442437
)

graphiti_core/search/search_config.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
DEFAULT_MIN_SCORE,
2525
DEFAULT_MMR_LAMBDA,
2626
MAX_SEARCH_DEPTH,
27-
USE_HNSW,
2827
)
2928

3029
DEFAULT_SEARCH_LIMIT = 10
@@ -92,7 +91,6 @@ class NodeSearchConfig(BaseModel):
9291
sim_min_score: float = Field(default=DEFAULT_MIN_SCORE)
9392
mmr_lambda: float = Field(default=DEFAULT_MMR_LAMBDA)
9493
bfs_max_depth: int = Field(default=MAX_SEARCH_DEPTH)
95-
use_local_indexes: bool = Field(default=USE_HNSW)
9694

9795

9896
class EpisodeSearchConfig(BaseModel):
@@ -101,7 +99,6 @@ class EpisodeSearchConfig(BaseModel):
10199
sim_min_score: float = Field(default=DEFAULT_MIN_SCORE)
102100
mmr_lambda: float = Field(default=DEFAULT_MMR_LAMBDA)
103101
bfs_max_depth: int = Field(default=MAX_SEARCH_DEPTH)
104-
use_local_indexes: bool = Field(default=USE_HNSW)
105102

106103

107104
class CommunitySearchConfig(BaseModel):
@@ -110,7 +107,6 @@ class CommunitySearchConfig(BaseModel):
110107
sim_min_score: float = Field(default=DEFAULT_MIN_SCORE)
111108
mmr_lambda: float = Field(default=DEFAULT_MMR_LAMBDA)
112109
bfs_max_depth: int = Field(default=MAX_SEARCH_DEPTH)
113-
use_local_indexes: bool = Field(default=USE_HNSW)
114110

115111

116112
class SearchConfig(BaseModel):

0 commit comments

Comments
 (0)