perf: use asyncio.to_thread for embed_text in FastAPI paths

This commit is contained in:
CREDO23 2026-03-09 16:33:24 +02:00
parent c4f2e9a3a5
commit a49a4db6d6
4 changed files with 11 additions and 8 deletions

View file

@ -264,7 +264,9 @@ class ConnectorService:
# Reuse caller-provided embedding or compute once for both retrievers.
if query_embedding is None:
t_embed = time.perf_counter()
query_embedding = config.embedding_model_instance.embed(query_text)
query_embedding = await asyncio.to_thread(
config.embedding_model_instance.embed, query_text
)
perf.info(
"[connector_svc] _combined_rrf embedding in %.3fs type=%s",
time.perf_counter() - t_embed,