graphiti-core 0.18.8__py3-none-any.whl → 0.18.9__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.

@@ -107,10 +107,10 @@ class BaseOpenAIClient(LLMClient):
107
107
 
108
108
  def _handle_structured_response(self, response: Any) -> dict[str, Any]:
109
109
  """Handle structured response parsing and validation."""
110
- response_object = response.choices[0].message
110
+ response_object = response.output_text
111
111
 
112
- if response_object.parsed:
113
- return response_object.parsed.model_dump()
112
+ if response_object:
113
+ return json.loads(response_object)
114
114
  elif response_object.refusal:
115
115
  raise RefusalError(response_object.refusal)
116
116
  else:
@@ -69,14 +69,16 @@ class OpenAIClient(BaseOpenAIClient):
69
69
  response_model: type[BaseModel],
70
70
  ):
71
71
  """Create a structured completion using OpenAI's beta parse API."""
72
- return await self.client.beta.chat.completions.parse(
72
+ response = await self.client.responses.parse(
73
73
  model=model,
74
- messages=messages,
74
+ input=messages, # type: ignore
75
75
  temperature=temperature,
76
- max_tokens=max_tokens,
77
- response_format=response_model, # type: ignore
76
+ max_output_tokens=max_tokens,
77
+ text_format=response_model, # type: ignore
78
78
  )
79
79
 
80
+ return response
81
+
80
82
  async def _create_completion(
81
83
  self,
82
84
  model: str,
@@ -94,6 +94,7 @@ Only extract facts that:
94
94
  - involve two DISTINCT ENTITIES from the ENTITIES list,
95
95
  - are clearly stated or unambiguously implied in the CURRENT MESSAGE,
96
96
  and can be represented as edges in a knowledge graph.
97
+ - Facts should include entity names rather than pronouns whenever possible.
97
98
  - The FACT TYPES provide a list of the most important types of facts, make sure to extract facts of these types
98
99
  - The FACT TYPES are not an exhaustive list, extract all facts from the message even if they do not fit into one
99
100
  of the FACT TYPES
@@ -100,7 +100,7 @@ Instructions:
100
100
 
101
101
  You are given a conversation context and a CURRENT MESSAGE. Your task is to extract **entity nodes** mentioned **explicitly or implicitly** in the CURRENT MESSAGE.
102
102
  Pronoun references such as he/she/they or this/that/those should be disambiguated to the names of the
103
- reference entities.
103
+ reference entities. Only extract distinct entities from the CURRENT MESSAGE. Don't extract pronouns like you, me, he/she/they, we/us as entities.
104
104
 
105
105
  1. **Speaker Extraction**: Always extract the speaker (the part before the colon `:` in each dialogue line) as the first entity node.
106
106
  - If the speaker is mentioned again in the message, treat both mentions as a **single entity**.
@@ -152,9 +152,13 @@ async def extract_nodes(
152
152
  # Convert the extracted data into EntityNode objects
153
153
  extracted_nodes = []
154
154
  for extracted_entity in filtered_extracted_entities:
155
- entity_type_name = entity_types_context[extracted_entity.entity_type_id].get(
156
- 'entity_type_name'
157
- )
155
+ type_id = extracted_entity.entity_type_id
156
+ if 0 <= type_id < len(entity_types_context):
157
+ entity_type_name = entity_types_context[extracted_entity.entity_type_id].get(
158
+ 'entity_type_name'
159
+ )
160
+ else:
161
+ entity_type_name = 'Entity'
158
162
 
159
163
  # Check if this entity type should be excluded
160
164
  if excluded_entity_types and entity_type_name in excluded_entity_types:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: graphiti-core
3
- Version: 0.18.8
3
+ Version: 0.18.9
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
@@ -30,8 +30,8 @@ graphiti_core/llm_client/config.py,sha256=90IgSBxZE_3nWdaEONVLUznI8lytPA7ZyexQz-
30
30
  graphiti_core/llm_client/errors.py,sha256=pn6brRiLW60DAUIXJYKBT6MInrS4ueuH1hNLbn_JbQo,1243
31
31
  graphiti_core/llm_client/gemini_client.py,sha256=m0-6SFUs8qqoR5rGTrASAcMtTbJKfZqO4-MaDr4CYCQ,17719
32
32
  graphiti_core/llm_client/groq_client.py,sha256=bYLE_cg1QEhugsJOXh4b1vPbxagKeMWqk48240GCzMs,2922
33
- graphiti_core/llm_client/openai_base_client.py,sha256=gfMcKPyLrylz_ouRdoenDWXyitmgfFZ17Zthbkq3Qs4,8126
34
- graphiti_core/llm_client/openai_client.py,sha256=ykBK94gxzE7iXux5rvOzVNA8q0Sqzq-8njPB75XcRe8,3240
33
+ graphiti_core/llm_client/openai_base_client.py,sha256=DXMl58nJYmVOKtemTMKFkdSU4kNFYdFG0RUFj8-xjE4,8104
34
+ graphiti_core/llm_client/openai_client.py,sha256=_Ga6GnnnlFgs4t6odlvBbjeHdUrrnLrkMYTVuYawNfs,3273
35
35
  graphiti_core/llm_client/openai_generic_client.py,sha256=WElMnPqdb1CxzYH4p2-m_9rVMr5M93-eXnc3yVxBgFg,7001
36
36
  graphiti_core/llm_client/utils.py,sha256=zKpxXEbKa369m4W7RDEf-m56kH46V1Mx3RowcWZEWWs,1000
37
37
  graphiti_core/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -44,8 +44,8 @@ graphiti_core/prompts/dedupe_edges.py,sha256=WRXQi7JQZdIfKDICWyU7Wbs5WyD_KBblLBS
44
44
  graphiti_core/prompts/dedupe_nodes.py,sha256=eYDk0axHEKLjZS2tKlT4Zy1fW9EJkn6EnrJLSN0fvAY,8235
45
45
  graphiti_core/prompts/eval.py,sha256=ijwxbE87G678imdhfPvRujepQMq_JZ3XHX4vOAcVnVI,5507
46
46
  graphiti_core/prompts/extract_edge_dates.py,sha256=3Drs3CmvP0gJN5BidWSxrNvLet3HPoTybU3BUIAoc0Y,4218
47
- graphiti_core/prompts/extract_edges.py,sha256=SbTB3dnvZ4vDy9aXMR-A3_RWUSk6CspaD7wwa_eXoys,6812
48
- graphiti_core/prompts/extract_nodes.py,sha256=EDaWp3uYnecM56oZfeRITDM_5qWmqecdzblfqhVuehk,11415
47
+ graphiti_core/prompts/extract_edges.py,sha256=mnncxb6lyr3ufKajRAh09czmJawiEM54sSPNy9ukiio,6888
48
+ graphiti_core/prompts/extract_nodes.py,sha256=YbdpFzVyMo7J0rPSbw4l5qqzoNQKsSfPKrDo75t2GWQ,11541
49
49
  graphiti_core/prompts/invalidate_edges.py,sha256=yfpcs_pyctnoM77ULPZXEtKW0oHr1MeLsJzC5yrE-o4,3547
50
50
  graphiti_core/prompts/lib.py,sha256=DCyHePM4_q-CptTpEXGO_dBv9k7xDtclEaB1dGu7EcI,4092
51
51
  graphiti_core/prompts/models.py,sha256=NgxdbPHJpBEcpbXovKyScgpBc73Q-GIW-CBDlBtDjto,894
@@ -67,11 +67,11 @@ graphiti_core/utils/maintenance/__init__.py,sha256=vW4H1KyapTl-OOz578uZABYcpND4w
67
67
  graphiti_core/utils/maintenance/community_operations.py,sha256=gHqsRtX19LVH88B70GNTGnnq5Ic5kcm0Gu24wKP3-yQ,10492
68
68
  graphiti_core/utils/maintenance/edge_operations.py,sha256=RHMUquo-BSkwvtWZBMZHzNZ-WtgCOuwz6cGLxD8Q46g,18773
69
69
  graphiti_core/utils/maintenance/graph_data_operations.py,sha256=joNZxL_OIFdXHBGkwtB57ar7nGmbq4Z8ItgqFWL45kw,4530
70
- graphiti_core/utils/maintenance/node_operations.py,sha256=SU-u69HrVJNvDsYC6kylcq78WUuYBiqUWHJdADNKcR4,13475
70
+ graphiti_core/utils/maintenance/node_operations.py,sha256=r9ilkA01eq1z-nF8P_s1EXG6A6j15qmnfIqetnzqF50,13644
71
71
  graphiti_core/utils/maintenance/temporal_operations.py,sha256=IIaVtShpVkOYe6haxz3a1x3v54-MzaEXG8VsxFUNeoY,3582
72
72
  graphiti_core/utils/maintenance/utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
73
73
  graphiti_core/utils/ontology_utils/entity_types_utils.py,sha256=4eVgxLWY6Q8k9cRJ5pW59IYF--U4nXZsZIGOVb_yHfQ,1285
74
- graphiti_core-0.18.8.dist-info/METADATA,sha256=ob__yXgSiHLeiccQn-nLA5TlsdTQKMYkrrZk3eHfcV0,24613
75
- graphiti_core-0.18.8.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
76
- graphiti_core-0.18.8.dist-info/licenses/LICENSE,sha256=KCUwCyDXuVEgmDWkozHyniRyWjnWUWjkuDHfU6o3JlA,11325
77
- graphiti_core-0.18.8.dist-info/RECORD,,
74
+ graphiti_core-0.18.9.dist-info/METADATA,sha256=3cBkzYWMDv2X3jy74bmi4-Yj0LpfVUBjPOI2BnvYLdg,24613
75
+ graphiti_core-0.18.9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
76
+ graphiti_core-0.18.9.dist-info/licenses/LICENSE,sha256=KCUwCyDXuVEgmDWkozHyniRyWjnWUWjkuDHfU6o3JlA,11325
77
+ graphiti_core-0.18.9.dist-info/RECORD,,