open-webui: patch imports for langchain v1
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
diff --git a/backend/open_webui/retrieval/utils.py b/backend/open_webui/retrieval/utils.py
|
||||
index da570330b..6ea16e249 100644
|
||||
--- a/backend/open_webui/retrieval/utils.py
|
||||
+++ b/backend/open_webui/retrieval/utils.py
|
||||
@@ -10,7 +10,7 @@ import re
|
||||
|
||||
from urllib.parse import quote
|
||||
from huggingface_hub import snapshot_download
|
||||
-from langchain.retrievers import ContextualCompressionRetriever, EnsembleRetriever
|
||||
+from langchain_classic.retrievers import ContextualCompressionRetriever, EnsembleRetriever
|
||||
from langchain_community.retrievers import BM25Retriever
|
||||
from langchain_core.documents import Document
|
||||
|
||||
diff --git a/backend/open_webui/routers/retrieval.py b/backend/open_webui/routers/retrieval.py
|
||||
index f8147372f..363bb4706 100644
|
||||
--- a/backend/open_webui/routers/retrieval.py
|
||||
+++ b/backend/open_webui/routers/retrieval.py
|
||||
@@ -28,8 +28,7 @@ from pydantic import BaseModel
|
||||
import tiktoken
|
||||
|
||||
|
||||
-from langchain.text_splitter import RecursiveCharacterTextSplitter, TokenTextSplitter
|
||||
-from langchain_text_splitters import MarkdownHeaderTextSplitter
|
||||
+from langchain_text_splitters import MarkdownHeaderTextSplitter, RecursiveCharacterTextSplitter, TokenTextSplitter
|
||||
from langchain_core.documents import Document
|
||||
|
||||
from open_webui.models.files import FileModel, Files
|
||||
@@ -75,6 +75,8 @@ python3Packages.buildPythonApplication rec {
|
||||
|
||||
build-system = with python3Packages; [ hatchling ];
|
||||
|
||||
patches = [ ./langchain-v1.patch ];
|
||||
|
||||
# Not force-including the frontend build directory as frontend is managed by the `frontend` derivation above.
|
||||
postPatch = ''
|
||||
substituteInPlace pyproject.toml \
|
||||
@@ -128,6 +130,7 @@ python3Packages.buildPythonApplication rec {
|
||||
iso-639
|
||||
itsdangerous
|
||||
langchain
|
||||
langchain-classic
|
||||
langchain-community
|
||||
langdetect
|
||||
ldap3
|
||||
|
||||
Reference in New Issue
Block a user