feat: 移除不必要的命名空间导入,优化本地存储初始化
This commit is contained in:
@@ -11,7 +11,7 @@ import pandas as pd
|
||||
import faiss
|
||||
|
||||
from .llm_client import LLMClient
|
||||
from .lpmmconfig import ENT_NAMESPACE, PG_NAMESPACE, REL_NAMESPACE, global_config
|
||||
from .lpmmconfig import global_config
|
||||
from .utils.hash import get_sha256
|
||||
from .global_logger import logger
|
||||
from rich.traceback import install
|
||||
@@ -25,6 +25,9 @@ from rich.progress import (
|
||||
SpinnerColumn,
|
||||
TextColumn,
|
||||
)
|
||||
from src.manager.local_store_manager import local_storage
|
||||
from src.llm_models.utils_model import LLMRequest
|
||||
|
||||
|
||||
install(extra_lines=3)
|
||||
ROOT_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", ".."))
|
||||
@@ -90,11 +93,11 @@ class EmbeddingStore:
|
||||
self.namespace = namespace
|
||||
self.llm_client = llm_client
|
||||
self.dir = dir_path
|
||||
self.embedding_file_path = dir_path + "/" + namespace + ".parquet"
|
||||
self.index_file_path = dir_path + "/" + namespace + ".index"
|
||||
self.embedding_file_path = f"{dir_path}/{namespace}.parquet"
|
||||
self.index_file_path = f"{dir_path}/{namespace}.index"
|
||||
self.idx2hash_file_path = dir_path + "/" + namespace + "_i2h.json"
|
||||
|
||||
self.store = dict()
|
||||
self.store = {}
|
||||
|
||||
self.faiss_index = None
|
||||
self.idx2hash = None
|
||||
@@ -296,17 +299,17 @@ class EmbeddingManager:
|
||||
def __init__(self, llm_client: LLMClient):
|
||||
self.paragraphs_embedding_store = EmbeddingStore(
|
||||
llm_client,
|
||||
PG_NAMESPACE,
|
||||
local_storage['pg_namespace'],
|
||||
EMBEDDING_DATA_DIR_STR,
|
||||
)
|
||||
self.entities_embedding_store = EmbeddingStore(
|
||||
llm_client,
|
||||
ENT_NAMESPACE,
|
||||
local_storage['pg_namespace'],
|
||||
EMBEDDING_DATA_DIR_STR,
|
||||
)
|
||||
self.relation_embedding_store = EmbeddingStore(
|
||||
llm_client,
|
||||
REL_NAMESPACE,
|
||||
local_storage['pg_namespace'],
|
||||
EMBEDDING_DATA_DIR_STR,
|
||||
)
|
||||
self.stored_pg_hashes = set()
|
||||
|
||||
Reference in New Issue
Block a user