Give the live index smoke the embed bound

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-29 17:53:24 +02:00
commit e899c65774

View file

@ -10,6 +10,7 @@
//! cargo test -p huginn-daemon --test live_index_smoke -- --ignored --nocapture
use std::collections::BTreeSet;
use std::time::Duration;
use huginn_daemon::index::ollama::{OllamaEmbedder, QUERY_INSTRUCTION};
use huginn_daemon::index::qdrant::QdrantIndex;
@ -46,7 +47,7 @@ fn the_adapters_embed_write_query_and_clean_up_a_scratch_collection() {
let identity = embedder.model_identity().expect("the model is listed");
println!("identity: {identity:?}");
let texts = ["The organ owns the mind.".to_string(), "A recipe for lentil soup.".to_string()];
let vectors = embedder.embed(&texts).expect("two texts embed");
let vectors = embedder.embed(&texts, Duration::from_secs(60)).expect("two texts embed");
assert_eq!(vectors.len(), 2);
assert!(vectors.iter().all(|vector| vector.len() == identity.dimensions as usize));
@ -95,7 +96,7 @@ fn the_adapters_embed_write_query_and_clean_up_a_scratch_collection() {
// instruction the worker uses.
let asked = format!("Instruct: {QUERY_INSTRUCTION}
Query: Who is responsible for keeping the memory?");
let query = embedder.embed(&[asked]).expect("the query embeds").remove(0);
let query = embedder.embed(&[asked], Duration::from_secs(60)).expect("the query embeds").remove(0);
let hits = store.search(name, &query, 2).unwrap();
assert_eq!(hits.len(), 2, "{hits:?}");
assert_eq!((hits[0].doc_id.as_str(), hits[0].kind.as_str()), ("smoke:doc:0", "question"), "{hits:?}");