graphiti-core 0.21.0rc8__py3-none-any.whl → 0.21.0rc10__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/prompts/extract_edges.py +1 -1
- graphiti_core/prompts/extract_nodes.py +1 -1
- graphiti_core/utils/maintenance/edge_operations.py +1 -3
- graphiti_core/utils/maintenance/node_operations.py +19 -7
- {graphiti_core-0.21.0rc8.dist-info → graphiti_core-0.21.0rc10.dist-info}/METADATA +1 -1
- {graphiti_core-0.21.0rc8.dist-info → graphiti_core-0.21.0rc10.dist-info}/RECORD +8 -8
- {graphiti_core-0.21.0rc8.dist-info → graphiti_core-0.21.0rc10.dist-info}/WHEEL +0 -0
- {graphiti_core-0.21.0rc8.dist-info → graphiti_core-0.21.0rc10.dist-info}/licenses/LICENSE +0 -0
|
@@ -111,7 +111,7 @@ You may use information from the PREVIOUS MESSAGES only to disambiguate referenc
|
|
|
111
111
|
2. Each fact must involve two **distinct** entities.
|
|
112
112
|
3. Use a SCREAMING_SNAKE_CASE string as the `relation_type` (e.g., FOUNDED, WORKS_AT).
|
|
113
113
|
4. Do not emit duplicate or semantically redundant facts.
|
|
114
|
-
5. The `fact_text` should
|
|
114
|
+
5. The `fact_text` should closely paraphrase the original source sentence(s). Do not verbatim quote the original text.
|
|
115
115
|
6. Use `REFERENCE_TIME` to resolve vague or relative temporal expressions (e.g., "last week").
|
|
116
116
|
7. Do **not** hallucinate or infer temporal bounds from unrelated events.
|
|
117
117
|
|
|
@@ -151,7 +151,7 @@ For each entity extracted, also determine its entity type based on the provided
|
|
|
151
151
|
Indicate the classified entity type by providing its entity_type_id.
|
|
152
152
|
|
|
153
153
|
Guidelines:
|
|
154
|
-
1.
|
|
154
|
+
1. Extract all entities that the JSON represents. This will often be something like a "name" or "user" field
|
|
155
155
|
2. Extract all entities mentioned in all other properties throughout the JSON structure
|
|
156
156
|
3. Do NOT extract any properties that contain dates
|
|
157
157
|
"""
|
|
@@ -480,9 +480,7 @@ async def resolve_extracted_edge(
|
|
|
480
480
|
start = time()
|
|
481
481
|
|
|
482
482
|
# Prepare context for LLM
|
|
483
|
-
related_edges_context = [
|
|
484
|
-
{'id': i, 'fact': edge.fact} for i, edge in enumerate(related_edges)
|
|
485
|
-
]
|
|
483
|
+
related_edges_context = [{'id': i, 'fact': edge.fact} for i, edge in enumerate(related_edges)]
|
|
486
484
|
|
|
487
485
|
invalidation_edge_candidates_context = [
|
|
488
486
|
{'id': i, 'fact': existing_edge.fact} for i, existing_edge in enumerate(existing_edges)
|
|
@@ -15,6 +15,7 @@ limitations under the License.
|
|
|
15
15
|
"""
|
|
16
16
|
|
|
17
17
|
import logging
|
|
18
|
+
from collections.abc import Awaitable, Callable
|
|
18
19
|
from time import time
|
|
19
20
|
from typing import Any
|
|
20
21
|
|
|
@@ -55,6 +56,8 @@ from graphiti_core.utils.maintenance.edge_operations import (
|
|
|
55
56
|
|
|
56
57
|
logger = logging.getLogger(__name__)
|
|
57
58
|
|
|
59
|
+
NodeSummaryFilter = Callable[[EntityNode], Awaitable[bool]]
|
|
60
|
+
|
|
58
61
|
|
|
59
62
|
async def extract_nodes_reflexion(
|
|
60
63
|
llm_client: LLMClient,
|
|
@@ -402,6 +405,7 @@ async def extract_attributes_from_nodes(
|
|
|
402
405
|
episode: EpisodicNode | None = None,
|
|
403
406
|
previous_episodes: list[EpisodicNode] | None = None,
|
|
404
407
|
entity_types: dict[str, type[BaseModel]] | None = None,
|
|
408
|
+
should_summarize_node: NodeSummaryFilter | None = None,
|
|
405
409
|
) -> list[EntityNode]:
|
|
406
410
|
llm_client = clients.llm_client
|
|
407
411
|
embedder = clients.embedder
|
|
@@ -418,6 +422,7 @@ async def extract_attributes_from_nodes(
|
|
|
418
422
|
else None
|
|
419
423
|
),
|
|
420
424
|
clients.ensure_ascii,
|
|
425
|
+
should_summarize_node,
|
|
421
426
|
)
|
|
422
427
|
for node in nodes
|
|
423
428
|
]
|
|
@@ -435,6 +440,7 @@ async def extract_attributes_from_node(
|
|
|
435
440
|
previous_episodes: list[EpisodicNode] | None = None,
|
|
436
441
|
entity_type: type[BaseModel] | None = None,
|
|
437
442
|
ensure_ascii: bool = False,
|
|
443
|
+
should_summarize_node: NodeSummaryFilter | None = None,
|
|
438
444
|
) -> EntityNode:
|
|
439
445
|
node_context: dict[str, Any] = {
|
|
440
446
|
'name': node.name,
|
|
@@ -477,16 +483,22 @@ async def extract_attributes_from_node(
|
|
|
477
483
|
else {}
|
|
478
484
|
)
|
|
479
485
|
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
486
|
+
# Determine if summary should be generated
|
|
487
|
+
generate_summary = True
|
|
488
|
+
if should_summarize_node is not None:
|
|
489
|
+
generate_summary = await should_summarize_node(node)
|
|
490
|
+
|
|
491
|
+
# Conditionally generate summary
|
|
492
|
+
if generate_summary:
|
|
493
|
+
summary_response = await llm_client.generate_response(
|
|
494
|
+
prompt_library.extract_nodes.extract_summary(summary_context),
|
|
495
|
+
response_model=EntitySummary,
|
|
496
|
+
model_size=ModelSize.small,
|
|
497
|
+
)
|
|
498
|
+
node.summary = summary_response.get('summary', '')
|
|
485
499
|
|
|
486
500
|
if has_entity_attributes and entity_type is not None:
|
|
487
501
|
entity_type(**llm_response)
|
|
488
|
-
|
|
489
|
-
node.summary = summary_response.get('summary', '')
|
|
490
502
|
node_attributes = {key: value for key, value in llm_response.items()}
|
|
491
503
|
|
|
492
504
|
node.attributes.update(node_attributes)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: graphiti-core
|
|
3
|
-
Version: 0.21.
|
|
3
|
+
Version: 0.21.0rc10
|
|
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
|
|
@@ -47,8 +47,8 @@ graphiti_core/prompts/dedupe_edges.py,sha256=WRXQi7JQZdIfKDICWyU7Wbs5WyD_KBblLBS
|
|
|
47
47
|
graphiti_core/prompts/dedupe_nodes.py,sha256=H4sIzpi1gBwPedTMhdY175jnLj5JtnEeb_WNITitPLU,9171
|
|
48
48
|
graphiti_core/prompts/eval.py,sha256=ijwxbE87G678imdhfPvRujepQMq_JZ3XHX4vOAcVnVI,5507
|
|
49
49
|
graphiti_core/prompts/extract_edge_dates.py,sha256=3Drs3CmvP0gJN5BidWSxrNvLet3HPoTybU3BUIAoc0Y,4218
|
|
50
|
-
graphiti_core/prompts/extract_edges.py,sha256=
|
|
51
|
-
graphiti_core/prompts/extract_nodes.py,sha256=
|
|
50
|
+
graphiti_core/prompts/extract_edges.py,sha256=S115_KnenGJLjmVMzdarXBRj2wJ6y553UfYJgUTTDZI,6920
|
|
51
|
+
graphiti_core/prompts/extract_nodes.py,sha256=Ksf3PRBZ8LoZ5bOStZVRlHvVrdh3rT3xsepL81Ewy3M,11617
|
|
52
52
|
graphiti_core/prompts/invalidate_edges.py,sha256=yfpcs_pyctnoM77ULPZXEtKW0oHr1MeLsJzC5yrE-o4,3547
|
|
53
53
|
graphiti_core/prompts/lib.py,sha256=DCyHePM4_q-CptTpEXGO_dBv9k7xDtclEaB1dGu7EcI,4092
|
|
54
54
|
graphiti_core/prompts/models.py,sha256=NgxdbPHJpBEcpbXovKyScgpBc73Q-GIW-CBDlBtDjto,894
|
|
@@ -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=p16cLA2eJeIYS9W0o1i8wYtvUpjt9mGWzRXVemAr7Bk,25305
|
|
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=lKci3b9cC7agWReI_JfAo_hrFk006I7lEO-_J9ceMD8,17392
|
|
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.21.
|
|
79
|
-
graphiti_core-0.21.
|
|
80
|
-
graphiti_core-0.21.
|
|
81
|
-
graphiti_core-0.21.
|
|
78
|
+
graphiti_core-0.21.0rc10.dist-info/METADATA,sha256=7HH5nyTF5howUnxmmHT6hQFJhg26uuB6XoHBHUZrJVM,27085
|
|
79
|
+
graphiti_core-0.21.0rc10.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
80
|
+
graphiti_core-0.21.0rc10.dist-info/licenses/LICENSE,sha256=KCUwCyDXuVEgmDWkozHyniRyWjnWUWjkuDHfU6o3JlA,11325
|
|
81
|
+
graphiti_core-0.21.0rc10.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|