mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-14 08:56:27 +00:00
Add optional arguments to FalkorDBGraph constructor (#13459)
**Description:** Add optional arguments to FalkorDBGraph constructor **Tag maintainer:** baskaryan **Twitter handle:** @g_korland
This commit is contained in:
parent
e3a5cd7969
commit
7f8fd70ac4
@ -1,4 +1,4 @@
|
|||||||
from typing import Any, Dict, List
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
from langchain.graphs.graph_document import GraphDocument
|
from langchain.graphs.graph_document import GraphDocument
|
||||||
from langchain.graphs.graph_store import GraphStore
|
from langchain.graphs.graph_store import GraphStore
|
||||||
@ -48,7 +48,13 @@ class FalkorDBGraph(GraphStore):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, database: str, host: str = "localhost", port: int = 6379
|
self,
|
||||||
|
database: str,
|
||||||
|
host: str = "localhost",
|
||||||
|
port: int = 6379,
|
||||||
|
username: Optional[str] = None,
|
||||||
|
password: Optional[str] = None,
|
||||||
|
ssl: bool = False,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Create a new FalkorDB graph wrapper instance."""
|
"""Create a new FalkorDB graph wrapper instance."""
|
||||||
try:
|
try:
|
||||||
@ -60,7 +66,9 @@ class FalkorDBGraph(GraphStore):
|
|||||||
"Please install it with `pip install redis`."
|
"Please install it with `pip install redis`."
|
||||||
)
|
)
|
||||||
|
|
||||||
self._driver = redis.Redis(host=host, port=port)
|
self._driver = redis.Redis(
|
||||||
|
host=host, port=port, username=username, password=password, ssl=ssl
|
||||||
|
)
|
||||||
self._graph = Graph(self._driver, database)
|
self._graph = Graph(self._driver, database)
|
||||||
self.schema: str = ""
|
self.schema: str = ""
|
||||||
self.structured_schema: Dict[str, Any] = {}
|
self.structured_schema: Dict[str, Any] = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user