Skip to main content

Module contract

Module contract 

Source
Expand description

Executable plugin contracts for implementors; see contract. Executable form of the plugin contracts, behind the test-support feature.

DESIGN says the gear publishes the provider contract (cpt-cf-graph-storage-contract-embedding-provider) and ADR-0005 requires that “contract tests run all three plugins against the provider contract”. A prose contract cannot be run against anything, and a suite living in one implementation’s tests/ directory cannot be reached by another crate — so the assertions live here, beside the trait they constrain, and every provider (the in-process ONNX default, a remote plugin, the deterministic fake) proves itself against the same code.

ⓘ
#[tokio::test]
async fn it_honours_the_provider_contract() {
    graph_storage_sdk::contract::assert_embedding_provider(&MyProvider::new()).await;
}

Functions§

assert_embedding_provider
Assert that provider honours EmbeddingProviderV1.