Skip to main content

Module testkit

Module testkit 

Source
Available on crate feature testkit only.
Expand description

A contract suite for anyone writing a provider.

Enable the testkit feature and point assert_provider_contract at your provider. It checks the promises crate::Provider makes, which are the ones a caller relies on without being able to see your code.

Every provider in this crate passes it, including the local command line one. That is the point: a suite only one implementation can pass has stopped being a specification and become a description of that implementation.

What it does not check is concurrency. Running calls at the same time needs a runtime to run them on, and this module does not assume one. That check lives in this crate’s own tests/concurrency.rs, and the shape it uses is worth copying: spawn the calls, join them, and put a timeout around the whole thing so a deadlock fails instead of hanging.

use llmr::testkit::assert_provider_contract;

assert_provider_contract(mine, "the-model-you-serve").await;

Functions§

assert_a_bad_credential_is_denied
Checks that a provider built with a credential it will reject says so.
assert_embedder_contractembeddings
Checks the promises an embedder makes.
assert_provider_contract
Checks the promises a provider makes.