graphiti-core 0.22.1rc1__py3-none-any.whl → 0.22.1rc2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of graphiti-core might be problematic. Click here for more details.
- graphiti_core/driver/graph_operations/graph_operations.py +4 -8
- graphiti_core/search/search_utils.py +58 -54
- {graphiti_core-0.22.1rc1.dist-info → graphiti_core-0.22.1rc2.dist-info}/METADATA +1 -1
- {graphiti_core-0.22.1rc1.dist-info → graphiti_core-0.22.1rc2.dist-info}/RECORD +6 -6
- {graphiti_core-0.22.1rc1.dist-info → graphiti_core-0.22.1rc2.dist-info}/WHEEL +0 -0
- {graphiti_core-0.22.1rc1.dist-info → graphiti_core-0.22.1rc2.dist-info}/licenses/LICENSE +0 -0
|
@@ -77,14 +77,12 @@ class GraphOperationsInterface(BaseModel):
|
|
|
77
77
|
|
|
78
78
|
async def node_load_embeddings_bulk(
|
|
79
79
|
self,
|
|
80
|
-
_cls: Any,
|
|
81
80
|
driver: Any,
|
|
82
|
-
transaction: Any,
|
|
83
81
|
nodes: list[Any],
|
|
84
82
|
batch_size: int = 100,
|
|
85
|
-
) ->
|
|
83
|
+
) -> dict[str, list[float]]:
|
|
86
84
|
"""
|
|
87
|
-
Load embedding vectors for many nodes in batches.
|
|
85
|
+
Load embedding vectors for many nodes in batches.
|
|
88
86
|
"""
|
|
89
87
|
raise NotImplementedError
|
|
90
88
|
|
|
@@ -183,13 +181,11 @@ class GraphOperationsInterface(BaseModel):
|
|
|
183
181
|
|
|
184
182
|
async def edge_load_embeddings_bulk(
|
|
185
183
|
self,
|
|
186
|
-
_cls: Any,
|
|
187
184
|
driver: Any,
|
|
188
|
-
transaction: Any,
|
|
189
185
|
edges: list[Any],
|
|
190
186
|
batch_size: int = 100,
|
|
191
|
-
) ->
|
|
187
|
+
) -> dict[str, list[float]]:
|
|
192
188
|
"""
|
|
193
|
-
Load embedding vectors for many edges in batches
|
|
189
|
+
Load embedding vectors for many edges in batches
|
|
194
190
|
"""
|
|
195
191
|
raise NotImplementedError
|
|
@@ -217,11 +217,11 @@ async def edge_fulltext_search(
|
|
|
217
217
|
# Match the edge ids and return the values
|
|
218
218
|
query = (
|
|
219
219
|
"""
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
220
|
+
UNWIND $ids as id
|
|
221
|
+
MATCH (n:Entity)-[e:RELATES_TO]->(m:Entity)
|
|
222
|
+
WHERE e.group_id IN $group_ids
|
|
223
|
+
AND id(e)=id
|
|
224
|
+
"""
|
|
225
225
|
+ filter_query
|
|
226
226
|
+ """
|
|
227
227
|
AND id(e)=id
|
|
@@ -339,8 +339,8 @@ async def edge_similarity_search(
|
|
|
339
339
|
if driver.provider == GraphProvider.NEPTUNE:
|
|
340
340
|
query = (
|
|
341
341
|
"""
|
|
342
|
-
|
|
343
|
-
|
|
342
|
+
MATCH (n:Entity)-[e:RELATES_TO]->(m:Entity)
|
|
343
|
+
"""
|
|
344
344
|
+ filter_query
|
|
345
345
|
+ """
|
|
346
346
|
RETURN DISTINCT id(e) as id, e.fact_embedding as embedding
|
|
@@ -596,11 +596,11 @@ async def node_fulltext_search(
|
|
|
596
596
|
# Match the edge ides and return the values
|
|
597
597
|
query = (
|
|
598
598
|
"""
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
599
|
+
UNWIND $ids as i
|
|
600
|
+
MATCH (n:Entity)
|
|
601
|
+
WHERE n.uuid=i.id
|
|
602
|
+
RETURN
|
|
603
|
+
"""
|
|
604
604
|
+ get_entity_node_return_query(driver.provider)
|
|
605
605
|
+ """
|
|
606
606
|
ORDER BY i.score DESC
|
|
@@ -678,8 +678,8 @@ async def node_similarity_search(
|
|
|
678
678
|
if driver.provider == GraphProvider.NEPTUNE:
|
|
679
679
|
query = (
|
|
680
680
|
"""
|
|
681
|
-
|
|
682
|
-
|
|
681
|
+
MATCH (n:Entity)
|
|
682
|
+
"""
|
|
683
683
|
+ filter_query
|
|
684
684
|
+ """
|
|
685
685
|
RETURN DISTINCT id(n) as id, n.name_embedding as embedding
|
|
@@ -708,11 +708,11 @@ async def node_similarity_search(
|
|
|
708
708
|
# Match the edge ides and return the values
|
|
709
709
|
query = (
|
|
710
710
|
"""
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
711
|
+
UNWIND $ids as i
|
|
712
|
+
MATCH (n:Entity)
|
|
713
|
+
WHERE id(n)=i.id
|
|
714
|
+
RETURN
|
|
715
|
+
"""
|
|
716
716
|
+ get_entity_node_return_query(driver.provider)
|
|
717
717
|
+ """
|
|
718
718
|
ORDER BY i.score DESC
|
|
@@ -733,8 +733,8 @@ async def node_similarity_search(
|
|
|
733
733
|
else:
|
|
734
734
|
query = (
|
|
735
735
|
"""
|
|
736
|
-
|
|
737
|
-
|
|
736
|
+
MATCH (n:Entity)
|
|
737
|
+
"""
|
|
738
738
|
+ filter_query
|
|
739
739
|
+ """
|
|
740
740
|
WITH n, """
|
|
@@ -1037,8 +1037,8 @@ async def community_similarity_search(
|
|
|
1037
1037
|
if driver.provider == GraphProvider.NEPTUNE:
|
|
1038
1038
|
query = (
|
|
1039
1039
|
"""
|
|
1040
|
-
|
|
1041
|
-
|
|
1040
|
+
MATCH (n:Community)
|
|
1041
|
+
"""
|
|
1042
1042
|
+ group_filter_query
|
|
1043
1043
|
+ """
|
|
1044
1044
|
RETURN DISTINCT id(n) as id, n.name_embedding as embedding
|
|
@@ -1097,8 +1097,8 @@ async def community_similarity_search(
|
|
|
1097
1097
|
|
|
1098
1098
|
query = (
|
|
1099
1099
|
"""
|
|
1100
|
-
|
|
1101
|
-
|
|
1100
|
+
MATCH (c:Community)
|
|
1101
|
+
"""
|
|
1102
1102
|
+ group_filter_query
|
|
1103
1103
|
+ """
|
|
1104
1104
|
WITH c,
|
|
@@ -1240,9 +1240,9 @@ async def get_relevant_nodes(
|
|
|
1240
1240
|
# FIXME: Kuzu currently does not support using variables such as `node.fulltext_query` as an input to FTS, which means `get_relevant_nodes()` won't work with Kuzu as the graph driver.
|
|
1241
1241
|
query = (
|
|
1242
1242
|
"""
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1243
|
+
UNWIND $nodes AS node
|
|
1244
|
+
MATCH (n:Entity {group_id: $group_id})
|
|
1245
|
+
"""
|
|
1246
1246
|
+ filter_query
|
|
1247
1247
|
+ """
|
|
1248
1248
|
WITH node, n, """
|
|
@@ -1287,9 +1287,9 @@ async def get_relevant_nodes(
|
|
|
1287
1287
|
else:
|
|
1288
1288
|
query = (
|
|
1289
1289
|
"""
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1290
|
+
UNWIND $nodes AS node
|
|
1291
|
+
MATCH (n:Entity {group_id: $group_id})
|
|
1292
|
+
"""
|
|
1293
1293
|
+ filter_query
|
|
1294
1294
|
+ """
|
|
1295
1295
|
WITH node, n, """
|
|
@@ -1378,9 +1378,9 @@ async def get_relevant_edges(
|
|
|
1378
1378
|
if driver.provider == GraphProvider.NEPTUNE:
|
|
1379
1379
|
query = (
|
|
1380
1380
|
"""
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1381
|
+
UNWIND $edges AS edge
|
|
1382
|
+
MATCH (n:Entity {uuid: edge.source_node_uuid})-[e:RELATES_TO {group_id: edge.group_id}]-(m:Entity {uuid: edge.target_node_uuid})
|
|
1383
|
+
"""
|
|
1384
1384
|
+ filter_query
|
|
1385
1385
|
+ """
|
|
1386
1386
|
WITH e, edge
|
|
@@ -1450,9 +1450,9 @@ async def get_relevant_edges(
|
|
|
1450
1450
|
|
|
1451
1451
|
query = (
|
|
1452
1452
|
"""
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1453
|
+
UNWIND $edges AS edge
|
|
1454
|
+
MATCH (n:Entity {uuid: edge.source_node_uuid})-[:RELATES_TO]-(e:RelatesToNode_ {group_id: edge.group_id})-[:RELATES_TO]-(m:Entity {uuid: edge.target_node_uuid})
|
|
1455
|
+
"""
|
|
1456
1456
|
+ filter_query
|
|
1457
1457
|
+ """
|
|
1458
1458
|
WITH e, edge, n, m, """
|
|
@@ -1488,9 +1488,9 @@ async def get_relevant_edges(
|
|
|
1488
1488
|
else:
|
|
1489
1489
|
query = (
|
|
1490
1490
|
"""
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1491
|
+
UNWIND $edges AS edge
|
|
1492
|
+
MATCH (n:Entity {uuid: edge.source_node_uuid})-[e:RELATES_TO {group_id: edge.group_id}]-(m:Entity {uuid: edge.target_node_uuid})
|
|
1493
|
+
"""
|
|
1494
1494
|
+ filter_query
|
|
1495
1495
|
+ """
|
|
1496
1496
|
WITH e, edge, """
|
|
@@ -1563,10 +1563,10 @@ async def get_edge_invalidation_candidates(
|
|
|
1563
1563
|
if driver.provider == GraphProvider.NEPTUNE:
|
|
1564
1564
|
query = (
|
|
1565
1565
|
"""
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1566
|
+
UNWIND $edges AS edge
|
|
1567
|
+
MATCH (n:Entity)-[e:RELATES_TO {group_id: edge.group_id}]->(m:Entity)
|
|
1568
|
+
WHERE n.uuid IN [edge.source_node_uuid, edge.target_node_uuid] OR m.uuid IN [edge.target_node_uuid, edge.source_node_uuid]
|
|
1569
|
+
"""
|
|
1570
1570
|
+ filter_query
|
|
1571
1571
|
+ """
|
|
1572
1572
|
WITH e, edge
|
|
@@ -1636,10 +1636,10 @@ async def get_edge_invalidation_candidates(
|
|
|
1636
1636
|
|
|
1637
1637
|
query = (
|
|
1638
1638
|
"""
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1639
|
+
UNWIND $edges AS edge
|
|
1640
|
+
MATCH (n:Entity)-[:RELATES_TO]->(e:RelatesToNode_ {group_id: edge.group_id})-[:RELATES_TO]->(m:Entity)
|
|
1641
|
+
WHERE (n.uuid IN [edge.source_node_uuid, edge.target_node_uuid] OR m.uuid IN [edge.target_node_uuid, edge.source_node_uuid])
|
|
1642
|
+
"""
|
|
1643
1643
|
+ filter_query
|
|
1644
1644
|
+ """
|
|
1645
1645
|
WITH edge, e, n, m, """
|
|
@@ -1675,10 +1675,10 @@ async def get_edge_invalidation_candidates(
|
|
|
1675
1675
|
else:
|
|
1676
1676
|
query = (
|
|
1677
1677
|
"""
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1678
|
+
UNWIND $edges AS edge
|
|
1679
|
+
MATCH (n:Entity)-[e:RELATES_TO {group_id: edge.group_id}]->(m:Entity)
|
|
1680
|
+
WHERE n.uuid IN [edge.source_node_uuid, edge.target_node_uuid] OR m.uuid IN [edge.target_node_uuid, edge.source_node_uuid]
|
|
1681
|
+
"""
|
|
1682
1682
|
+ filter_query
|
|
1683
1683
|
+ """
|
|
1684
1684
|
WITH edge, e, """
|
|
@@ -1879,7 +1879,9 @@ def maximal_marginal_relevance(
|
|
|
1879
1879
|
async def get_embeddings_for_nodes(
|
|
1880
1880
|
driver: GraphDriver, nodes: list[EntityNode]
|
|
1881
1881
|
) -> dict[str, list[float]]:
|
|
1882
|
-
if driver.
|
|
1882
|
+
if driver.graph_operations_interface:
|
|
1883
|
+
return await driver.graph_operations_interface.node_load_embeddings_bulk(driver, nodes)
|
|
1884
|
+
elif driver.provider == GraphProvider.NEPTUNE:
|
|
1883
1885
|
query = """
|
|
1884
1886
|
MATCH (n:Entity)
|
|
1885
1887
|
WHERE n.uuid IN $node_uuids
|
|
@@ -1949,7 +1951,9 @@ async def get_embeddings_for_communities(
|
|
|
1949
1951
|
async def get_embeddings_for_edges(
|
|
1950
1952
|
driver: GraphDriver, edges: list[EntityEdge]
|
|
1951
1953
|
) -> dict[str, list[float]]:
|
|
1952
|
-
if driver.
|
|
1954
|
+
if driver.graph_operations_interface:
|
|
1955
|
+
return await driver.graph_operations_interface.edge_load_embeddings_bulk(driver, edges)
|
|
1956
|
+
elif driver.provider == GraphProvider.NEPTUNE:
|
|
1953
1957
|
query = """
|
|
1954
1958
|
MATCH (n:Entity)-[e:RELATES_TO]-(m:Entity)
|
|
1955
1959
|
WHERE e.uuid IN $edge_uuids
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: graphiti-core
|
|
3
|
-
Version: 0.22.
|
|
3
|
+
Version: 0.22.1rc2
|
|
4
4
|
Summary: A temporal graph building library
|
|
5
5
|
Project-URL: Homepage, https://help.getzep.com/graphiti/graphiti/overview
|
|
6
6
|
Project-URL: Repository, https://github.com/getzep/graphiti
|
|
@@ -20,7 +20,7 @@ graphiti_core/driver/kuzu_driver.py,sha256=RcWu8E0CCdofrFe34NmCeqfuhaZr_7ZN5jqDk
|
|
|
20
20
|
graphiti_core/driver/neo4j_driver.py,sha256=XrfxKdIV89TK8q4Am67jY8__5qf5IRoLmrKYS2NWHiU,2705
|
|
21
21
|
graphiti_core/driver/neptune_driver.py,sha256=dyQcaA5VnpNA_XkaWdvgGN3Q0QqbxWcVIud--yT8qhE,11266
|
|
22
22
|
graphiti_core/driver/graph_operations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
|
-
graphiti_core/driver/graph_operations/graph_operations.py,sha256=
|
|
23
|
+
graphiti_core/driver/graph_operations/graph_operations.py,sha256=9Qxs4za1kUNnpGzkO_z2zX4wPvYq6KWan30WlCH-vw8,5284
|
|
24
24
|
graphiti_core/driver/search_interface/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
25
25
|
graphiti_core/driver/search_interface/search_interface.py,sha256=-lnPsXdv_4feULbOnuWUQN2wmLqcUkGMwmR74jaFyMI,2500
|
|
26
26
|
graphiti_core/embedder/__init__.py,sha256=EL564ZuE-DZjcuKNUK_exMn_XHXm2LdO9fzdXePVKL4,179
|
|
@@ -66,7 +66,7 @@ graphiti_core/search/search_config.py,sha256=v_rUHsu1yo5OuPfEm21lSuXexQs-o8qYwSS
|
|
|
66
66
|
graphiti_core/search/search_config_recipes.py,sha256=4GquRphHhJlpXQhAZOySYnCzBWYoTwxlJj44eTOavZQ,7443
|
|
67
67
|
graphiti_core/search/search_filters.py,sha256=88LiffneuCcSrddH9Gvxua3qlzvh94P-24NITJy3Nzg,8858
|
|
68
68
|
graphiti_core/search/search_helpers.py,sha256=oty-IHVPf_0HxXsSGx21iPML9hMACDcECmdhkGltmVg,2691
|
|
69
|
-
graphiti_core/search/search_utils.py,sha256=
|
|
69
|
+
graphiti_core/search/search_utils.py,sha256=vT0G62T6JXE9bqRJFeLg4dKcHVtJpIOGkmufuvBHw28,71754
|
|
70
70
|
graphiti_core/telemetry/__init__.py,sha256=5kALLDlU9bb2v19CdN7qVANsJWyfnL9E60J6FFgzm3o,226
|
|
71
71
|
graphiti_core/telemetry/telemetry.py,sha256=47LrzOVBCcZxsYPsnSxWFiztHoxYKKxPwyRX0hnbDGc,3230
|
|
72
72
|
graphiti_core/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -81,7 +81,7 @@ graphiti_core/utils/maintenance/graph_data_operations.py,sha256=iH_1p9Mm8pg5H3_O
|
|
|
81
81
|
graphiti_core/utils/maintenance/node_operations.py,sha256=70G-Kf1mQJ_9XTi9MJmq5dqC28VJHRxkoAwgMRx4Gvo,20143
|
|
82
82
|
graphiti_core/utils/maintenance/temporal_operations.py,sha256=LWMw8D8-XOZkl412QKa5qOe9vsX_kOhis_dZlwSXY14,3539
|
|
83
83
|
graphiti_core/utils/ontology_utils/entity_types_utils.py,sha256=4eVgxLWY6Q8k9cRJ5pW59IYF--U4nXZsZIGOVb_yHfQ,1285
|
|
84
|
-
graphiti_core-0.22.
|
|
85
|
-
graphiti_core-0.22.
|
|
86
|
-
graphiti_core-0.22.
|
|
87
|
-
graphiti_core-0.22.
|
|
84
|
+
graphiti_core-0.22.1rc2.dist-info/METADATA,sha256=kjObryJ6fd2Ymx76gb7z1uEUIUb8XU-SPSF4AMDQlVU,28666
|
|
85
|
+
graphiti_core-0.22.1rc2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
86
|
+
graphiti_core-0.22.1rc2.dist-info/licenses/LICENSE,sha256=KCUwCyDXuVEgmDWkozHyniRyWjnWUWjkuDHfU6o3JlA,11325
|
|
87
|
+
graphiti_core-0.22.1rc2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|