diff --git a/lightrag/kg/mongo_impl.py b/lightrag/kg/mongo_impl.py index abd9a7c4..92c45638 100644 --- a/lightrag/kg/mongo_impl.py +++ b/lightrag/kg/mongo_impl.py @@ -89,7 +89,7 @@ class MongoKVStorage(BaseKVStorage): global_config=global_config, embedding_func=embedding_func, ) - self.__post_init__() + # __post_init__() is automatically called by dataclass def __post_init__(self): # Check for MONGODB_WORKSPACE environment variable first (higher priority) @@ -317,7 +317,7 @@ class MongoDocStatusStorage(DocStatusStorage): global_config=global_config, embedding_func=embedding_func, ) - self.__post_init__() + # __post_init__() is automatically called by dataclass def __post_init__(self): # Check for MONGODB_WORKSPACE environment variable first (higher priority) @@ -2052,9 +2052,12 @@ class MongoVectorDBStorage(BaseVectorStorage): embedding_func=embedding_func, meta_fields=meta_fields or set(), ) - self.__post_init__() + # __post_init__() is automatically called by dataclass def __post_init__(self): + # Call parent class __post_init__ to validate embedding_func + super().__post_init__() + # Check for MONGODB_WORKSPACE environment variable first (higher priority) # This allows administrators to force a specific workspace for all MongoDB storage instances mongodb_workspace = os.environ.get("MONGODB_WORKSPACE") diff --git a/lightrag/kg/qdrant_impl.py b/lightrag/kg/qdrant_impl.py index f32a9243..277c5dbb 100644 --- a/lightrag/kg/qdrant_impl.py +++ b/lightrag/kg/qdrant_impl.py @@ -121,7 +121,7 @@ class QdrantVectorDBStorage(BaseVectorStorage): embedding_func=embedding_func, meta_fields=meta_fields or set(), ) - self.__post_init__() + # __post_init__() is automatically called by dataclass @staticmethod def setup_collection( @@ -410,6 +410,9 @@ class QdrantVectorDBStorage(BaseVectorStorage): ) def __post_init__(self): + # Call parent class __post_init__ to validate embedding_func + super().__post_init__() + # Check for QDRANT_WORKSPACE environment variable first (higher priority) # This allows administrators to force a specific workspace for all Qdrant storage instances qdrant_workspace = os.environ.get("QDRANT_WORKSPACE")