BaseProviderFactory<T extends ChatCapability> class abstract

Base factory class that provides common functionality for all provider factories

This class reduces code duplication and provides consistent behavior across all provider factories. It includes common validation, error handling, and configuration transformation patterns.

Implemented types
Implementers

Constructors

BaseProviderFactory.new()

Properties

description String
Get description of this provider
no setteroverride
displayName String
Get human-readable name for this provider
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
providerId String
Unique identifier for this provider
no setteroverride
requiresApiKey bool
Whether this provider requires an API key Override this for providers like Ollama that don't need API keys
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
supportedCapabilities Set<LLMCapability>
Set of capabilities this provider supports
no setteroverride

Methods

create(LLMConfig config) → T
Create a provider instance from the given configuration
override
createProviderSafely<P>(LLMConfig config, P configFactory(), T providerFactory(P)) → T
Helper method for creating provider instances with error handling
getBaseConfigMap(LLMConfig config) Map<String, dynamic>
Common configuration transformation for basic parameters This handles the most common config fields that most providers use
getDefaultConfig() LLMConfig
Create default config with provider-specific defaults Subclasses should override getProviderDefaults() to customize
override
getExtension<E>(LLMConfig config, String key, [E? defaultValue]) → E?
Helper method to safely get extensions with type checking
getProviderDefaults() Map<String, dynamic>
Provider-specific default values Subclasses must implement this to provide their defaults
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
validateApiKey(LLMConfig config) bool
Common API key validation Most providers require an API key
validateConfig(LLMConfig config) bool
Default validation that checks for API key presence Override this method for providers with different requirements
override
validateConfigWithDetails(LLMConfig config) → void
Enhanced validation with detailed error messages
validateModelOnly(LLMConfig config) bool
Validation for providers that don't require API key (like Ollama)

Operators

operator ==(Object other) bool
The equality operator.
inherited