mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-10 22:43:29 +00:00
refac
This commit is contained in:
parent
9e3e24e304
commit
55ca719bbf
1 changed files with 6 additions and 0 deletions
|
|
@ -926,6 +926,12 @@ def get_embedding_function(
|
||||||
concurrent_requests=0,
|
concurrent_requests=0,
|
||||||
) -> Awaitable:
|
) -> Awaitable:
|
||||||
if embedding_engine == '':
|
if embedding_engine == '':
|
||||||
|
if embedding_function is None:
|
||||||
|
raise ValueError(
|
||||||
|
'No embedding model is loaded. Set RAG_EMBEDDING_MODEL to a valid '
|
||||||
|
'SentenceTransformer model name, or configure an external '
|
||||||
|
'RAG_EMBEDDING_ENGINE (ollama, openai, azure_openai).'
|
||||||
|
)
|
||||||
# Sentence transformers: CPU-bound sync operation
|
# Sentence transformers: CPU-bound sync operation
|
||||||
async def async_embedding_function(query, prefix=None, user=None):
|
async def async_embedding_function(query, prefix=None, user=None):
|
||||||
return await asyncio.to_thread(
|
return await asyncio.to_thread(
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue