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§
Sourcefn name(&self) -> &str
fn name(&self) -> &str
Returns the provider name used for registration and lookup.
This should be a lowercase identifier (e.g., “anthropic”, “openai”).
Sourcefn build(
&self,
config: &ProviderConfig,
) -> Result<Box<dyn DynProvider>, LlmError>
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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".