Skip to main content

ProviderFactory

Trait ProviderFactory 

Source
pub trait ProviderFactory: Send + Sync {
    type Provider: ModelProvider + Debug;

    // Required method
    fn build(
        &self,
        base_url: &str,
        api_key: ApiKey,
    ) -> Result<Self::Provider, ProviderError>;
}
Expand description

Builds the adapter under test.

Provider must be Debug because the secret-redaction check renders the adapter and looks for the configured key in the output.

Required Associated Types§

Source

type Provider: ModelProvider + Debug

The adapter this factory builds.

Required Methods§

Source

fn build( &self, base_url: &str, api_key: ApiKey, ) -> Result<Self::Provider, ProviderError>

Builds an adapter pointed at base_url and configured with api_key.

base_url is the mock server’s root, with no trailing slash. The key is payloads::DUMMY_API_KEY and is never valid anywhere.

§Errors

Returns a ProviderError when the configuration is rejected; the run then reports every check as failed with that reason.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§