From 536b755bf37354a852aeba0ce98ac514b6e7657f Mon Sep 17 00:00:00 2001 From: martsforever Date: Sun, 7 Sep 2025 00:05:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20LLamaIndexEmbeddings=EF=BC=8C=E5=90=8C?= =?UTF-8?q?=E6=97=B6=E6=94=AF=E6=8C=81=E5=90=8C=E6=AD=A5=E5=BC=82=E6=AD=A5?= =?UTF-8?q?=E7=9A=84embedding=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/utils/llm_utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/utils/llm_utils.py b/app/utils/llm_utils.py index 75b4a92..c0d28b1 100644 --- a/app/utils/llm_utils.py +++ b/app/utils/llm_utils.py @@ -3,7 +3,7 @@ from langchain_openai import ChatOpenAI from llama_index.llms.openai_like import OpenAILike from app.config.ai_configs import ai_configs -from app.utils.CustomEmbeddings import CustomEmbeddings +from app.utils.LLamaIndexEmbeddings import LLamaIndexEmbeddings def create_llm(platform_code='huoshan-doubao', temperature=0.5): @@ -45,7 +45,7 @@ def create_embeddings(platform_code="huoshan-embedding-240715"): platform_code: 平台代码,用于从默认配置中查找对应平台的API信息 返回: - CustomEmbeddings类的实例,用于生成文本嵌入向量 + LLamaIndexEmbeddings类的实例,用于生成文本嵌入向量 异常: 当找不到对应平台代码的配置时抛出异常 @@ -58,7 +58,7 @@ def create_embeddings(platform_code="huoshan-embedding-240715"): raise Exception('Unknown platform code', platform_code) # 创建并返回自定义嵌入模型实例 - return CustomEmbeddings( + return LLamaIndexEmbeddings( base_url=_ai_config.get('url').replace("/embeddings", ""), # API基础URL api_key=_ai_config.get('key'), # API密钥 model=_ai_config.get('model') # 嵌入模型名称