graphiti-core 0.30.0rc1__py3-none-any.whl → 0.30.0rc2__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/node_operations.py +33 -6
- {graphiti_core-0.30.0rc1.dist-info → graphiti_core-0.30.0rc2.dist-info}/METADATA +1 -1
- {graphiti_core-0.30.0rc1.dist-info → graphiti_core-0.30.0rc2.dist-info}/RECORD +5 -5
- {graphiti_core-0.30.0rc1.dist-info → graphiti_core-0.30.0rc2.dist-info}/WHEEL +0 -0
- {graphiti_core-0.30.0rc1.dist-info → graphiti_core-0.30.0rc2.dist-info}/licenses/LICENSE +0 -0
|
@@ -241,7 +241,11 @@ async def _resolve_with_llm(
|
|
|
241
241
|
previous_episodes: list[EpisodicNode] | None,
|
|
242
242
|
entity_types: dict[str, type[BaseModel]] | None,
|
|
243
243
|
) -> None:
|
|
244
|
-
"""Escalate unresolved nodes to the dedupe prompt so the LLM can select or reject duplicates.
|
|
244
|
+
"""Escalate unresolved nodes to the dedupe prompt so the LLM can select or reject duplicates.
|
|
245
|
+
|
|
246
|
+
The guardrails below defensively ignore malformed or duplicate LLM responses so the
|
|
247
|
+
ingestion workflow remains deterministic even when the model misbehaves.
|
|
248
|
+
"""
|
|
245
249
|
if not state.unresolved_indices:
|
|
246
250
|
return
|
|
247
251
|
|
|
@@ -291,18 +295,41 @@ async def _resolve_with_llm(
|
|
|
291
295
|
|
|
292
296
|
node_resolutions: list[NodeDuplicate] = NodeResolutions(**llm_response).entity_resolutions
|
|
293
297
|
|
|
298
|
+
valid_relative_range = range(len(state.unresolved_indices))
|
|
299
|
+
processed_relative_ids: set[int] = set()
|
|
300
|
+
|
|
294
301
|
for resolution in node_resolutions:
|
|
295
302
|
relative_id: int = resolution.id
|
|
296
303
|
duplicate_idx: int = resolution.duplicate_idx
|
|
297
304
|
|
|
305
|
+
if relative_id not in valid_relative_range:
|
|
306
|
+
logger.warning(
|
|
307
|
+
'Skipping invalid LLM dedupe id %s (unresolved indices: %s)',
|
|
308
|
+
relative_id,
|
|
309
|
+
state.unresolved_indices,
|
|
310
|
+
)
|
|
311
|
+
continue
|
|
312
|
+
|
|
313
|
+
if relative_id in processed_relative_ids:
|
|
314
|
+
logger.warning('Duplicate LLM dedupe id %s received; ignoring.', relative_id)
|
|
315
|
+
continue
|
|
316
|
+
processed_relative_ids.add(relative_id)
|
|
317
|
+
|
|
298
318
|
original_index = state.unresolved_indices[relative_id]
|
|
299
319
|
extracted_node = extracted_nodes[original_index]
|
|
300
320
|
|
|
301
|
-
resolved_node
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
321
|
+
resolved_node: EntityNode
|
|
322
|
+
if duplicate_idx == -1:
|
|
323
|
+
resolved_node = extracted_node
|
|
324
|
+
elif 0 <= duplicate_idx < len(indexes.existing_nodes):
|
|
325
|
+
resolved_node = indexes.existing_nodes[duplicate_idx]
|
|
326
|
+
else:
|
|
327
|
+
logger.warning(
|
|
328
|
+
'Invalid duplicate_idx %s for extracted node %s; treating as no duplicate.',
|
|
329
|
+
duplicate_idx,
|
|
330
|
+
extracted_node.uuid,
|
|
331
|
+
)
|
|
332
|
+
resolved_node = extracted_node
|
|
306
333
|
|
|
307
334
|
state.resolved_nodes[original_index] = resolved_node
|
|
308
335
|
state.uuid_map[extracted_node.uuid] = resolved_node.uuid
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: graphiti-core
|
|
3
|
-
Version: 0.30.
|
|
3
|
+
Version: 0.30.0rc2
|
|
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
|
|
@@ -71,11 +71,11 @@ graphiti_core/utils/maintenance/community_operations.py,sha256=XMiokEemn96GlvjkO
|
|
|
71
71
|
graphiti_core/utils/maintenance/dedup_helpers.py,sha256=B7k6KkB6Sii8PZCWNNTvsNiy4BNTNWpoLeGgrPLq6BE,9220
|
|
72
72
|
graphiti_core/utils/maintenance/edge_operations.py,sha256=fvWKJWzz4_d2Y8bOfZFjJpLnGmsFwnrutFW25LX-S08,21287
|
|
73
73
|
graphiti_core/utils/maintenance/graph_data_operations.py,sha256=42icj3S_ELAJ-NK3jVS_rg_243dmnaZOyUitJj_uJ-M,6085
|
|
74
|
-
graphiti_core/utils/maintenance/node_operations.py,sha256=
|
|
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.0rc2.dist-info/METADATA,sha256=eGlZ91MklPKsP1m7Me1RivW4qPnc9wff6uIGZ5XRVqI,26933
|
|
79
|
+
graphiti_core-0.30.0rc2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
80
|
+
graphiti_core-0.30.0rc2.dist-info/licenses/LICENSE,sha256=KCUwCyDXuVEgmDWkozHyniRyWjnWUWjkuDHfU6o3JlA,11325
|
|
81
|
+
graphiti_core-0.30.0rc2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|