graphiti-core 0.30.0rc3__py3-none-any.whl → 0.30.0rc4__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/utils/maintenance/edge_operations.py +20 -5
- {graphiti_core-0.30.0rc3.dist-info → graphiti_core-0.30.0rc4.dist-info}/METADATA +1 -1
- {graphiti_core-0.30.0rc3.dist-info → graphiti_core-0.30.0rc4.dist-info}/RECORD +5 -5
- {graphiti_core-0.30.0rc3.dist-info → graphiti_core-0.30.0rc4.dist-info}/WHEEL +0 -0
- {graphiti_core-0.30.0rc3.dist-info → graphiti_core-0.30.0rc4.dist-info}/licenses/LICENSE +0 -0
|
@@ -43,6 +43,8 @@ from graphiti_core.search.search_filters import SearchFilters
|
|
|
43
43
|
from graphiti_core.utils.datetime_utils import ensure_utc, utc_now
|
|
44
44
|
from graphiti_core.utils.maintenance.dedup_helpers import _normalize_string_exact
|
|
45
45
|
|
|
46
|
+
DEFAULT_EDGE_NAME = 'RELATES_TO'
|
|
47
|
+
|
|
46
48
|
logger = logging.getLogger(__name__)
|
|
47
49
|
|
|
48
50
|
|
|
@@ -310,6 +312,15 @@ async def resolve_extracted_edges(
|
|
|
310
312
|
|
|
311
313
|
edge_types_lst.append(extracted_edge_types)
|
|
312
314
|
|
|
315
|
+
for extracted_edge, extracted_edge_types in zip(extracted_edges, edge_types_lst, strict=True):
|
|
316
|
+
allowed_type_names = set(extracted_edge_types)
|
|
317
|
+
if not allowed_type_names:
|
|
318
|
+
if extracted_edge.name != DEFAULT_EDGE_NAME:
|
|
319
|
+
extracted_edge.name = DEFAULT_EDGE_NAME
|
|
320
|
+
continue
|
|
321
|
+
if extracted_edge.name not in allowed_type_names:
|
|
322
|
+
extracted_edge.name = DEFAULT_EDGE_NAME
|
|
323
|
+
|
|
313
324
|
# resolve edges with related edges in the graph and find invalidation candidates
|
|
314
325
|
results: list[tuple[EntityEdge, list[EntityEdge], list[EntityEdge]]] = list(
|
|
315
326
|
await semaphore_gather(
|
|
@@ -392,7 +403,7 @@ async def resolve_extracted_edge(
|
|
|
392
403
|
related_edges: list[EntityEdge],
|
|
393
404
|
existing_edges: list[EntityEdge],
|
|
394
405
|
episode: EpisodicNode,
|
|
395
|
-
|
|
406
|
+
edge_type_candidates: dict[str, type[BaseModel]] | None = None,
|
|
396
407
|
ensure_ascii: bool = True,
|
|
397
408
|
) -> tuple[EntityEdge, list[EntityEdge], list[EntityEdge]]:
|
|
398
409
|
if len(related_edges) == 0 and len(existing_edges) == 0:
|
|
@@ -429,9 +440,9 @@ async def resolve_extracted_edge(
|
|
|
429
440
|
'fact_type_name': type_name,
|
|
430
441
|
'fact_type_description': type_model.__doc__,
|
|
431
442
|
}
|
|
432
|
-
for i, (type_name, type_model) in enumerate(
|
|
443
|
+
for i, (type_name, type_model) in enumerate(edge_type_candidates.items())
|
|
433
444
|
]
|
|
434
|
-
if
|
|
445
|
+
if edge_type_candidates is not None
|
|
435
446
|
else []
|
|
436
447
|
)
|
|
437
448
|
|
|
@@ -468,7 +479,8 @@ async def resolve_extracted_edge(
|
|
|
468
479
|
]
|
|
469
480
|
|
|
470
481
|
fact_type: str = response_object.fact_type
|
|
471
|
-
|
|
482
|
+
candidate_type_names = set(edge_type_candidates or {})
|
|
483
|
+
if candidate_type_names and fact_type in candidate_type_names:
|
|
472
484
|
resolved_edge.name = fact_type
|
|
473
485
|
|
|
474
486
|
edge_attributes_context = {
|
|
@@ -478,7 +490,7 @@ async def resolve_extracted_edge(
|
|
|
478
490
|
'ensure_ascii': ensure_ascii,
|
|
479
491
|
}
|
|
480
492
|
|
|
481
|
-
edge_model =
|
|
493
|
+
edge_model = edge_type_candidates.get(fact_type) if edge_type_candidates else None
|
|
482
494
|
if edge_model is not None and len(edge_model.model_fields) != 0:
|
|
483
495
|
edge_attributes_response = await llm_client.generate_response(
|
|
484
496
|
prompt_library.extract_edges.extract_attributes(edge_attributes_context),
|
|
@@ -487,6 +499,9 @@ async def resolve_extracted_edge(
|
|
|
487
499
|
)
|
|
488
500
|
|
|
489
501
|
resolved_edge.attributes = edge_attributes_response
|
|
502
|
+
elif fact_type.upper() != 'DEFAULT':
|
|
503
|
+
resolved_edge.name = DEFAULT_EDGE_NAME
|
|
504
|
+
resolved_edge.attributes = {}
|
|
490
505
|
|
|
491
506
|
end = time()
|
|
492
507
|
logger.debug(
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: graphiti-core
|
|
3
|
-
Version: 0.30.
|
|
3
|
+
Version: 0.30.0rc4
|
|
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
|
|
@@ -69,13 +69,13 @@ graphiti_core/utils/datetime_utils.py,sha256=J-zYSq7-H-2n9hYOXNIun12kM10vNX9mMAT
|
|
|
69
69
|
graphiti_core/utils/maintenance/__init__.py,sha256=vW4H1KyapTl-OOz578uZABYcpND4wPx3Vt6aAPaXh78,301
|
|
70
70
|
graphiti_core/utils/maintenance/community_operations.py,sha256=XMiokEemn96GlvjkOvbo9hIX04Fea3eVj408NHG5P4o,11042
|
|
71
71
|
graphiti_core/utils/maintenance/dedup_helpers.py,sha256=B7k6KkB6Sii8PZCWNNTvsNiy4BNTNWpoLeGgrPLq6BE,9220
|
|
72
|
-
graphiti_core/utils/maintenance/edge_operations.py,sha256=
|
|
72
|
+
graphiti_core/utils/maintenance/edge_operations.py,sha256=LHud849E-w6_arUszhbCEdqVxWFk_Hm-jv60YIY51zo,22015
|
|
73
73
|
graphiti_core/utils/maintenance/graph_data_operations.py,sha256=42icj3S_ELAJ-NK3jVS_rg_243dmnaZOyUitJj_uJ-M,6085
|
|
74
74
|
graphiti_core/utils/maintenance/node_operations.py,sha256=TKpXPtnTVxxan8I1xQyVkGn3zyRdb_Q00cgUpLcloig,16860
|
|
75
75
|
graphiti_core/utils/maintenance/temporal_operations.py,sha256=IIaVtShpVkOYe6haxz3a1x3v54-MzaEXG8VsxFUNeoY,3582
|
|
76
76
|
graphiti_core/utils/maintenance/utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
77
77
|
graphiti_core/utils/ontology_utils/entity_types_utils.py,sha256=4eVgxLWY6Q8k9cRJ5pW59IYF--U4nXZsZIGOVb_yHfQ,1285
|
|
78
|
-
graphiti_core-0.30.
|
|
79
|
-
graphiti_core-0.30.
|
|
80
|
-
graphiti_core-0.30.
|
|
81
|
-
graphiti_core-0.30.
|
|
78
|
+
graphiti_core-0.30.0rc4.dist-info/METADATA,sha256=W12RaBo2Hhk7ttsTVOIJbMZyj11BqH1B_4UTVJENqUw,26933
|
|
79
|
+
graphiti_core-0.30.0rc4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
80
|
+
graphiti_core-0.30.0rc4.dist-info/licenses/LICENSE,sha256=KCUwCyDXuVEgmDWkozHyniRyWjnWUWjkuDHfU6o3JlA,11325
|
|
81
|
+
graphiti_core-0.30.0rc4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|