Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace redis with FalkorDB driver #5

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import logging
from typing import Any, Dict, List, Optional

import redis
from falkordb import FalkorDB
from llama_index.core.graph_stores.types import GraphStore

logger = logging.getLogger(__name__)
Expand All @@ -30,7 +30,7 @@ def __init__(
"""Initialize params."""
self._node_label = node_label

self._driver = redis.Redis.from_url(url).graph(database)
self._driver = FalkorDB.from_url(url).select_graph(database)
self._driver.query(f"CREATE INDEX FOR (n:`{self._node_label}`) ON (n.id)")

self._database = database
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ version = "0.1.2"
[tool.poetry.dependencies]
python = ">=3.8.1,<4.0"
llama-index-core = "^0.10.1"
redis = "^5.0.1"
FalkorDB = "^1.0.3"

[tool.poetry.group.dev.dependencies]
ipython = "8.10.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ def __init__(
**kwargs: Any,
) -> None:
try:
import redis
import falkordb
except ImportError:
raise ImportError("Please install redis client: pip install redis")
raise ImportError("Please install falkordb client: pip install falkordb")

"""Initialize params."""
self._node_label = node_label

self._driver = redis.Redis.from_url(url).graph(database)
self._driver = falkordb.FalkorDB.from_url(url).select_graph(database)
self._driver.query(f"CREATE INDEX FOR (n:`{self._node_label}`) ON (n.id)")

self._database = database
Expand Down
Loading