ArnoChen
commited on
Commit
·
16c98b2
1
Parent(s):
de7d7e4
fix configuration errors of mongodb, neo4j, and qdrant backends.
Browse files- lightrag/api/lightrag_server.py +1 -0
- lightrag/kg/mongo_impl.py +1 -1
- lightrag/kg/neo4j_impl.py +5 -5
- lightrag/kg/qdrant_impl.py +2 -2
lightrag/api/lightrag_server.py
CHANGED
@@ -101,6 +101,7 @@ def estimate_tokens(text: str) -> int:
|
|
101 |
|
102 |
return int(tokens)
|
103 |
|
|
|
104 |
def get_default_host(binding_type: str) -> str:
|
105 |
default_hosts = {
|
106 |
"ollama": os.getenv("LLM_BINDING_HOST", "http://localhost:11434"),
|
|
|
101 |
|
102 |
return int(tokens)
|
103 |
|
104 |
+
|
105 |
def get_default_host(binding_type: str) -> str:
|
106 |
default_hosts = {
|
107 |
"ollama": os.getenv("LLM_BINDING_HOST", "http://localhost:11434"),
|
lightrag/kg/mongo_impl.py
CHANGED
@@ -44,7 +44,7 @@ class MongoKVStorage(BaseKVStorage):
|
|
44 |
database = client.get_database(
|
45 |
os.environ.get(
|
46 |
"MONGO_DATABASE",
|
47 |
-
|
48 |
)
|
49 |
)
|
50 |
self._data = database.get_collection(self.namespace)
|
|
|
44 |
database = client.get_database(
|
45 |
os.environ.get(
|
46 |
"MONGO_DATABASE",
|
47 |
+
config.get("mongodb", "database", fallback="LightRAG"),
|
48 |
)
|
49 |
)
|
50 |
self._data = database.get_collection(self.namespace)
|
lightrag/kg/neo4j_impl.py
CHANGED
@@ -48,13 +48,13 @@ class Neo4JStorage(BaseGraphStorage):
|
|
48 |
self._driver = None
|
49 |
self._driver_lock = asyncio.Lock()
|
50 |
|
51 |
-
URI = os.environ
|
52 |
-
USERNAME = os.environ
|
53 |
"NEO4J_USERNAME", config.get("neo4j", "username", fallback=None)
|
54 |
-
|
55 |
-
PASSWORD = os.environ
|
56 |
"NEO4J_PASSWORD", config.get("neo4j", "password", fallback=None)
|
57 |
-
|
58 |
MAX_CONNECTION_POOL_SIZE = os.environ.get(
|
59 |
"NEO4J_MAX_CONNECTION_POOL_SIZE",
|
60 |
config.get("neo4j", "connection_pool_size", fallback=800),
|
|
|
48 |
self._driver = None
|
49 |
self._driver_lock = asyncio.Lock()
|
50 |
|
51 |
+
URI = os.environ.get("NEO4J_URI", config.get("neo4j", "uri", fallback=None))
|
52 |
+
USERNAME = os.environ.get(
|
53 |
"NEO4J_USERNAME", config.get("neo4j", "username", fallback=None)
|
54 |
+
)
|
55 |
+
PASSWORD = os.environ.get(
|
56 |
"NEO4J_PASSWORD", config.get("neo4j", "password", fallback=None)
|
57 |
+
)
|
58 |
MAX_CONNECTION_POOL_SIZE = os.environ.get(
|
59 |
"NEO4J_MAX_CONNECTION_POOL_SIZE",
|
60 |
config.get("neo4j", "connection_pool_size", fallback=800),
|
lightrag/kg/qdrant_impl.py
CHANGED
@@ -61,8 +61,8 @@ class QdrantVectorDBStorage(BaseVectorStorage):
|
|
61 |
client.create_collection(collection_name, **kwargs)
|
62 |
|
63 |
def __post_init__(self):
|
64 |
-
|
65 |
-
cosine_threshold =
|
66 |
if cosine_threshold is None:
|
67 |
raise ValueError(
|
68 |
"cosine_better_than_threshold must be specified in vector_db_storage_cls_kwargs"
|
|
|
61 |
client.create_collection(collection_name, **kwargs)
|
62 |
|
63 |
def __post_init__(self):
|
64 |
+
kwargs = self.global_config.get("vector_db_storage_cls_kwargs", {})
|
65 |
+
cosine_threshold = kwargs.get("cosine_better_than_threshold")
|
66 |
if cosine_threshold is None:
|
67 |
raise ValueError(
|
68 |
"cosine_better_than_threshold must be specified in vector_db_storage_cls_kwargs"
|