Skip to main content

assert_embedder_contract

Function assert_embedder_contract 

Source
pub async fn assert_embedder_contract(
    embedder: &impl Embedder,
    known_model: &str,
)
Available on crate features embeddings and testkit only.
Expand description

Checks the promises an embedder makes.

known_model must be a model this embedder serves. The suite sends one small batch to it, so it costs a call.

The first check is the one worth having. A reply that comes back in the wrong order is not an error anywhere: the vectors are real, the index builds, the queries run, and every document is filed under another document’s meaning. This suite sends three inputs that cannot be confused for each other and asks whether they came back where they were put.

§Panics

Panics with a message naming the promise that was broken. It is a test helper, so failing loudly is the job.