From 2b76dc2e21d7d4558d6d207b1449a8c1cb69bbfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A2=A8=E6=A2=93=E6=9F=92?= <1787882683@qq.com> Date: Tue, 15 Jul 2025 15:50:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=A7=BB=E9=99=A4LLMClient=E4=BE=9D?= =?UTF-8?q?=E8=B5=96=EF=BC=8C=E6=94=B9=E4=B8=BA=E4=BD=BF=E7=94=A8get=5Femb?= =?UTF-8?q?edding=E5=87=BD=E6=95=B0=E8=8E=B7=E5=8F=96=E5=B5=8C=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/chat/knowledge/embedding_store.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/chat/knowledge/embedding_store.py b/src/chat/knowledge/embedding_store.py index f82e826a9..80b1c02c2 100644 --- a/src/chat/knowledge/embedding_store.py +++ b/src/chat/knowledge/embedding_store.py @@ -26,7 +26,7 @@ from rich.progress import ( TextColumn, ) from src.manager.local_store_manager import local_storage -from src.llm_models.utils_model import LLMRequest +from src.chat.utils.utils import get_embedding install(extra_lines=3) @@ -89,9 +89,8 @@ class EmbeddingStoreItem: class EmbeddingStore: - def __init__(self, llm_client: LLMClient, namespace: str, dir_path: str): + def __init__(self, namespace: str, dir_path: str): self.namespace = namespace - self.llm_client = llm_client self.dir = dir_path self.embedding_file_path = f"{dir_path}/{namespace}.parquet" self.index_file_path = f"{dir_path}/{namespace}.index" @@ -103,7 +102,7 @@ class EmbeddingStore: self.idx2hash = None def _get_embedding(self, s: str) -> List[float]: - return self.llm_client.send_embedding_request(global_config["embedding"]["model"], s) + return get_embedding(s) def get_test_file_path(self): return EMBEDDING_TEST_FILE @@ -298,17 +297,14 @@ class EmbeddingStore: class EmbeddingManager: def __init__(self, llm_client: LLMClient): self.paragraphs_embedding_store = EmbeddingStore( - llm_client, local_storage['pg_namespace'], EMBEDDING_DATA_DIR_STR, ) self.entities_embedding_store = EmbeddingStore( - llm_client, local_storage['pg_namespace'], EMBEDDING_DATA_DIR_STR, ) self.relation_embedding_store = EmbeddingStore( - llm_client, local_storage['pg_namespace'], EMBEDDING_DATA_DIR_STR, )