fix configuration errors of mongodb, neo4j, and qdrant backends.

This commit is contained in:
ArnoChen
2025-02-14 02:48:15 +08:00
parent 8282a0ee00
commit 9a91b68e62
4 changed files with 9 additions and 8 deletions

View File

@@ -101,6 +101,7 @@ def estimate_tokens(text: str) -> int:
return int(tokens) return int(tokens)
def get_default_host(binding_type: str) -> str: def get_default_host(binding_type: str) -> str:
default_hosts = { default_hosts = {
"ollama": os.getenv("LLM_BINDING_HOST", "http://localhost:11434"), "ollama": os.getenv("LLM_BINDING_HOST", "http://localhost:11434"),

View File

@@ -44,7 +44,7 @@ class MongoKVStorage(BaseKVStorage):
database = client.get_database( database = client.get_database(
os.environ.get( os.environ.get(
"MONGO_DATABASE", "MONGO_DATABASE",
mongo_database=config.get("mongodb", "database", fallback="LightRAG"), config.get("mongodb", "database", fallback="LightRAG"),
) )
) )
self._data = database.get_collection(self.namespace) self._data = database.get_collection(self.namespace)

View File

@@ -48,13 +48,13 @@ class Neo4JStorage(BaseGraphStorage):
self._driver = None self._driver = None
self._driver_lock = asyncio.Lock() self._driver_lock = asyncio.Lock()
URI = os.environ["NEO4J_URI", config.get("neo4j", "uri", fallback=None)] URI = os.environ.get("NEO4J_URI", config.get("neo4j", "uri", fallback=None))
USERNAME = os.environ[ USERNAME = os.environ.get(
"NEO4J_USERNAME", config.get("neo4j", "username", fallback=None) "NEO4J_USERNAME", config.get("neo4j", "username", fallback=None)
] )
PASSWORD = os.environ[ PASSWORD = os.environ.get(
"NEO4J_PASSWORD", config.get("neo4j", "password", fallback=None) "NEO4J_PASSWORD", config.get("neo4j", "password", fallback=None)
] )
MAX_CONNECTION_POOL_SIZE = os.environ.get( MAX_CONNECTION_POOL_SIZE = os.environ.get(
"NEO4J_MAX_CONNECTION_POOL_SIZE", "NEO4J_MAX_CONNECTION_POOL_SIZE",
config.get("neo4j", "connection_pool_size", fallback=800), config.get("neo4j", "connection_pool_size", fallback=800),

View File

@@ -61,8 +61,8 @@ class QdrantVectorDBStorage(BaseVectorStorage):
client.create_collection(collection_name, **kwargs) client.create_collection(collection_name, **kwargs)
def __post_init__(self): def __post_init__(self):
config = self.global_config.get("vector_db_storage_cls_kwargs", {}) kwargs = self.global_config.get("vector_db_storage_cls_kwargs", {})
cosine_threshold = config.get("cosine_better_than_threshold") cosine_threshold = kwargs.get("cosine_better_than_threshold")
if cosine_threshold is None: if cosine_threshold is None:
raise ValueError( raise ValueError(
"cosine_better_than_threshold must be specified in vector_db_storage_cls_kwargs" "cosine_better_than_threshold must be specified in vector_db_storage_cls_kwargs"