chore: added pre-commit-hooks and ruff formatting for commit-hooks
This commit is contained in:
@@ -4,10 +4,11 @@ import time
|
||||
|
||||
from lightrag import LightRAG
|
||||
|
||||
|
||||
def insert_text(rag, file_path):
|
||||
with open(file_path, mode='r') as f:
|
||||
with open(file_path, mode="r") as f:
|
||||
unique_contexts = json.load(f)
|
||||
|
||||
|
||||
retries = 0
|
||||
max_retries = 3
|
||||
while retries < max_retries:
|
||||
@@ -21,6 +22,7 @@ def insert_text(rag, file_path):
|
||||
if retries == max_retries:
|
||||
print("Insertion failed after exceeding the maximum number of retries")
|
||||
|
||||
|
||||
cls = "agriculture"
|
||||
WORKING_DIR = "../{cls}"
|
||||
|
||||
@@ -29,4 +31,4 @@ if not os.path.exists(WORKING_DIR):
|
||||
|
||||
rag = LightRAG(working_dir=WORKING_DIR)
|
||||
|
||||
insert_text(rag, f"../datasets/unique_contexts/{cls}_unique_contexts.json")
|
||||
insert_text(rag, f"../datasets/unique_contexts/{cls}_unique_contexts.json")
|
||||
|
Reference in New Issue
Block a user