From e0adda65fc422582615c41acdd9c2b76b722611d Mon Sep 17 00:00:00 2001 From: Wenjie Zhang Date: Fri, 23 Jan 2026 22:29:24 +0800 Subject: [PATCH] =?UTF-8?q?fix(lightrag):=20=E4=BF=AE=E5=A4=8D=20lightrag?= =?UTF-8?q?=20=E7=9F=A5=E8=AF=86=E5=BA=93=20embedding=20dim=20=E7=9A=84?= =?UTF-8?q?=E9=94=99=E8=AF=AF=20Fixes:=20Error:=20=E7=9F=A5=E8=AF=86?= =?UTF-8?q?=E5=BA=93=E4=B8=8A=E4=BC=A0PDF=E6=A3=80=E7=B4=A2=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E5=A4=B1=E8=B4=A5=20Fixes=20#498=20Error:=20ValueErro?= =?UTF-8?q?r:=20Embedding=20dimension=20mismatch=20detected:=20total=20ele?= =?UTF-8?q?ments=20(1024)=20cannot=20be=20evenly=20divided=20by=20expected?= =?UTF-8?q?=20dimension=20(1536)=20Fixes=20#491?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/knowledge/implementations/lightrag.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/knowledge/implementations/lightrag.py b/src/knowledge/implementations/lightrag.py index cbfc9d59..057c6926 100644 --- a/src/knowledge/implementations/lightrag.py +++ b/src/knowledge/implementations/lightrag.py @@ -1,5 +1,6 @@ import os import traceback +from functools import partial from lightrag import LightRAG, QueryParam from lightrag.kg.shared_storage import initialize_pipeline_status @@ -222,8 +223,9 @@ class LightRagKB(KnowledgeBase): return EmbeddingFunc( embedding_dim=config_dict["dimension"], max_token_size=8192, - func=lambda texts: openai_embed( - texts=texts, + model_name=model_name, + func=partial( + openai_embed.func, model=model_name, api_key=config_dict["api_key"], base_url=config_dict["base_url"].replace("/embeddings", ""),