Add deadline of 3 seconds to embedding requests made in the context of hybrid search

This commit is contained in:
Louis Dureuil 2024-11-06 09:24:51 +01:00
parent a05e448cf8
commit e9d17136b2
No known key found for this signature in database
7 changed files with 80 additions and 31 deletions

View file

@ -201,7 +201,9 @@ impl<'a> Search<'a> {
let span = tracing::trace_span!(target: "search::hybrid", "embed_one");
let _entered = span.enter();
match embedder.embed_one(query) {
let deadline = std::time::Instant::now() + std::time::Duration::from_secs(3);
match embedder.embed_one(query, Some(deadline)) {
Ok(embedding) => embedding,
Err(error) => {
tracing::error!(error=%error, "Embedding failed");