graphiti-core 0.18.7__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.

@@ -84,7 +84,7 @@ class OpenAIRerankerClient(CrossEncoderClient):
84
84
  responses = await semaphore_gather(
85
85
  *[
86
86
  self.client.chat.completions.create(
87
- model=DEFAULT_MODEL,
87
+ model=self.config.model or DEFAULT_MODEL,
88
88
  messages=openai_messages,
89
89
  temperature=0,
90
90
  max_tokens=1,
@@ -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,
@@ -111,7 +111,7 @@ def get_community_node_save_query(provider: GraphProvider) -> str:
111
111
  if provider == GraphProvider.FALKORDB:
112
112
  return """
113
113
  MERGE (n:Community {uuid: $uuid})
114
- SET n = {uuid: $uuid, name: $name, group_id: $group_id, summary: $summary, created_at: $created_at, name_embedding: $name_embedding}
114
+ SET n = {uuid: $uuid, name: $name, group_id: $group_id, summary: $summary, created_at: $created_at, name_embedding: vecf32($name_embedding)}
115
115
  RETURN n.uuid AS uuid
116
116
  """
117
117
 
@@ -108,7 +108,7 @@ def nodes(context: dict[str, Any]) -> list[Message]:
108
108
  Message(
109
109
  role='system',
110
110
  content='You are a helpful assistant that determines whether or not ENTITIES extracted from a conversation are duplicates'
111
- 'of existing entities.',
111
+ ' of existing entities.',
112
112
  ),
113
113
  Message(
114
114
  role='user',
@@ -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**.
@@ -33,7 +33,8 @@ async def get_community_clusters(
33
33
  if group_ids is None:
34
34
  group_id_values, _, _ = await driver.execute_query(
35
35
  """
36
- MATCH (n:Entity WHERE n.group_id IS NOT NULL)
36
+ MATCH (n:Entity)
37
+ WHERE n.group_id IS NOT NULL
37
38
  RETURN
38
39
  collect(DISTINCT n.group_id) AS group_ids
39
40
  """,
@@ -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.7
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
@@ -11,7 +11,7 @@ graphiti_core/cross_encoder/__init__.py,sha256=hry59vz21x-AtGZ0MJ7ugw0HTwJkXiddp
11
11
  graphiti_core/cross_encoder/bge_reranker_client.py,sha256=y3TfFxZh0Yvj6HUShmfUm6MC7OPXwWUlv1Qe5HF3S3I,1797
12
12
  graphiti_core/cross_encoder/client.py,sha256=KLsbfWKOEaAV3adFe3XZlAeb-gje9_sVKCVZTaJP3ac,1441
13
13
  graphiti_core/cross_encoder/gemini_reranker_client.py,sha256=hmITG5YIib52nrKvINwRi4xTfAO1U4jCCaEVIwImHw0,6208
14
- graphiti_core/cross_encoder/openai_reranker_client.py,sha256=hoaGyu9nCNMJyP8si0Bha5Q9CFszfiHQmLgE9IsX7sY,4653
14
+ graphiti_core/cross_encoder/openai_reranker_client.py,sha256=WHMl6Q6gEslR2EzjwpFSZt2Kh6bnu8alkLvzmi0MDtg,4674
15
15
  graphiti_core/driver/__init__.py,sha256=kCWimqQU19airu5gKwCmZtZuXkDfaQfKSUhMDoL-rTA,626
16
16
  graphiti_core/driver/driver.py,sha256=XFJzkyZKiqhwwW6G9enB2ouWxNB53PU58nhSCW_LOIc,2331
17
17
  graphiti_core/driver/falkordb_driver.py,sha256=YLNuPvPBM7Pgr3Pv9gDuTVDGeDgHvEg8xD58uDYNweM,6766
@@ -30,22 +30,22 @@ 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
38
38
  graphiti_core/models/edges/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
39
39
  graphiti_core/models/edges/edge_db_queries.py,sha256=OBFqT9m6JDmGwpqe5TkcaCT2KxUGdW8h4yIsoacB5Mw,4661
40
40
  graphiti_core/models/nodes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
- graphiti_core/models/nodes/node_db_queries.py,sha256=ADPkZzS4tq5i-8zvkocoiuOiDi64d5F2ChEY_JwLOwQ,4378
41
+ graphiti_core/models/nodes/node_db_queries.py,sha256=XIaBTBR0UPw765cCcyu0oM1Q5Yv2gSud972xKpIibzA,4386
42
42
  graphiti_core/prompts/__init__.py,sha256=EA-x9xUki9l8wnu2l8ek_oNf75-do5tq5hVq7Zbv8Kw,101
43
43
  graphiti_core/prompts/dedupe_edges.py,sha256=WRXQi7JQZdIfKDICWyU7Wbs5WyD_KBblLBSeKdbLyuk,5914
44
- graphiti_core/prompts/dedupe_nodes.py,sha256=rI6SlYO84jVAGtFfarFWXR3_YWlsqXaq-6jmaq5Xy-w,8234
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
@@ -64,14 +64,14 @@ graphiti_core/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
64
64
  graphiti_core/utils/bulk_utils.py,sha256=xIn2UMwEw1MOcpaV0QLY59fyacTH0J7kvQtuF2rJfgk,15168
65
65
  graphiti_core/utils/datetime_utils.py,sha256=Ti-2tnrDFRzBsbfblzsHybsM3jaDLP4-VT2t0VhpIzU,1357
66
66
  graphiti_core/utils/maintenance/__init__.py,sha256=vW4H1KyapTl-OOz578uZABYcpND4wPx3Vt6aAPaXh78,301
67
- graphiti_core/utils/maintenance/community_operations.py,sha256=wnMUwS_qieP2ErHdTUuBn3ti6vJO_jjLnWSwjYyS78M,10484
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.7.dist-info/METADATA,sha256=ycXECklR_Mxfdbu_zL3U3zsZqf01zt8eZfrjaMqJPLk,24613
75
- graphiti_core-0.18.7.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
76
- graphiti_core-0.18.7.dist-info/licenses/LICENSE,sha256=KCUwCyDXuVEgmDWkozHyniRyWjnWUWjkuDHfU6o3JlA,11325
77
- graphiti_core-0.18.7.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,,