graphiti-core 0.8.5__py3-none-any.whl → 0.8.7__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/graphiti.py CHANGED
@@ -262,6 +262,7 @@ class Graphiti:
262
262
  uuid: str | None = None,
263
263
  update_communities: bool = False,
264
264
  entity_types: dict[str, BaseModel] | None = None,
265
+ previous_episode_uuids: list[str] | None = None,
265
266
  ) -> AddEpisodeResults:
266
267
  """
267
268
  Process an episode and update the graph.
@@ -287,6 +288,9 @@ class Graphiti:
287
288
  Optional uuid of the episode.
288
289
  update_communities : bool
289
290
  Optional. Whether to update communities with new node information
291
+ previous_episode_uuids : list[str] | None
292
+ Optional. list of episode uuids to use as the previous episodes. If this is not provided,
293
+ the most recent episodes by created_at date will be used.
290
294
 
291
295
  Returns
292
296
  -------
@@ -315,8 +319,12 @@ class Graphiti:
315
319
  entity_edges: list[EntityEdge] = []
316
320
  now = utc_now()
317
321
 
318
- previous_episodes = await self.retrieve_episodes(
319
- reference_time, last_n=RELEVANT_SCHEMA_LIMIT, group_ids=[group_id]
322
+ previous_episodes = (
323
+ await self.retrieve_episodes(
324
+ reference_time, last_n=RELEVANT_SCHEMA_LIMIT, group_ids=[group_id]
325
+ )
326
+ if previous_episode_uuids is None
327
+ else await EpisodicNode.get_by_uuids(self.driver, previous_episode_uuids)
320
328
  )
321
329
 
322
330
  episode = (
@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
14
14
  limitations under the License.
15
15
  """
16
16
 
17
- DEFAULT_MAX_TOKENS = 2048
17
+ DEFAULT_MAX_TOKENS = 8192
18
18
  DEFAULT_TEMPERATURE = 0
19
19
 
20
20
 
@@ -92,13 +92,22 @@ async def build_indices_and_constraints(driver: AsyncDriver, delete_existing: bo
92
92
  )
93
93
 
94
94
 
95
- async def clear_data(driver: AsyncDriver):
95
+ async def clear_data(driver: AsyncDriver, group_ids: list[str] | None = None):
96
96
  async with driver.session() as session:
97
97
 
98
98
  async def delete_all(tx):
99
99
  await tx.run('MATCH (n) DETACH DELETE n')
100
100
 
101
- await session.execute_write(delete_all)
101
+ async def delete_group_ids(tx):
102
+ await tx.run(
103
+ 'MATCH (n:Entity|Episodic|Community) WHERE n.group_id IN $group_ids DETACH DELETE n',
104
+ group_ids=group_ids,
105
+ )
106
+
107
+ if group_ids is None:
108
+ await session.execute_write(delete_all)
109
+ else:
110
+ await session.execute_write(delete_group_ids)
102
111
 
103
112
 
104
113
  async def retrieve_episodes(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: graphiti-core
3
- Version: 0.8.5
3
+ Version: 0.8.7
4
4
  Summary: A temporal graph building library
5
5
  License: Apache-2.0
6
6
  Author: Paul Paliychuk
@@ -9,12 +9,12 @@ graphiti_core/embedder/client.py,sha256=HKIlpPLnzFT81jurPkry6z8F8nxfZVfejdcfxHVU
9
9
  graphiti_core/embedder/openai.py,sha256=23BnPA10eiaa1HkxHKYSj75-0PymczPK2FNNIz8Txbc,1910
10
10
  graphiti_core/embedder/voyage.py,sha256=7kqrLG75J3Q6cdA2Nlx1JSYtpk2141ckdl3OtDDw0vU,1882
11
11
  graphiti_core/errors.py,sha256=cSOXXkydihNd6OHXzkwJvciRmR7EoFMq57AzUYVg0gc,2040
12
- graphiti_core/graphiti.py,sha256=DP2hd1aXIYh-nXVfxugHvw7Tbax50w83IKMZf9Z5BeI,29128
12
+ graphiti_core/graphiti.py,sha256=FXkfgaib_JcVPHCBnJP__a4kJBlDs00ctvrtDCLHyoE,29588
13
13
  graphiti_core/helpers.py,sha256=7BQzUBFmoBDA2OIDdFtoN4W-vXOhPRIsF0uDb7PsNi0,2913
14
14
  graphiti_core/llm_client/__init__.py,sha256=PA80TSMeX-sUXITXEAxMDEt3gtfZgcJrGJUcyds1mSo,207
15
15
  graphiti_core/llm_client/anthropic_client.py,sha256=dTM8rKhk9TZAU4O-0jFMivOwJvWM-gHpp5gLmuJHiGQ,2723
16
16
  graphiti_core/llm_client/client.py,sha256=sqtdkySL_QnlZUyMhLvtbSPzGI1y8Ryq5a0IqOPZ2Ps,5252
17
- graphiti_core/llm_client/config.py,sha256=ry6ndcB0dyUDxqnGEwPBWPOjqUkHqU_n3iMyQiN3CCM,2338
17
+ graphiti_core/llm_client/config.py,sha256=PxbjQWNjYQJKA7Pws28jJ0TsSZijOUds8GD9Yvu7xUE,2338
18
18
  graphiti_core/llm_client/errors.py,sha256=Vk0mj2SgNDg8E8p7m1UyUaerqLPNLCDKPVsMEnOSBdQ,1028
19
19
  graphiti_core/llm_client/groq_client.py,sha256=EesX0_iFOIvvIc3ql6Xa8EOm0dbGJ_o3VpqyDM83mKg,2498
20
20
  graphiti_core/llm_client/openai_client.py,sha256=_kLK35oSwhP20RQ9n20P8m5QxjmqqqmvU4UlOOhoLhw,6798
@@ -51,11 +51,11 @@ graphiti_core/utils/datetime_utils.py,sha256=Ti-2tnrDFRzBsbfblzsHybsM3jaDLP4-VT2
51
51
  graphiti_core/utils/maintenance/__init__.py,sha256=TRY3wWWu5kn3Oahk_KKhltrWnh0NACw0FskjqF6OtlA,314
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
- graphiti_core/utils/maintenance/graph_data_operations.py,sha256=qds9ALk9PhpQs1CNZTZGpi70mqJ93Y2KhIh9X2r8MUI,6533
54
+ graphiti_core/utils/maintenance/graph_data_operations.py,sha256=UJlIAawswJ7eO70oS5ueX-zjGHSaTWLsMbeYje67WTY,6895
55
55
  graphiti_core/utils/maintenance/node_operations.py,sha256=yo5Qt7i5WN3J3rB_9RJ0TJ1ZG1cGFWUKGrktMDwmXyE,15521
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.8.5.dist-info/LICENSE,sha256=KCUwCyDXuVEgmDWkozHyniRyWjnWUWjkuDHfU6o3JlA,11325
59
- graphiti_core-0.8.5.dist-info/METADATA,sha256=-2u5m8EU4at5d_knjbibnV2rSWWaoJ_QmYgkZeE5bv4,14351
60
- graphiti_core-0.8.5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
61
- graphiti_core-0.8.5.dist-info/RECORD,,
58
+ graphiti_core-0.8.7.dist-info/LICENSE,sha256=KCUwCyDXuVEgmDWkozHyniRyWjnWUWjkuDHfU6o3JlA,11325
59
+ graphiti_core-0.8.7.dist-info/METADATA,sha256=XrGUFhTTqF1IyDIuugdQeUTPaxyXEk-FkuyhqbBQmMw,14351
60
+ graphiti_core-0.8.7.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
61
+ graphiti_core-0.8.7.dist-info/RECORD,,