Skip to content

Commit 3c1502a

Browse files
committed
fix readme review issues
1 parent d1b6056 commit 3c1502a

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

CONTRIBUTING.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,31 @@ All third-party integrations must be optional dependencies to keep the core libr
185185
- Place database drivers in `graphiti_core/driver/`
186186
- Follow existing naming conventions (e.g., `your_service_client.py`)
187187

188+
### Adding a Graph Driver
189+
190+
Graphiti's driver layer is backend-agnostic. To add support for a new graph database, mirror the existing drivers in
191+
`graphiti_core/driver/` and keep the implementation split between the top-level driver and provider-specific
192+
operations.
193+
194+
1. Add the new provider to `graphiti_core/driver/driver.py` in `GraphProvider`.
195+
2. Create `graphiti_core/driver/<backend>_driver.py` implementing the `GraphDriver` interface:
196+
`execute_query()`, `session()`, `close()`, `build_indices_and_constraints()`, and `delete_all_indexes()`.
197+
3. Add `graphiti_core/driver/<backend>/operations/` and implement the operations interfaces from
198+
`graphiti_core/driver/operations/`:
199+
`EntityNodeOperations`, `EpisodeNodeOperations`, `CommunityNodeOperations`, `SagaNodeOperations`,
200+
`EntityEdgeOperations`, `EpisodicEdgeOperations`, `CommunityEdgeOperations`, `HasEpisodeEdgeOperations`,
201+
`NextEpisodeEdgeOperations`, `SearchOperations`, and `GraphMaintenanceOperations`.
202+
4. Expose those concrete operations from the driver via the corresponding `@property` accessors on `GraphDriver`.
203+
5. Add provider-specific query variants to `graphiti_core/models/nodes/node_db_queries.py` and
204+
`graphiti_core/models/edges/edge_db_queries.py`.
205+
6. If the backend needs connection or transaction management, implement a matching `GraphDriverSession`.
206+
7. Register the backend dependency in `pyproject.toml` under `[project.optional-dependencies]` and add tests under
207+
`tests/driver/`.
208+
209+
For reference implementations, start with `graphiti_core/driver/neo4j_driver.py`,
210+
`graphiti_core/driver/falkordb_driver.py`, `graphiti_core/driver/kuzu_driver.py`, and
211+
`graphiti_core/driver/neptune_driver.py`.
212+
188213
### Testing
189214

190215
- Add comprehensive tests in the appropriate `tests/` subdirectory

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -383,16 +383,18 @@ from graphiti_core.driver.neptune_driver import NeptuneDriver
383383

384384
# Create a Neptune driver
385385
driver = NeptuneDriver(
386-
host=<NEPTUNE_ENDPOINT>,
387-
aoss_host=<Amazon_OpenSearch_Serverless_Host>,
388-
port=<PORT>, # Optional, defaults to 8182
389-
aoss_port=<PORT>, # Optional, defaults to 443
386+
host='<NEPTUNE_ENDPOINT>',
387+
aoss_host='<AMAZON_OPENSEARCH_SERVERLESS_HOST>',
388+
port=8182, # Optional, defaults to 8182
389+
aoss_port=443, # Optional, defaults to 443
390390
)
391391

392392
# Pass the driver to Graphiti
393393
graphiti = Graphiti(graph_driver=driver)
394394
```
395395

396+
Contributing a new graph backend? See [Adding a graph driver](CONTRIBUTING.md#adding-a-graph-driver).
397+
396398
## Using Graphiti with Azure OpenAI
397399

398400
Graphiti supports Azure OpenAI for both LLM inference and embeddings using Azure's OpenAI v1 API compatibility layer.

0 commit comments

Comments
 (0)