graphiti-core 0.7.4__py3-none-any.whl → 0.7.5__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.
@@ -31,9 +31,13 @@ class MissedEntities(BaseModel):
31
31
 
32
32
 
33
33
  class EntityClassification(BaseModel):
34
- entity_classification: str = Field(
34
+ entities: list[str] = Field(
35
35
  ...,
36
- description='Dictionary of entity classifications. Key is the entity name and value is the entity type',
36
+ description='List of entities',
37
+ )
38
+ entity_classifications: list[str | None] = Field(
39
+ ...,
40
+ description='List of entities classifications. The index of the classification should match the index of the entity it corresponds to.',
37
41
  )
38
42
 
39
43
 
@@ -180,7 +184,8 @@ def classify_nodes(context: dict[str, Any]) -> list[Message]:
180
184
 
181
185
  Guidelines:
182
186
  1. Each entity must have exactly one type
183
- 2. If none of the provided entity types accurately classify an extracted node, the type should be set to None
187
+ 2. Only use the provided ENTITY TYPES as types, do not use additional types to classify entities.
188
+ 3. If none of the provided entity types accurately classify an extracted node, the type should be set to None
184
189
  """
185
190
  return [
186
191
  Message(role='system', content=sys_prompt),
@@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  """
16
16
 
17
- import ast
18
17
  import logging
19
18
  from time import time
20
19
 
@@ -163,8 +162,9 @@ async def extract_nodes(
163
162
  prompt_library.extract_nodes.classify_nodes(node_classification_context),
164
163
  response_model=EntityClassification,
165
164
  )
166
- response_string = llm_response.get('entity_classification', '{}')
167
- node_classifications.update(ast.literal_eval(response_string))
165
+ entities = llm_response.get('entities', [])
166
+ entity_classifications = llm_response.get('entity_classifications', [])
167
+ node_classifications.update(dict(zip(entities, entity_classifications)))
168
168
 
169
169
  end = time()
170
170
  logger.debug(f'Extracted new nodes: {extracted_node_names} in {(end - start) * 1000} ms')
@@ -173,7 +173,9 @@ async def extract_nodes(
173
173
  for name in extracted_node_names:
174
174
  entity_type = node_classifications.get(name)
175
175
  labels = (
176
- ['Entity'] if entity_type is None or entity_type == 'None' else ['Entity', entity_type]
176
+ ['Entity']
177
+ if entity_type is None or entity_type == 'None' or entity_type == 'null'
178
+ else ['Entity', entity_type]
177
179
  )
178
180
 
179
181
  new_node = EntityNode(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: graphiti-core
3
- Version: 0.7.4
3
+ Version: 0.7.5
4
4
  Summary: A temporal graph building library
5
5
  License: Apache-2.0
6
6
  Author: Paul Paliychuk
@@ -32,7 +32,7 @@ graphiti_core/prompts/dedupe_nodes.py,sha256=mqvNATL-4Vo33vaxUEZfOq6hXXOiL-ftY0z
32
32
  graphiti_core/prompts/eval.py,sha256=csW494kKBMvWSm2SYLIRuGgNghhwNR3YwGn3veo3g_Y,3691
33
33
  graphiti_core/prompts/extract_edge_dates.py,sha256=td2yx2wnX-nLioMa0mtla3WcRyO71_wSjemT79YZGQ0,4096
34
34
  graphiti_core/prompts/extract_edges.py,sha256=vyEdW7JAPOT_eLWUi6nRmxbvucyVoyoYX2SxXfknRUg,3467
35
- graphiti_core/prompts/extract_nodes.py,sha256=-01MpcVd9drtmMDIpQkkzZe8YwVhedmdbZq7UNGfo24,6651
35
+ graphiti_core/prompts/extract_nodes.py,sha256=6WwcdmB0FcRYASqNIcSBoqIgTgj_lhU-Vgy65r7oLao,6891
36
36
  graphiti_core/prompts/invalidate_edges.py,sha256=DV2mEyIhhjc0hdKEMFLQMeG0FiUCkv_X0ctCliYjQ2c,3577
37
37
  graphiti_core/prompts/lib.py,sha256=oxhlpGEgV15VOLEZiwirxmIJBIdfzfiyL58iyzFDskE,4254
38
38
  graphiti_core/prompts/models.py,sha256=cvx_Bv5RMFUD_5IUawYrbpOKLPHogai7_bm7YXrSz84,867
@@ -52,10 +52,10 @@ graphiti_core/utils/maintenance/__init__.py,sha256=TRY3wWWu5kn3Oahk_KKhltrWnh0NA
52
52
  graphiti_core/utils/maintenance/community_operations.py,sha256=gIw1M5HGgc2c3TXag5ygPPpAv5WsG-yoC8Lhmfr6FMs,10011
53
53
  graphiti_core/utils/maintenance/edge_operations.py,sha256=tNw56vN586JYZMgie6RLRTiHZ680-kWzDIxW8ucL6SU,12780
54
54
  graphiti_core/utils/maintenance/graph_data_operations.py,sha256=qds9ALk9PhpQs1CNZTZGpi70mqJ93Y2KhIh9X2r8MUI,6533
55
- graphiti_core/utils/maintenance/node_operations.py,sha256=OAw8IHNGLLQ32lODffsZGZykQ0qOgidpLHrTAHVyUUM,14186
55
+ graphiti_core/utils/maintenance/node_operations.py,sha256=ty7_U9SNu4O7mgJgNvj-8THfoYGDDlKOo54EYHOC1wA,14292
56
56
  graphiti_core/utils/maintenance/temporal_operations.py,sha256=RdNtubCyYhOVrvcOIq2WppHls1Q-BEjtsN8r38l-Rtc,3691
57
57
  graphiti_core/utils/maintenance/utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
- graphiti_core-0.7.4.dist-info/LICENSE,sha256=KCUwCyDXuVEgmDWkozHyniRyWjnWUWjkuDHfU6o3JlA,11325
59
- graphiti_core-0.7.4.dist-info/METADATA,sha256=5FWWCZo1fKxmMuDrLF3_qxRhz18MBwOy2lMFrhVIFzk,10541
60
- graphiti_core-0.7.4.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
61
- graphiti_core-0.7.4.dist-info/RECORD,,
58
+ graphiti_core-0.7.5.dist-info/LICENSE,sha256=KCUwCyDXuVEgmDWkozHyniRyWjnWUWjkuDHfU6o3JlA,11325
59
+ graphiti_core-0.7.5.dist-info/METADATA,sha256=jJE1xBlbtBNv7FfIMpATqP6dnPTinuJwRrn8ppt2JqY,10541
60
+ graphiti_core-0.7.5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
61
+ graphiti_core-0.7.5.dist-info/RECORD,,