Skip to main content

ProviderFactory

Trait ProviderFactory 

Source
pub trait ProviderFactory: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn build(
        &self,
        config: &ProviderConfig,
    ) -> Result<Box<dyn DynProvider>, LlmError>;
}
Expand description

Factory trait for creating providers from configuration.

Implement this trait to register a provider with the registry.

Required Methods§

Source

fn name(&self) -> &str

Returns the provider name used for registration and lookup.

This should be a lowercase identifier (e.g., “anthropic”, “openai”).

Source

fn build( &self, config: &ProviderConfig, ) -> Result<Box<dyn DynProvider>, LlmError>

Creates a provider instance from the given configuration.

§Errors

Returns an error if the configuration is invalid or missing required fields for this provider.

Implementors§