LLMConfig class

Unified configuration class for all LLM providers

This class provides a common configuration interface while allowing provider-specific extensions through the extensions map.

Constructors

LLMConfig.new({String? apiKey, required String baseUrl, required String model, int? maxTokens, double? temperature, String? systemPrompt, Duration? timeout, double? topP, int? topK, List<Tool>? tools, ToolChoice? toolChoice, List<String>? stopSequences, String? user, ServiceTier? serviceTier, Map<String, dynamic> extensions = const {}})
const
LLMConfig.fromJson(Map<String, dynamic> json)
Create from JSON representation
factory

Properties

apiKey String?
API key for authentication (if required)
final
baseUrl String
Base URL for API requests
final
extensions Map<String, dynamic>
Provider-specific configuration extensions
final
hashCode int
The hash code for this object.
no setteroverride
maxTokens int?
Maximum tokens to generate in responses
final
model String
Model identifier/name to use
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
serviceTier ServiceTier?
Service tier for API requests
final
stopSequences List<String>?
Stop sequences for generation
final
systemPrompt String?
System prompt/context to guide model behavior
final
temperature double?
Temperature parameter for controlling response randomness (0.0-1.0)
final
timeout Duration?
Request timeout duration
final
toolChoice ToolChoice?
Tool choice strategy
final
tools List<Tool>?
Function tools available to the model
final
topK int?
Top-k sampling parameter
final
topP double?
Top-p (nucleus) sampling parameter
final
user String?
User identifier for tracking and analytics
final

Methods

copyWith({String? apiKey, String? baseUrl, String? model, int? maxTokens, double? temperature, String? systemPrompt, Duration? timeout, double? topP, int? topK, List<Tool>? tools, ToolChoice? toolChoice, List<String>? stopSequences, String? user, ServiceTier? serviceTier, Map<String, dynamic>? extensions}) LLMConfig
Create a copy with modified common parameters
getExtension<T>(String key) → T?
Get a provider-specific extension value
hasExtension(String key) bool
Check if an extension exists
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Convert to JSON representation
toString() String
A string representation of this object.
override
withExtension(String key, dynamic value) LLMConfig
Create a new config with a single extension
withExtensions(Map<String, dynamic> newExtensions) LLMConfig
Create a new config with additional extensions

Operators

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