securing for production with env vars for creds
This commit is contained in:
@@ -28,6 +28,13 @@ from .storage import (
|
||||
from .kg.neo4j_impl import (
|
||||
GraphStorage as Neo4JStorage
|
||||
)
|
||||
#future KG integrations
|
||||
|
||||
# from .kg.ArangoDB_impl import (
|
||||
# GraphStorage as ArangoDBStorage
|
||||
# )
|
||||
|
||||
|
||||
|
||||
from .utils import (
|
||||
EmbeddingFunc,
|
||||
@@ -64,7 +71,11 @@ class LightRAG:
|
||||
)
|
||||
|
||||
kg: str = field(default="NetworkXStorage")
|
||||
|
||||
|
||||
current_log_level = logger.level
|
||||
log_level: str = field(default=current_log_level)
|
||||
|
||||
|
||||
|
||||
# text chunking
|
||||
chunk_token_size: int = 1200
|
||||
@@ -115,13 +126,14 @@ class LightRAG:
|
||||
def __post_init__(self):
|
||||
log_file = os.path.join(self.working_dir, "lightrag.log")
|
||||
set_logger(log_file)
|
||||
logger.setLevel(self.log_level)
|
||||
|
||||
logger.info(f"Logger initialized for working directory: {self.working_dir}")
|
||||
|
||||
_print_config = ",\n ".join([f"{k} = {v}" for k, v in asdict(self).items()])
|
||||
logger.debug(f"LightRAG init with param:\n {_print_config}\n")
|
||||
|
||||
#should move all storage setup here to leverage initial start params attached to self.
|
||||
print (f"self.kg set to: {self.kg}")
|
||||
self.graph_storage_cls: Type[BaseGraphStorage] = self._get_storage_class()[self.kg]
|
||||
|
||||
if not os.path.exists(self.working_dir):
|
||||
@@ -176,7 +188,7 @@ class LightRAG:
|
||||
return {
|
||||
"Neo4JStorage": Neo4JStorage,
|
||||
"NetworkXStorage": NetworkXStorage,
|
||||
# "new_kg_here": KGClass
|
||||
# "ArangoDBStorage": ArangoDBStorage
|
||||
}
|
||||
|
||||
def insert(self, string_or_strings):
|
||||
|
Reference in New Issue
Block a user