This commit is contained in:
Timothy Jaeryang Baek
2026-06-01 09:48:29 -07:00
parent 9e3e24e304
commit 55ca719bbf

View File

@@ -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(