graphiti-core 0.5.3__tar.gz → 0.6.0__tar.gz

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.

Files changed (61) hide show
  1. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/PKG-INFO +20 -16
  2. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/README.md +19 -15
  3. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/graphiti.py +32 -0
  4. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/nodes.py +7 -3
  5. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/pyproject.toml +1 -1
  6. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/LICENSE +0 -0
  7. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/__init__.py +0 -0
  8. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/cross_encoder/__init__.py +0 -0
  9. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/cross_encoder/bge_reranker_client.py +0 -0
  10. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/cross_encoder/client.py +0 -0
  11. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/cross_encoder/openai_reranker_client.py +0 -0
  12. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/edges.py +0 -0
  13. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/embedder/__init__.py +0 -0
  14. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/embedder/client.py +0 -0
  15. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/embedder/openai.py +0 -0
  16. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/embedder/voyage.py +0 -0
  17. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/errors.py +0 -0
  18. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/helpers.py +0 -0
  19. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/llm_client/__init__.py +0 -0
  20. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/llm_client/anthropic_client.py +0 -0
  21. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/llm_client/client.py +0 -0
  22. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/llm_client/config.py +0 -0
  23. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/llm_client/errors.py +0 -0
  24. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/llm_client/groq_client.py +0 -0
  25. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/llm_client/openai_client.py +0 -0
  26. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/llm_client/openai_generic_client.py +0 -0
  27. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/llm_client/utils.py +0 -0
  28. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/models/__init__.py +0 -0
  29. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/models/edges/__init__.py +0 -0
  30. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/models/edges/edge_db_queries.py +0 -0
  31. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/models/nodes/__init__.py +0 -0
  32. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/models/nodes/node_db_queries.py +0 -0
  33. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/prompts/__init__.py +0 -0
  34. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/prompts/dedupe_edges.py +0 -0
  35. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/prompts/dedupe_nodes.py +0 -0
  36. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/prompts/eval.py +0 -0
  37. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/prompts/extract_edge_dates.py +0 -0
  38. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/prompts/extract_edges.py +0 -0
  39. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/prompts/extract_nodes.py +0 -0
  40. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/prompts/invalidate_edges.py +0 -0
  41. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/prompts/lib.py +0 -0
  42. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/prompts/models.py +0 -0
  43. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/prompts/prompt_helpers.py +0 -0
  44. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/prompts/summarize_nodes.py +0 -0
  45. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/py.typed +0 -0
  46. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/search/__init__.py +0 -0
  47. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/search/search.py +0 -0
  48. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/search/search_config.py +0 -0
  49. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/search/search_config_recipes.py +0 -0
  50. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/search/search_filters.py +0 -0
  51. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/search/search_utils.py +0 -0
  52. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/utils/__init__.py +0 -0
  53. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/utils/bulk_utils.py +0 -0
  54. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/utils/datetime_utils.py +0 -0
  55. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/utils/maintenance/__init__.py +0 -0
  56. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/utils/maintenance/community_operations.py +0 -0
  57. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/utils/maintenance/edge_operations.py +0 -0
  58. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/utils/maintenance/graph_data_operations.py +0 -0
  59. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/utils/maintenance/node_operations.py +0 -0
  60. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/utils/maintenance/temporal_operations.py +0 -0
  61. {graphiti_core-0.5.3 → graphiti_core-0.6.0}/graphiti_core/utils/maintenance/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: graphiti-core
3
- Version: 0.5.3
3
+ Version: 0.6.0
4
4
  Summary: A temporal graph building library
5
5
  License: Apache-2.0
6
6
  Author: Paul Paliychuk
@@ -22,7 +22,7 @@ Description-Content-Type: text/markdown
22
22
 
23
23
  <div align="center">
24
24
 
25
- <img width="350" alt="Graphiti-ts-small" src="https://github.com/user-attachments/assets/bbd02947-e435-4a05-b25a-bbbac36d52c8">
25
+ # Graphiti
26
26
 
27
27
  ## Temporal Knowledge Graphs for Agentic Applications
28
28
 
