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

community[patch]: change default Neo4j username/password #25226

Merged
merged 6 commits into from
Sep 3, 2024
Merged
Changes from all 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
23 changes: 16 additions & 7 deletions libs/community/langchain_community/graphs/neo4j_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,18 +346,27 @@ def __init__(
)

url = get_from_dict_or_env({"url": url}, "url", "NEO4J_URI")
username = get_from_dict_or_env(
{"username": username}, "username", "NEO4J_USERNAME"
)
password = get_from_dict_or_env(
{"password": password}, "password", "NEO4J_PASSWORD"
)
# if username and password are "", assume Neo4j auth is disabled
if username == "" and password == "":
auth = None
else:
username = get_from_dict_or_env(
{"username": username},
"username",
"NEO4J_USERNAME",
)
password = get_from_dict_or_env(
{"password": password},
"password",
"NEO4J_PASSWORD",
)
auth = (username, password)
database = get_from_dict_or_env(
{"database": database}, "database", "NEO4J_DATABASE", "neo4j"
)

self._driver = neo4j.GraphDatabase.driver(
url, auth=(username, password), **(driver_config or {})
url, auth=auth, **(driver_config or {})
)
self._database = database
self.timeout = timeout
Expand Down
Loading