graphiti-core 0.12.0rc1__tar.gz → 0.12.0rc3__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.
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/PKG-INFO +1 -1
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/search/search_filters.py +15 -1
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/search/search_utils.py +12 -12
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/utils/maintenance/edge_operations.py +13 -9
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/pyproject.toml +1 -1
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/LICENSE +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/README.md +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/__init__.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/cross_encoder/__init__.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/cross_encoder/bge_reranker_client.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/cross_encoder/client.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/cross_encoder/openai_reranker_client.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/edges.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/embedder/__init__.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/embedder/client.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/embedder/gemini.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/embedder/openai.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/embedder/voyage.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/errors.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/graphiti.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/graphiti_types.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/helpers.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/llm_client/__init__.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/llm_client/anthropic_client.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/llm_client/client.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/llm_client/config.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/llm_client/errors.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/llm_client/gemini_client.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/llm_client/groq_client.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/llm_client/openai_client.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/llm_client/openai_generic_client.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/llm_client/utils.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/models/__init__.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/models/edges/__init__.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/models/edges/edge_db_queries.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/models/nodes/__init__.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/models/nodes/node_db_queries.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/nodes.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/prompts/__init__.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/prompts/dedupe_edges.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/prompts/dedupe_nodes.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/prompts/eval.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/prompts/extract_edge_dates.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/prompts/extract_edges.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/prompts/extract_nodes.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/prompts/invalidate_edges.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/prompts/lib.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/prompts/models.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/prompts/prompt_helpers.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/prompts/summarize_nodes.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/py.typed +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/search/__init__.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/search/search.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/search/search_config.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/search/search_config_recipes.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/search/search_helpers.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/utils/__init__.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/utils/bulk_utils.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/utils/datetime_utils.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/utils/maintenance/__init__.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/utils/maintenance/community_operations.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/utils/maintenance/graph_data_operations.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/utils/maintenance/node_operations.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/utils/maintenance/temporal_operations.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/utils/maintenance/utils.py +0 -0
- {graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/utils/ontology_utils/entity_types_utils.py +0 -0
|
@@ -42,6 +42,9 @@ class SearchFilters(BaseModel):
|
|
|
42
42
|
node_labels: list[str] | None = Field(
|
|
43
43
|
default=None, description='List of node labels to filter on'
|
|
44
44
|
)
|
|
45
|
+
edge_types: list[str] | None = Field(
|
|
46
|
+
default=None, description='List of edge types to filter on'
|
|
47
|
+
)
|
|
45
48
|
valid_at: list[list[DateFilter]] | None = Field(default=None)
|
|
46
49
|
invalid_at: list[list[DateFilter]] | None = Field(default=None)
|
|
47
50
|
created_at: list[list[DateFilter]] | None = Field(default=None)
|
|
@@ -68,8 +71,19 @@ def edge_search_filter_query_constructor(
|
|
|
68
71
|
filter_query: LiteralString = ''
|
|
69
72
|
filter_params: dict[str, Any] = {}
|
|
70
73
|
|
|
74
|
+
if filters.edge_types is not None:
|
|
75
|
+
edge_types = filters.edge_types
|
|
76
|
+
edge_types_filter = '\nAND r.name in $edge_types'
|
|
77
|
+
filter_query += edge_types_filter
|
|
78
|
+
filter_params['edge_types'] = edge_types
|
|
79
|
+
|
|
80
|
+
if filters.node_labels is not None:
|
|
81
|
+
node_labels = '|'.join(filters.node_labels)
|
|
82
|
+
node_label_filter = '\nAND n:' + node_labels + ' AND m:' + node_labels
|
|
83
|
+
filter_query += node_label_filter
|
|
84
|
+
|
|
71
85
|
if filters.valid_at is not None:
|
|
72
|
-
valid_at_filter = '
|
|
86
|
+
valid_at_filter = '\nAND ('
|
|
73
87
|
for i, or_list in enumerate(filters.valid_at):
|
|
74
88
|
for j, date_filter in enumerate(or_list):
|
|
75
89
|
filter_params['valid_at_' + str(j)] = date_filter.date
|
|
@@ -159,7 +159,7 @@ async def edge_fulltext_search(
|
|
|
159
159
|
"""
|
|
160
160
|
CALL db.index.fulltext.queryRelationships("edge_name_and_fact", $query, {limit: $limit})
|
|
161
161
|
YIELD relationship AS rel, score
|
|
162
|
-
MATCH (:Entity)-[r:RELATES_TO]->(:Entity)
|
|
162
|
+
MATCH (n:Entity)-[r:RELATES_TO]->(m:Entity)
|
|
163
163
|
WHERE r.group_id IN $group_ids"""
|
|
164
164
|
+ filter_query
|
|
165
165
|
+ """\nWITH r, score, startNode(r) AS n, endNode(r) AS m
|
|
@@ -211,9 +211,9 @@ async def edge_similarity_search(
|
|
|
211
211
|
filter_query, filter_params = edge_search_filter_query_constructor(search_filter)
|
|
212
212
|
query_params.update(filter_params)
|
|
213
213
|
|
|
214
|
-
group_filter_query: LiteralString = ''
|
|
214
|
+
group_filter_query: LiteralString = 'WHERE r.group_id IS NOT NULL'
|
|
215
215
|
if group_ids is not None:
|
|
216
|
-
group_filter_query += '
|
|
216
|
+
group_filter_query += '\nAND r.group_id IN $group_ids'
|
|
217
217
|
query_params['group_ids'] = group_ids
|
|
218
218
|
query_params['source_node_uuid'] = source_node_uuid
|
|
219
219
|
query_params['target_node_uuid'] = target_node_uuid
|
|
@@ -227,8 +227,8 @@ async def edge_similarity_search(
|
|
|
227
227
|
query: LiteralString = (
|
|
228
228
|
RUNTIME_QUERY
|
|
229
229
|
+ """
|
|
230
|
-
|
|
231
|
-
|
|
230
|
+
MATCH (n:Entity)-[r:RELATES_TO]->(m:Entity)
|
|
231
|
+
"""
|
|
232
232
|
+ group_filter_query
|
|
233
233
|
+ filter_query
|
|
234
234
|
+ """\nWITH DISTINCT r, vector.similarity.cosine(r.fact_embedding, $search_vector) AS score
|
|
@@ -287,7 +287,7 @@ async def edge_bfs_search(
|
|
|
287
287
|
UNWIND $bfs_origin_node_uuids AS origin_uuid
|
|
288
288
|
MATCH path = (origin:Entity|Episodic {uuid: origin_uuid})-[:RELATES_TO|MENTIONS]->{1,3}(n:Entity)
|
|
289
289
|
UNWIND relationships(path) AS rel
|
|
290
|
-
MATCH ()-[r:RELATES_TO]-()
|
|
290
|
+
MATCH (n:Entity)-[r:RELATES_TO]-(m:Entity)
|
|
291
291
|
WHERE r.uuid = rel.uuid
|
|
292
292
|
"""
|
|
293
293
|
+ filter_query
|
|
@@ -340,10 +340,10 @@ async def node_fulltext_search(
|
|
|
340
340
|
|
|
341
341
|
query = (
|
|
342
342
|
"""
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
343
|
+
CALL db.index.fulltext.queryNodes("node_name_and_summary", $query, {limit: $limit})
|
|
344
|
+
YIELD node AS n, score
|
|
345
|
+
WHERE n:Entity
|
|
346
|
+
"""
|
|
347
347
|
+ filter_query
|
|
348
348
|
+ ENTITY_NODE_RETURN
|
|
349
349
|
+ """
|
|
@@ -376,9 +376,9 @@ async def node_similarity_search(
|
|
|
376
376
|
# vector similarity search over entity names
|
|
377
377
|
query_params: dict[str, Any] = {}
|
|
378
378
|
|
|
379
|
-
group_filter_query: LiteralString = ''
|
|
379
|
+
group_filter_query: LiteralString = 'WHERE n.group_id IS NOT NULL'
|
|
380
380
|
if group_ids is not None:
|
|
381
|
-
group_filter_query += '
|
|
381
|
+
group_filter_query += ' AND n.group_id IN $group_ids'
|
|
382
382
|
query_params['group_ids'] = group_ids
|
|
383
383
|
|
|
384
384
|
filter_query, filter_params = node_search_filter_query_constructor(search_filter)
|
|
@@ -160,6 +160,14 @@ async def extract_edges(
|
|
|
160
160
|
invalid_at = edge_data.get('invalid_at', None)
|
|
161
161
|
valid_at_datetime = None
|
|
162
162
|
invalid_at_datetime = None
|
|
163
|
+
source_node_uuid = node_uuids_by_name_map.get(edge_data.get('source_entity_name', ''), '')
|
|
164
|
+
target_node_uuid = node_uuids_by_name_map.get(edge_data.get('target_entity_name', ''), '')
|
|
165
|
+
|
|
166
|
+
if source_node_uuid == '' or target_node_uuid == '':
|
|
167
|
+
logger.warning(
|
|
168
|
+
f'WARNING: source or target node not filled {edge_data.get("edge_name")}. source_node_uuid: {source_node_uuid} and target_node_uuid: {target_node_uuid} '
|
|
169
|
+
)
|
|
170
|
+
continue
|
|
163
171
|
|
|
164
172
|
if valid_at:
|
|
165
173
|
try:
|
|
@@ -177,12 +185,8 @@ async def extract_edges(
|
|
|
177
185
|
except ValueError as e:
|
|
178
186
|
logger.warning(f'WARNING: Error parsing invalid_at date: {e}. Input: {invalid_at}')
|
|
179
187
|
edge = EntityEdge(
|
|
180
|
-
source_node_uuid=
|
|
181
|
-
|
|
182
|
-
),
|
|
183
|
-
target_node_uuid=node_uuids_by_name_map.get(
|
|
184
|
-
edge_data.get('target_entity_name', ''), ''
|
|
185
|
-
),
|
|
188
|
+
source_node_uuid=source_node_uuid,
|
|
189
|
+
target_node_uuid=target_node_uuid,
|
|
186
190
|
name=edge_data.get('relation_type', ''),
|
|
187
191
|
group_id=group_id,
|
|
188
192
|
fact=edge_data.get('fact', ''),
|
|
@@ -276,8 +280,8 @@ async def resolve_extracted_edges(
|
|
|
276
280
|
# Determine which edge types are relevant for each edge
|
|
277
281
|
edge_types_lst: list[dict[str, BaseModel]] = []
|
|
278
282
|
for extracted_edge in extracted_edges:
|
|
279
|
-
source_node_labels = uuid_entity_map[extracted_edge.source_node_uuid].labels
|
|
280
|
-
target_node_labels = uuid_entity_map[extracted_edge.target_node_uuid].labels
|
|
283
|
+
source_node_labels = uuid_entity_map[extracted_edge.source_node_uuid].labels + ['Entity']
|
|
284
|
+
target_node_labels = uuid_entity_map[extracted_edge.target_node_uuid].labels + ['Entity']
|
|
281
285
|
label_tuples = [
|
|
282
286
|
(source_label, target_label)
|
|
283
287
|
for source_label in source_node_labels
|
|
@@ -439,7 +443,7 @@ async def resolve_extracted_edge(
|
|
|
439
443
|
resolved_edge.name = fact_type
|
|
440
444
|
|
|
441
445
|
edge_attributes_context = {
|
|
442
|
-
'
|
|
446
|
+
'episode_content': episode.content,
|
|
443
447
|
'reference_time': episode.valid_at,
|
|
444
448
|
'fact': resolved_edge.fact,
|
|
445
449
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "graphiti-core"
|
|
3
3
|
description = "A temporal graph building library"
|
|
4
|
-
version = "0.12.
|
|
4
|
+
version = "0.12.0pre3"
|
|
5
5
|
authors = [
|
|
6
6
|
{ "name" = "Paul Paliychuk", "email" = "paul@getzep.com" },
|
|
7
7
|
{ "name" = "Preston Rasmussen", "email" = "preston@getzep.com" },
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/llm_client/anthropic_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/llm_client/gemini_client.py
RENAMED
|
File without changes
|
|
File without changes
|
{graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/llm_client/openai_client.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/models/edges/edge_db_queries.py
RENAMED
|
File without changes
|
|
File without changes
|
{graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/models/nodes/node_db_queries.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/prompts/extract_edge_dates.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/prompts/invalidate_edges.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/prompts/summarize_nodes.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/search/search_config_recipes.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/utils/maintenance/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{graphiti_core-0.12.0rc1 → graphiti_core-0.12.0rc3}/graphiti_core/utils/maintenance/utils.py
RENAMED
|
File without changes
|
|
File without changes
|