mirror of
https://github.com/open-webui/open-webui
synced 2024-11-07 00:59:52 +00:00
refac
This commit is contained in:
parent
451f1bae15
commit
c157004e07
@ -271,17 +271,12 @@ def get_embedding_function(
|
|||||||
if embedding_engine == "":
|
if embedding_engine == "":
|
||||||
return lambda query: embedding_function.encode(query).tolist()
|
return lambda query: embedding_function.encode(query).tolist()
|
||||||
elif embedding_engine in ["ollama", "openai"]:
|
elif embedding_engine in ["ollama", "openai"]:
|
||||||
if embedding_engine == "ollama":
|
|
||||||
func = lambda query: generate_embeddings(
|
func = lambda query: generate_embeddings(
|
||||||
|
engine=embedding_engine,
|
||||||
model=embedding_model,
|
model=embedding_model,
|
||||||
text=query,
|
text=query,
|
||||||
)
|
key=openai_key if embedding_engine == "openai" else "",
|
||||||
elif embedding_engine == "openai":
|
url=openai_url if embedding_engine == "openai" else "",
|
||||||
func = lambda query: generate_embeddings(
|
|
||||||
model=embedding_model,
|
|
||||||
text=query,
|
|
||||||
key=openai_key,
|
|
||||||
url=openai_url,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def generate_multiple(query, func):
|
def generate_multiple(query, func):
|
||||||
|
Loading…
Reference in New Issue
Block a user