mirror of
https://github.com/getzep/graphiti.git
synced 2025-06-27 02:00:02 +00:00
parent
1c51a18430
commit
fb6d674fc2
@ -24,6 +24,7 @@ from logging import INFO
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from graphiti_core import Graphiti
|
||||
from graphiti_core.driver.falkordb_driver import FalkorDriver
|
||||
from graphiti_core.nodes import EpisodeType
|
||||
from graphiti_core.search.search_config_recipes import NODE_HYBRID_SEARCH_RRF
|
||||
|
||||
@ -47,6 +48,8 @@ load_dotenv()
|
||||
# FalkorDB connection parameters
|
||||
# Make sure FalkorDB on premises is running, see https://docs.falkordb.com/
|
||||
falkor_uri = os.environ.get('FALKORDB_URI', 'falkor://localhost:6379')
|
||||
falkor_user = os.environ.get('FALKORDB_USER', 'falkor')
|
||||
falkor_password = os.environ.get('FALKORDB_PASSWORD', '')
|
||||
|
||||
if not falkor_uri:
|
||||
raise ValueError('FALKORDB_URI must be set')
|
||||
@ -62,7 +65,8 @@ async def main():
|
||||
#################################################
|
||||
|
||||
# Initialize Graphiti with FalkorDB connection
|
||||
graphiti = Graphiti(falkor_uri)
|
||||
falkor_driver = FalkorDriver(uri=falkor_uri, user=falkor_user, password=falkor_password)
|
||||
graphiti = Graphiti(uri=falkor_uri, graph_driver=falkor_driver)
|
||||
|
||||
try:
|
||||
# Initialize the graph database with graphiti's indices. This only needs to be done once.
|
||||
|
@ -71,12 +71,11 @@ class FalkorDriver(GraphDriver):
|
||||
password: str,
|
||||
):
|
||||
super().__init__()
|
||||
if user and password:
|
||||
uri_parts = uri.split('://', 1)
|
||||
uri = f'{uri_parts[0]}://{user}:{password}@{uri_parts[1]}'
|
||||
uri_parts = uri.split('://', 1)
|
||||
uri = f'{uri_parts[0]}://{user}:{password}@{uri_parts[1]}'
|
||||
|
||||
self.client = FalkorDB.from_url(
|
||||
url=uri,
|
||||
self.client = FalkorDB(
|
||||
host='your-db.falkor.cloud', port=6380, password='your_password', ssl=True
|
||||
)
|
||||
|
||||
def _get_graph(self, graph_name: str | None) -> FalkorGraph:
|
||||
|
Loading…
x
Reference in New Issue
Block a user