Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
9be56d68
Commit
9be56d68
authored
Apr 27, 2024
by
Timothy J. Baek
Browse files
refac: naming convention
parent
99a43cc9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
backend/apps/rag/main.py
backend/apps/rag/main.py
+4
-4
backend/apps/rag/utils.py
backend/apps/rag/utils.py
+2
-2
No files found.
backend/apps/rag/main.py
View file @
9be56d68
...
@@ -48,7 +48,7 @@ from apps.web.models.documents import (
...
@@ -48,7 +48,7 @@ from apps.web.models.documents import (
from
apps.rag.utils
import
(
from
apps.rag.utils
import
(
get_model_path
,
get_model_path
,
query_embeddings_doc
,
query_embeddings_doc
,
query
_embeddings_function
,
get
_embeddings_function
,
query_embeddings_collection
,
query_embeddings_collection
,
)
)
...
@@ -367,7 +367,7 @@ def query_doc_handler(
...
@@ -367,7 +367,7 @@ def query_doc_handler(
user
=
Depends
(
get_current_user
),
user
=
Depends
(
get_current_user
),
):
):
try
:
try
:
embeddings_function
=
query
_embeddings_function
(
embeddings_function
=
get
_embeddings_function
(
app
.
state
.
RAG_EMBEDDING_ENGINE
,
app
.
state
.
RAG_EMBEDDING_ENGINE
,
app
.
state
.
RAG_EMBEDDING_MODEL
,
app
.
state
.
RAG_EMBEDDING_MODEL
,
app
.
state
.
sentence_transformer_ef
,
app
.
state
.
sentence_transformer_ef
,
...
@@ -410,7 +410,7 @@ def query_collection_handler(
...
@@ -410,7 +410,7 @@ def query_collection_handler(
user
=
Depends
(
get_current_user
),
user
=
Depends
(
get_current_user
),
):
):
try
:
try
:
embeddings_function
=
query
_embeddings_function
(
embeddings_function
=
get
_embeddings_function
(
app
.
state
.
RAG_EMBEDDING_ENGINE
,
app
.
state
.
RAG_EMBEDDING_ENGINE
,
app
.
state
.
RAG_EMBEDDING_MODEL
,
app
.
state
.
RAG_EMBEDDING_MODEL
,
app
.
state
.
sentence_transformer_ef
,
app
.
state
.
sentence_transformer_ef
,
...
@@ -508,7 +508,7 @@ def store_docs_in_vector_db(docs, collection_name, overwrite: bool = False) -> b
...
@@ -508,7 +508,7 @@ def store_docs_in_vector_db(docs, collection_name, overwrite: bool = False) -> b
collection
=
CHROMA_CLIENT
.
create_collection
(
name
=
collection_name
)
collection
=
CHROMA_CLIENT
.
create_collection
(
name
=
collection_name
)
embedding_func
=
query
_embeddings_function
(
embedding_func
=
get
_embeddings_function
(
app
.
state
.
RAG_EMBEDDING_ENGINE
,
app
.
state
.
RAG_EMBEDDING_ENGINE
,
app
.
state
.
RAG_EMBEDDING_MODEL
,
app
.
state
.
RAG_EMBEDDING_MODEL
,
app
.
state
.
sentence_transformer_ef
,
app
.
state
.
sentence_transformer_ef
,
...
...
backend/apps/rag/utils.py
View file @
9be56d68
...
@@ -164,7 +164,7 @@ def rag_template(template: str, context: str, query: str):
...
@@ -164,7 +164,7 @@ def rag_template(template: str, context: str, query: str):
return
template
return
template
def
query
_embeddings_function
(
def
get
_embeddings_function
(
embedding_engine
,
embedding_engine
,
embedding_model
,
embedding_model
,
embedding_function
,
embedding_function
,
...
@@ -243,7 +243,7 @@ def rag_messages(
...
@@ -243,7 +243,7 @@ def rag_messages(
content_type
=
None
content_type
=
None
query
=
""
query
=
""
embeddings_function
=
query
_embeddings_function
(
embeddings_function
=
get
_embeddings_function
(
embedding_engine
,
embedding_engine
,
embedding_model
,
embedding_model
,
embedding_function
,
embedding_function
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment