graphiti-core 0.19.0rc2__py3-none-any.whl → 0.19.0rc3__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/migrations/neo4j_node_group_labels.py +35 -3
- graphiti_core/utils/maintenance/graph_data_operations.py +2 -1
- {graphiti_core-0.19.0rc2.dist-info → graphiti_core-0.19.0rc3.dist-info}/METADATA +8 -6
- {graphiti_core-0.19.0rc2.dist-info → graphiti_core-0.19.0rc3.dist-info}/RECORD +6 -6
- {graphiti_core-0.19.0rc2.dist-info → graphiti_core-0.19.0rc3.dist-info}/WHEEL +0 -0
- {graphiti_core-0.19.0rc2.dist-info → graphiti_core-0.19.0rc3.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import asyncio
|
|
2
|
+
import os
|
|
3
|
+
|
|
1
4
|
from graphiti_core.driver.driver import GraphDriver
|
|
5
|
+
from graphiti_core.driver.neo4j_driver import Neo4jDriver
|
|
2
6
|
from graphiti_core.helpers import validate_group_id
|
|
3
7
|
from graphiti_core.utils.maintenance.graph_data_operations import build_dynamic_indexes
|
|
4
8
|
|
|
@@ -11,21 +15,21 @@ async def neo4j_node_group_labels(driver: GraphDriver, group_id: str, batch_size
|
|
|
11
15
|
MATCH (n:Episodic {group_id: $group_id})
|
|
12
16
|
CALL {
|
|
13
17
|
WITH n
|
|
14
|
-
SET n:$group_label
|
|
18
|
+
SET n:$($group_label)
|
|
15
19
|
} IN TRANSACTIONS OF $batch_size ROWS"""
|
|
16
20
|
|
|
17
21
|
entity_query = """
|
|
18
22
|
MATCH (n:Entity {group_id: $group_id})
|
|
19
23
|
CALL {
|
|
20
24
|
WITH n
|
|
21
|
-
SET n:$group_label
|
|
25
|
+
SET n:$($group_label)
|
|
22
26
|
} IN TRANSACTIONS OF $batch_size ROWS"""
|
|
23
27
|
|
|
24
28
|
community_query = """
|
|
25
29
|
MATCH (n:Community {group_id: $group_id})
|
|
26
30
|
CALL {
|
|
27
31
|
WITH n
|
|
28
|
-
SET n:$group_label
|
|
32
|
+
SET n:$($group_label)
|
|
29
33
|
} IN TRANSACTIONS OF $batch_size ROWS"""
|
|
30
34
|
|
|
31
35
|
async with driver.session() as session:
|
|
@@ -51,3 +55,31 @@ async def neo4j_node_group_labels(driver: GraphDriver, group_id: str, batch_size
|
|
|
51
55
|
group_label='Community_' + group_id.replace('-', ''),
|
|
52
56
|
batch_size=batch_size,
|
|
53
57
|
)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
async def neo4j_node_label_migration(driver: GraphDriver):
|
|
61
|
+
query = """MATCH (n:Episodic)
|
|
62
|
+
RETURN DISTINCT n.group_id AS group_id"""
|
|
63
|
+
|
|
64
|
+
results, _, _ = await driver.execute_query(query)
|
|
65
|
+
for result in results:
|
|
66
|
+
group_id = result['group_id']
|
|
67
|
+
await neo4j_node_group_labels(driver, group_id)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
async def main():
|
|
71
|
+
neo4j_uri = os.environ.get('NEO4J_URI') or 'bolt://localhost:7687'
|
|
72
|
+
neo4j_user = os.environ.get('NEO4J_USER') or 'neo4j'
|
|
73
|
+
neo4j_password = os.environ.get('NEO4J_PASSWORD') or 'password'
|
|
74
|
+
|
|
75
|
+
driver = Neo4jDriver(
|
|
76
|
+
uri=neo4j_uri,
|
|
77
|
+
user=neo4j_user,
|
|
78
|
+
password=neo4j_password,
|
|
79
|
+
)
|
|
80
|
+
await neo4j_node_label_migration(driver)
|
|
81
|
+
await driver.close()
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
if __name__ == '__main__':
|
|
85
|
+
asyncio.run(main())
|
|
@@ -35,7 +35,8 @@ logger = logging.getLogger(__name__)
|
|
|
35
35
|
|
|
36
36
|
async def build_indices_and_constraints(driver: GraphDriver, delete_existing: bool = False):
|
|
37
37
|
if driver.provider == GraphProvider.NEPTUNE:
|
|
38
|
-
|
|
38
|
+
await driver.create_aoss_indices() # pyright: ignore[reportAttributeAccessIssue]
|
|
39
|
+
return
|
|
39
40
|
if delete_existing:
|
|
40
41
|
records, _, _ = await driver.execute_query(
|
|
41
42
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: graphiti-core
|
|
3
|
-
Version: 0.19.
|
|
3
|
+
Version: 0.19.0rc3
|
|
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
|
|
@@ -487,25 +487,27 @@ The Gemini reranker uses the `gemini-2.5-flash-lite-preview-06-17` model by defa
|
|
|
487
487
|
Graphiti supports Ollama for running local LLMs and embedding models via Ollama's OpenAI-compatible API. This is ideal for privacy-focused applications or when you want to avoid API costs.
|
|
488
488
|
|
|
489
489
|
Install the models:
|
|
490
|
+
```bash
|
|
490
491
|
ollama pull deepseek-r1:7b # LLM
|
|
491
492
|
ollama pull nomic-embed-text # embeddings
|
|
493
|
+
```
|
|
492
494
|
|
|
493
495
|
```python
|
|
494
496
|
from graphiti_core import Graphiti
|
|
495
497
|
from graphiti_core.llm_client.config import LLMConfig
|
|
496
|
-
from graphiti_core.llm_client.
|
|
498
|
+
from graphiti_core.llm_client.openai_generic_client import OpenAIGenericClient
|
|
497
499
|
from graphiti_core.embedder.openai import OpenAIEmbedder, OpenAIEmbedderConfig
|
|
498
500
|
from graphiti_core.cross_encoder.openai_reranker_client import OpenAIRerankerClient
|
|
499
501
|
|
|
500
502
|
# Configure Ollama LLM client
|
|
501
503
|
llm_config = LLMConfig(
|
|
502
|
-
api_key="
|
|
504
|
+
api_key="ollama", # Ollama doesn't require a real API key, but some placeholder is needed
|
|
503
505
|
model="deepseek-r1:7b",
|
|
504
506
|
small_model="deepseek-r1:7b",
|
|
505
|
-
base_url="http://localhost:11434/v1",
|
|
507
|
+
base_url="http://localhost:11434/v1", # Ollama's OpenAI-compatible endpoint
|
|
506
508
|
)
|
|
507
509
|
|
|
508
|
-
llm_client =
|
|
510
|
+
llm_client = OpenAIGenericClient(config=llm_config)
|
|
509
511
|
|
|
510
512
|
# Initialize Graphiti with Ollama clients
|
|
511
513
|
graphiti = Graphiti(
|
|
@@ -515,7 +517,7 @@ graphiti = Graphiti(
|
|
|
515
517
|
llm_client=llm_client,
|
|
516
518
|
embedder=OpenAIEmbedder(
|
|
517
519
|
config=OpenAIEmbedderConfig(
|
|
518
|
-
api_key="
|
|
520
|
+
api_key="ollama", # Placeholder API key
|
|
519
521
|
embedding_model="nomic-embed-text",
|
|
520
522
|
embedding_dim=768,
|
|
521
523
|
base_url="http://localhost:11434/v1",
|
|
@@ -36,7 +36,7 @@ graphiti_core/llm_client/openai_client.py,sha256=AuaCFQFMJEGzBkFVouccq3XentmWRIK
|
|
|
36
36
|
graphiti_core/llm_client/openai_generic_client.py,sha256=WElMnPqdb1CxzYH4p2-m_9rVMr5M93-eXnc3yVxBgFg,7001
|
|
37
37
|
graphiti_core/llm_client/utils.py,sha256=zKpxXEbKa369m4W7RDEf-m56kH46V1Mx3RowcWZEWWs,1000
|
|
38
38
|
graphiti_core/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
39
|
-
graphiti_core/migrations/neo4j_node_group_labels.py,sha256=
|
|
39
|
+
graphiti_core/migrations/neo4j_node_group_labels.py,sha256=7hmB8DHkpcP0N2YLw-kF1mtD2NLMLF39xQmkjal90Yg,2769
|
|
40
40
|
graphiti_core/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
41
41
|
graphiti_core/models/edges/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
42
42
|
graphiti_core/models/edges/edge_db_queries.py,sha256=Poh5E6DcsU3tMsDLYQZ-pVw0kDorQZ-BXoxIiQiyP3Y,7168
|
|
@@ -69,12 +69,12 @@ graphiti_core/utils/datetime_utils.py,sha256=Ti-2tnrDFRzBsbfblzsHybsM3jaDLP4-VT2
|
|
|
69
69
|
graphiti_core/utils/maintenance/__init__.py,sha256=vW4H1KyapTl-OOz578uZABYcpND4wPx3Vt6aAPaXh78,301
|
|
70
70
|
graphiti_core/utils/maintenance/community_operations.py,sha256=gHqsRtX19LVH88B70GNTGnnq5Ic5kcm0Gu24wKP3-yQ,10492
|
|
71
71
|
graphiti_core/utils/maintenance/edge_operations.py,sha256=WOeuei29X5bcKP28WtCWTJGBea9TaBLYfZ3xKXbMhcU,19618
|
|
72
|
-
graphiti_core/utils/maintenance/graph_data_operations.py,sha256=
|
|
72
|
+
graphiti_core/utils/maintenance/graph_data_operations.py,sha256=fzDOUgf17rUM6Ubigi-ujxsESn4bJ_RKNO4DWsHyLuI,6908
|
|
73
73
|
graphiti_core/utils/maintenance/node_operations.py,sha256=r9ilkA01eq1z-nF8P_s1EXG6A6j15qmnfIqetnzqF50,13644
|
|
74
74
|
graphiti_core/utils/maintenance/temporal_operations.py,sha256=IIaVtShpVkOYe6haxz3a1x3v54-MzaEXG8VsxFUNeoY,3582
|
|
75
75
|
graphiti_core/utils/maintenance/utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
76
76
|
graphiti_core/utils/ontology_utils/entity_types_utils.py,sha256=4eVgxLWY6Q8k9cRJ5pW59IYF--U4nXZsZIGOVb_yHfQ,1285
|
|
77
|
-
graphiti_core-0.19.
|
|
78
|
-
graphiti_core-0.19.
|
|
79
|
-
graphiti_core-0.19.
|
|
80
|
-
graphiti_core-0.19.
|
|
77
|
+
graphiti_core-0.19.0rc3.dist-info/METADATA,sha256=_b6pt1z5sTtCN-HUL1Hv9d9ARiWR3eHGXIi9sWd66Ro,25917
|
|
78
|
+
graphiti_core-0.19.0rc3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
79
|
+
graphiti_core-0.19.0rc3.dist-info/licenses/LICENSE,sha256=KCUwCyDXuVEgmDWkozHyniRyWjnWUWjkuDHfU6o3JlA,11325
|
|
80
|
+
graphiti_core-0.19.0rc3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|