From 5b7cf889153dbc6f81b49364d19d15622af40400 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sat, 28 Sep 2024 01:28:45 +0200 Subject: [PATCH] refac --- backend/open_webui/apps/retrieval/main.py | 26 +++++++++---------- .../open_webui/apps/retrieval/search/brave.py | 2 +- .../apps/retrieval/search/duckduckgo.py | 2 +- .../apps/retrieval/search/google_pse.py | 2 +- .../apps/retrieval/search/jina_search.py | 2 +- .../apps/retrieval/search/searchapi.py | 2 +- .../apps/retrieval/search/searxng.py | 2 +- .../apps/retrieval/search/serper.py | 2 +- .../apps/retrieval/search/serply.py | 2 +- .../apps/retrieval/search/serpstack.py | 2 +- .../apps/retrieval/search/tavily.py | 2 +- backend/open_webui/apps/retrieval/utils.py | 2 +- .../apps/retrieval/vector/connector.py | 4 +-- .../apps/retrieval/vector/dbs/chroma.py | 2 +- .../apps/retrieval/vector/dbs/milvus.py | 2 +- .../open_webui/apps/webui/routers/memories.py | 2 +- 16 files changed, 29 insertions(+), 29 deletions(-) diff --git a/backend/open_webui/apps/retrieval/main.py b/backend/open_webui/apps/retrieval/main.py index d276bd80b..e4f98b8b0 100644 --- a/backend/open_webui/apps/retrieval/main.py +++ b/backend/open_webui/apps/retrieval/main.py @@ -20,18 +20,18 @@ from fastapi import Depends, FastAPI, File, Form, HTTPException, UploadFile, sta from fastapi.middleware.cors import CORSMiddleware from pydantic import BaseModel -from open_webui.apps.rag.search.main import SearchResult -from open_webui.apps.rag.search.brave import search_brave -from open_webui.apps.rag.search.duckduckgo import search_duckduckgo -from open_webui.apps.rag.search.google_pse import search_google_pse -from open_webui.apps.rag.search.jina_search import search_jina -from open_webui.apps.rag.search.searchapi import search_searchapi -from open_webui.apps.rag.search.searxng import search_searxng -from open_webui.apps.rag.search.serper import search_serper -from open_webui.apps.rag.search.serply import search_serply -from open_webui.apps.rag.search.serpstack import search_serpstack -from open_webui.apps.rag.search.tavily import search_tavily -from open_webui.apps.rag.utils import ( +from open_webui.apps.retrieval.search.main import SearchResult +from open_webui.apps.retrieval.search.brave import search_brave +from open_webui.apps.retrieval.search.duckduckgo import search_duckduckgo +from open_webui.apps.retrieval.search.google_pse import search_google_pse +from open_webui.apps.retrieval.search.jina_search import search_jina +from open_webui.apps.retrieval.search.searchapi import search_searchapi +from open_webui.apps.retrieval.search.searxng import search_searxng +from open_webui.apps.retrieval.search.serper import search_serper +from open_webui.apps.retrieval.search.serply import search_serply +from open_webui.apps.retrieval.search.serpstack import search_serpstack +from open_webui.apps.retrieval.search.tavily import search_tavily +from open_webui.apps.retrieval.utils import ( get_embedding_function, get_model_path, query_collection, @@ -98,7 +98,7 @@ from open_webui.utils.misc import ( sanitize_filename, ) from open_webui.utils.utils import get_admin_user, get_verified_user -from open_webui.apps.rag.vector.connector import VECTOR_DB_CLIENT +from open_webui.apps.retrieval.vector.connector import VECTOR_DB_CLIENT from langchain.text_splitter import RecursiveCharacterTextSplitter from langchain_community.document_loaders import ( diff --git a/backend/open_webui/apps/retrieval/search/brave.py b/backend/open_webui/apps/retrieval/search/brave.py index 2eb256b4b..11a2938b2 100644 --- a/backend/open_webui/apps/retrieval/search/brave.py +++ b/backend/open_webui/apps/retrieval/search/brave.py @@ -2,7 +2,7 @@ import logging from typing import Optional import requests -from open_webui.apps.rag.search.main import SearchResult, get_filtered_results +from open_webui.apps.retrieval.search.main import SearchResult, get_filtered_results from open_webui.env import SRC_LOG_LEVELS log = logging.getLogger(__name__) diff --git a/backend/open_webui/apps/retrieval/search/duckduckgo.py b/backend/open_webui/apps/retrieval/search/duckduckgo.py index a8a580aca..82558ba37 100644 --- a/backend/open_webui/apps/retrieval/search/duckduckgo.py +++ b/backend/open_webui/apps/retrieval/search/duckduckgo.py @@ -1,7 +1,7 @@ import logging from typing import Optional -from open_webui.apps.rag.search.main import SearchResult, get_filtered_results +from open_webui.apps.retrieval.search.main import SearchResult, get_filtered_results from duckduckgo_search import DDGS from open_webui.env import SRC_LOG_LEVELS diff --git a/backend/open_webui/apps/retrieval/search/google_pse.py b/backend/open_webui/apps/retrieval/search/google_pse.py index a7f75a6c6..c42851f47 100644 --- a/backend/open_webui/apps/retrieval/search/google_pse.py +++ b/backend/open_webui/apps/retrieval/search/google_pse.py @@ -2,7 +2,7 @@ import logging from typing import Optional import requests -from open_webui.apps.rag.search.main import SearchResult, get_filtered_results +from open_webui.apps.retrieval.search.main import SearchResult, get_filtered_results from open_webui.env import SRC_LOG_LEVELS log = logging.getLogger(__name__) diff --git a/backend/open_webui/apps/retrieval/search/jina_search.py b/backend/open_webui/apps/retrieval/search/jina_search.py index 41cde679d..f44f10d5c 100644 --- a/backend/open_webui/apps/retrieval/search/jina_search.py +++ b/backend/open_webui/apps/retrieval/search/jina_search.py @@ -1,7 +1,7 @@ import logging import requests -from open_webui.apps.rag.search.main import SearchResult +from open_webui.apps.retrieval.search.main import SearchResult from open_webui.env import SRC_LOG_LEVELS from yarl import URL diff --git a/backend/open_webui/apps/retrieval/search/searchapi.py b/backend/open_webui/apps/retrieval/search/searchapi.py index 9ec9a0747..a648d6600 100644 --- a/backend/open_webui/apps/retrieval/search/searchapi.py +++ b/backend/open_webui/apps/retrieval/search/searchapi.py @@ -3,7 +3,7 @@ from typing import Optional from urllib.parse import urlencode import requests -from open_webui.apps.rag.search.main import SearchResult, get_filtered_results +from open_webui.apps.retrieval.search.main import SearchResult, get_filtered_results from open_webui.env import SRC_LOG_LEVELS log = logging.getLogger(__name__) diff --git a/backend/open_webui/apps/retrieval/search/searxng.py b/backend/open_webui/apps/retrieval/search/searxng.py index 26c534aa3..14b6b40b5 100644 --- a/backend/open_webui/apps/retrieval/search/searxng.py +++ b/backend/open_webui/apps/retrieval/search/searxng.py @@ -2,7 +2,7 @@ import logging from typing import Optional import requests -from open_webui.apps.rag.search.main import SearchResult, get_filtered_results +from open_webui.apps.retrieval.search.main import SearchResult, get_filtered_results from open_webui.env import SRC_LOG_LEVELS log = logging.getLogger(__name__) diff --git a/backend/open_webui/apps/retrieval/search/serper.py b/backend/open_webui/apps/retrieval/search/serper.py index ed7cc2c5f..afebe8097 100644 --- a/backend/open_webui/apps/retrieval/search/serper.py +++ b/backend/open_webui/apps/retrieval/search/serper.py @@ -3,7 +3,7 @@ import logging from typing import Optional import requests -from open_webui.apps.rag.search.main import SearchResult, get_filtered_results +from open_webui.apps.retrieval.search.main import SearchResult, get_filtered_results from open_webui.env import SRC_LOG_LEVELS log = logging.getLogger(__name__) diff --git a/backend/open_webui/apps/retrieval/search/serply.py b/backend/open_webui/apps/retrieval/search/serply.py index 260e9b30e..266fd666a 100644 --- a/backend/open_webui/apps/retrieval/search/serply.py +++ b/backend/open_webui/apps/retrieval/search/serply.py @@ -3,7 +3,7 @@ from typing import Optional from urllib.parse import urlencode import requests -from open_webui.apps.rag.search.main import SearchResult, get_filtered_results +from open_webui.apps.retrieval.search.main import SearchResult, get_filtered_results from open_webui.env import SRC_LOG_LEVELS log = logging.getLogger(__name__) diff --git a/backend/open_webui/apps/retrieval/search/serpstack.py b/backend/open_webui/apps/retrieval/search/serpstack.py index 962c1a5b3..236fb5181 100644 --- a/backend/open_webui/apps/retrieval/search/serpstack.py +++ b/backend/open_webui/apps/retrieval/search/serpstack.py @@ -2,7 +2,7 @@ import logging from typing import Optional import requests -from open_webui.apps.rag.search.main import SearchResult, get_filtered_results +from open_webui.apps.retrieval.search.main import SearchResult, get_filtered_results from open_webui.env import SRC_LOG_LEVELS log = logging.getLogger(__name__) diff --git a/backend/open_webui/apps/retrieval/search/tavily.py b/backend/open_webui/apps/retrieval/search/tavily.py index a619d29ed..00f5b15c4 100644 --- a/backend/open_webui/apps/retrieval/search/tavily.py +++ b/backend/open_webui/apps/retrieval/search/tavily.py @@ -1,7 +1,7 @@ import logging import requests -from open_webui.apps.rag.search.main import SearchResult +from open_webui.apps.retrieval.search.main import SearchResult from open_webui.env import SRC_LOG_LEVELS log = logging.getLogger(__name__) diff --git a/backend/open_webui/apps/retrieval/utils.py b/backend/open_webui/apps/retrieval/utils.py index f9443d380..1fa30e6a0 100644 --- a/backend/open_webui/apps/retrieval/utils.py +++ b/backend/open_webui/apps/retrieval/utils.py @@ -15,7 +15,7 @@ from open_webui.apps.ollama.main import ( GenerateEmbeddingsForm, generate_ollama_embeddings, ) -from open_webui.apps.rag.vector.connector import VECTOR_DB_CLIENT +from open_webui.apps.retrieval.vector.connector import VECTOR_DB_CLIENT from open_webui.utils.misc import get_last_user_message from open_webui.env import SRC_LOG_LEVELS diff --git a/backend/open_webui/apps/retrieval/vector/connector.py b/backend/open_webui/apps/retrieval/vector/connector.py index 073becdbe..5b203271f 100644 --- a/backend/open_webui/apps/retrieval/vector/connector.py +++ b/backend/open_webui/apps/retrieval/vector/connector.py @@ -1,5 +1,5 @@ -from open_webui.apps.rag.vector.dbs.chroma import ChromaClient -from open_webui.apps.rag.vector.dbs.milvus import MilvusClient +from open_webui.apps.retrieval.vector.dbs.chroma import ChromaClient +from open_webui.apps.retrieval.vector.dbs.milvus import MilvusClient from open_webui.config import VECTOR_DB diff --git a/backend/open_webui/apps/retrieval/vector/dbs/chroma.py b/backend/open_webui/apps/retrieval/vector/dbs/chroma.py index 5f9420108..fe065f868 100644 --- a/backend/open_webui/apps/retrieval/vector/dbs/chroma.py +++ b/backend/open_webui/apps/retrieval/vector/dbs/chroma.py @@ -4,7 +4,7 @@ from chromadb.utils.batch_utils import create_batches from typing import Optional -from open_webui.apps.rag.vector.main import VectorItem, SearchResult, GetResult +from open_webui.apps.retrieval.vector.main import VectorItem, SearchResult, GetResult from open_webui.config import ( CHROMA_DATA_PATH, CHROMA_HTTP_HOST, diff --git a/backend/open_webui/apps/retrieval/vector/dbs/milvus.py b/backend/open_webui/apps/retrieval/vector/dbs/milvus.py index b4a6a77b3..77300acf2 100644 --- a/backend/open_webui/apps/retrieval/vector/dbs/milvus.py +++ b/backend/open_webui/apps/retrieval/vector/dbs/milvus.py @@ -4,7 +4,7 @@ import json from typing import Optional -from open_webui.apps.rag.vector.main import VectorItem, SearchResult, GetResult +from open_webui.apps.retrieval.vector.main import VectorItem, SearchResult, GetResult from open_webui.config import ( MILVUS_URI, ) diff --git a/backend/open_webui/apps/webui/routers/memories.py b/backend/open_webui/apps/webui/routers/memories.py index d659833bc..ccf84a9d4 100644 --- a/backend/open_webui/apps/webui/routers/memories.py +++ b/backend/open_webui/apps/webui/routers/memories.py @@ -4,7 +4,7 @@ import logging from typing import Optional from open_webui.apps.webui.models.memories import Memories, MemoryModel -from open_webui.apps.rag.vector.connector import VECTOR_DB_CLIENT +from open_webui.apps.retrieval.vector.connector import VECTOR_DB_CLIENT from open_webui.utils.utils import get_verified_user from open_webui.env import SRC_LOG_LEVELS