@@ -45,7 +45,7 @@ a fusion of time, full-text, semantic, and graph algorithm approaches.
45
45
  <br />
46
46
 
47
47
  <p align="center">
48
- <img src="/images/graphiti-graph-intro.gif" alt="Graphiti temporal walkthrough" width="700px">
48
+ <img src="images/graphiti-graph-intro.gif" alt="Graphiti temporal walkthrough" width="700px">
49
49
  </p>
50
50
 
51
51
  <br />
@@ -65,6 +65,20 @@ With Graphiti, you can build LLM applications such as:
65
65
  Graphiti supports a wide range of applications in sales, customer service, health, finance, and more, enabling long-term
66
66
  recall and state-based reasoning for both assistants and agents.
67
67
 
68
+ ## Graphiti and Zep Memory
69
+
70
+ Graphiti powers the core of [Zep's memory layer](https://www.getzep.com) for LLM-powered Assistants and Agents.
71
+
72
+ Using Graphiti, we've demonstrated Zep is the [State of the Art in Agent Memory](https://blog.getzep.com/state-of-the-art-agent-memory/).
73
+
74
+ Read our paper: [Zep: A Temporal Knowledge Graph Architecture for Agent Memory](https://arxiv.org/abs/2501.13956).
75
+
76
+ We're excited to open-source Graphiti, believing its potential reaches far beyond memory applications.
77
+
78
+ <p align="center">
79
+ <a href="https://arxiv.org/abs/2501.13956"><img src="images/arxiv-screenshot.png" alt="Zep: A Temporal Knowledge Graph Architecture for Agent Memory" width="700px"></a>
80
+ </p>
81
+
68
82
  ## Why Graphiti?
69
83
 
70
84
  We were intrigued by Microsoft’s GraphRAG, which expanded on RAG text chunking by using a graph to better model a
@@ -89,12 +103,6 @@ scale:
89
103
  <img src="/images/graphiti-intro-slides-stock-2.gif" alt="Graphiti structured + unstructured demo" width="700px">
90
104
  </p>
91
105
 
92
- ## Graphiti and Zep Memory
93
-
94
- Graphiti powers the core of [Zep's memory layer](https://www.getzep.com) for LLM-powered Assistants and Agents.
95
-
96
- We're excited to open-source Graphiti, believing its potential reaches far beyond memory applications.
97
-
98
106
  ## Installation
99
107
 
100
108
  Requirements:
@@ -125,7 +133,7 @@ poetry add graphiti-core
125
133
 
126
134
  > [!IMPORTANT]
127
135
  > Graphiti uses OpenAI for LLM inference and embedding. Ensure that an `OPENAI_API_KEY` is set in your environment.
128
- > Support for Anthropic and Groq LLM inferences is available, too.
136
+ > Support for Anthropic and Groq LLM inferences is available, too. Other LLM providers may be supported via OpenAI compatible APIs.
129
137
 
130
138
  ```python
131
139
  from graphiti_core import Graphiti
@@ -216,13 +224,9 @@ as such this feature is off by default.
216
224
 
217
225
  Graphiti is under active development. We aim to maintain API stability while working on:
218
226
 
219
- - [x] Implementing node and edge CRUD operations
220
- - [ ] Improving performance and scalability
221
- - [ ] Achieving good performance with different LLM and embedding models
222
- - [x] Creating a dedicated embedder interface
223
227
  - [ ] Supporting custom graph schemas:
224
- - Allow developers to provide their own defined node and edge classes when ingesting episodes
225
- - Enable more flexible knowledge representation tailored to specific use cases
228
+ - Allow developers to provide their own defined node and edge classes when ingesting episodes
229
+ - Enable more flexible knowledge representation tailored to specific use cases
226
230
  - [x] Enhancing retrieval capabilities with more robust and configurable options
227
231
  - [ ] Expanding test coverage to ensure reliability and catch edge cases
228
232
 
@@ -1,6 +1,6 @@
1
1
  <div align="center">
2
2
 
3
- <img width="350" alt="Graphiti-ts-small" src="https://github.com/user-attachments/assets/bbd02947-e435-4a05-b25a-bbbac36d52c8">
3
+ # Graphiti
4
4
 
5
5
  ## Temporal Knowledge Graphs for Agentic Applications
6
6
 
@@ -23,7 +23,7 @@ a fusion of time, full-text, semantic, and graph algorithm approaches.
23
23
  <br />
24
24
 
25
25
  <p align="center">
26
- <img src="/images/graphiti-graph-intro.gif" alt="Graphiti temporal walkthrough" width="700px">
26
+ <img src="images/graphiti-graph-intro.gif" alt="Graphiti temporal walkthrough" width="700px">
27
27
  </p>
28
28
 
29
29
  <br />
@@ -43,6 +43,20 @@ With Graphiti, you can build LLM applications such as:
43
43
  Graphiti supports a wide range of applications in sales, customer service, health, finance, and more, enabling long-term
44
44
  recall and state-based reasoning for both assistants and agents.
45
45
 
46
+ ## Graphiti and Zep Memory
47
+
48
+ Graphiti powers the core of [Zep's memory layer](https://www.getzep.com) for LLM-powered Assistants and Agents.
49
+
50
+ Using Graphiti, we've demonstrated Zep is the [State of the Art in Agent Memory](https://blog.getzep.com/state-of-the-art-agent-memory/).
51
+
52
+ Read our paper: [Zep: A Temporal Knowledge Graph Architecture for Agent Memory](https://arxiv.org/abs/2501.13956).
53
+
54
+ We're excited to open-source Graphiti, believing its potential reaches far beyond memory applications.
55
+
56
+ <p align="center">
57
+ <a href="https://arxiv.org/abs/2501.13956"><img src="images/arxiv-screenshot.png" alt="Zep: A Temporal Knowledge Graph Architecture for Agent Memory" width="700px"></a>
58
+ </p>
59
+
46
60
  ## Why Graphiti?
47
61
 
48
62
  We were intrigued by Microsoft’s GraphRAG, which expanded on RAG text chunking by using a graph to better model a
@@ -67,12 +81,6 @@ scale:
67
81
  <img src="/images/graphiti-intro-slides-stock-2.gif" alt="Graphiti structured + unstructured demo" width="700px">
68
82
  </p>
69
83
 
70
- ## Graphiti and Zep Memory
71
-
72
- Graphiti powers the core of [Zep's memory layer](https://www.getzep.com) for LLM-powered Assistants and Agents.
73
-
74
- We're excited to open-source Graphiti, believing its potential reaches far beyond memory applications.
75
-
76
84
  ## Installation
77
85
 
78
86
  Requirements:
@@ -103,7 +111,7 @@ poetry add graphiti-core
103
111
 
104
112
  > [!IMPORTANT]
105
113
  > Graphiti uses OpenAI for LLM inference and embedding. Ensure that an `OPENAI_API_KEY` is set in your environment.
106
- > Support for Anthropic and Groq LLM inferences is available, too.
114
+ > Support for Anthropic and Groq LLM inferences is available, too. Other LLM providers may be supported via OpenAI compatible APIs.
107
115
 
108
116
  ```python
109
117
  from graphiti_core import Graphiti
@@ -194,13 +202,9 @@ as such this feature is off by default.
194
202
 
195
203
  Graphiti is under active development. We aim to maintain API stability while working on:
196
204
 
197
- - [x] Implementing node and edge CRUD operations
198
- - [ ] Improving performance and scalability
199
- - [ ] Achieving good performance with different LLM and embedding models
200
- - [x] Creating a dedicated embedder interface
201
205
  - [ ] Supporting custom graph schemas:
202
- - Allow developers to provide their own defined node and edge classes when ingesting episodes
203
- - Enable more flexible knowledge representation tailored to specific use cases
206
+ - Allow developers to provide their own defined node and edge classes when ingesting episodes
207
+ - Enable more flexible knowledge representation tailored to specific use cases
204
208
  - [x] Enhancing retrieval capabilities with more robust and configurable options
205
209
  - [ ] Expanding test coverage to ensure reliability and catch edge cases
206
210
 
@@ -21,6 +21,7 @@ from time import time
21
21
  from dotenv import load_dotenv
22
22
  from neo4j import AsyncGraphDatabase
23
23
  from pydantic import BaseModel
24
+ from typing_extensions import LiteralString
24
25
 
25
26
  from graphiti_core.cross_encoder.client import CrossEncoderClient
26
27
  from graphiti_core.cross_encoder.openai_reranker_client import OpenAIRerankerClient
@@ -747,3 +748,34 @@ class Graphiti:
747
748
  await add_nodes_and_edges_bulk(
748
749
  self.driver, [], [], resolved_nodes, [resolved_edge] + invalidated_edges
749
750
  )
751
+
752
+ async def remove_episode(self, episode_uuid: str):
753
+ # Find the episode to be deleted
754
+ episode = await EpisodicNode.get_by_uuid(self.driver, episode_uuid)
755
+
756
+ # Find edges mentioned by the episode
757
+ edges = await EntityEdge.get_by_uuids(self.driver, episode.entity_edges)
758
+
759
+ # We should only delete edges created by the episode
760
+ edges_to_delete: list[EntityEdge] = []
761
+ for edge in edges:
762
+ if edge.episodes[0] == episode.uuid:
763
+ edges_to_delete.append(edge)
764
+
765
+ # Find nodes mentioned by the episode
766
+ nodes = await get_mentioned_nodes(self.driver, [episode])
767
+ # We should delete all nodes that are only mentioned in the deleted episode
768
+ nodes_to_delete: list[EntityNode] = []
769
+ for node in nodes:
770
+ query: LiteralString = 'MATCH (e:Episodic)-[:MENTIONS]->(n:Entity {uuid: $uuid}) RETURN count(*) AS episode_count'
771
+ records, _, _ = await self.driver.execute_query(
772
+ query, uuid=node.uuid, database_=DEFAULT_DATABASE, routing_='r'
773
+ )
774
+
775
+ for record in records:
776
+ if record['episode_count'] == 1:
777
+ nodes_to_delete.append(node)
778
+
779
+ await semaphore_gather(*[node.delete(self.driver) for node in nodes_to_delete])
780
+ await semaphore_gather(*[edge.delete(self.driver) for edge in edges_to_delete])
781
+ await episode.delete(self.driver)
@@ -170,7 +170,8 @@ class EpisodicNode(Node):
170
170
  e.name AS name,
171
171
  e.group_id AS group_id,
172
172
  e.source_description AS source_description,
173
- e.source AS source
173
+ e.source AS source,
174
+ e.entity_edges AS entity_edges
174
175
  """,
175
176
  uuid=uuid,
176
177
  database_=DEFAULT_DATABASE,
@@ -197,7 +198,8 @@ class EpisodicNode(Node):
197
198
  e.name AS name,
198
199
  e.group_id AS group_id,
199
200
  e.source_description AS source_description,
200
- e.source AS source
201
+ e.source AS source,
202
+ e.entity_edges AS entity_edges
201
203
  """,
202
204
  uuids=uuids,
203
205
  database_=DEFAULT_DATABASE,
@@ -233,7 +235,8 @@ class EpisodicNode(Node):
233
235
  e.name AS name,
234
236
  e.group_id AS group_id,
235
237
  e.source_description AS source_description,
236
- e.source AS source
238
+ e.source AS source,
239
+ e.entity_edges AS entity_edges
237
240
  ORDER BY e.uuid DESC
238
241
  """
239
242
  + limit_query,
@@ -490,6 +493,7 @@ def get_episodic_node_from_record(record: Any) -> EpisodicNode:
490
493
  source=EpisodeType.from_str(record['source']),
491
494
  name=record['name'],
492
495
  source_description=record['source_description'],
496
+ entity_edges=record['entity_edges'],
493
497
  )
494
498
 
495
499
 
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "graphiti-core"
3
- version = "0.5.3"
3
+ version = "0.6.0"
4
4
  description = "A temporal graph building library"
5
5
  authors = [
6
6
  "Paul Paliychuk <paul@getzep.com>",
File without changes