pub trait LlmClientFactory: Send + Sync {
// Required methods
fn name(&self) -> &str;
fn display_name(&self) -> &str;
fn create(
&self,
config: &HashMap<String, String>,
) -> Result<Arc<dyn LlmClient>, LlmError>;
fn validate_config(&self, config: &HashMap<String, String>) -> Vec<String>;
fn required_config_keys(&self) -> Vec<&str>;
}Expand description
Factory that creates LLM client instances from configuration.
Third-party LLM providers (Anthropic, Bedrock, vLLM, etc.) implement this trait to integrate with Razeri’s AI profiler.
Required Methods§
Sourcefn display_name(&self) -> &str
fn display_name(&self) -> &str
Human-readable display name.
Sourcefn create(
&self,
config: &HashMap<String, String>,
) -> Result<Arc<dyn LlmClient>, LlmError>
fn create( &self, config: &HashMap<String, String>, ) -> Result<Arc<dyn LlmClient>, LlmError>
Create an LLM client from configuration (base_url, api_key, etc.).
§Errors
Returns an error if the operation fails.
Sourcefn validate_config(&self, config: &HashMap<String, String>) -> Vec<String>
fn validate_config(&self, config: &HashMap<String, String>) -> Vec<String>
Validate configuration before creating a client.
Sourcefn required_config_keys(&self) -> Vec<&str>
fn required_config_keys(&self) -> Vec<&str>
List required configuration keys (e.g., “base_url”, “api_key”).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".