AIConfig class

Configuration for an AI provider.

Constructors

AIConfig({required String apiKey, required String model, int? maxTokens, double? temperature, double? topP, String? baseUrl, Duration timeout = const Duration(seconds: 30), String? systemPrompt, Map<String, dynamic>? extraParams, int? maxAttachmentBytes = kDefaultMaxAttachmentBytes})
const

Properties

apiKey String
API key for the provider.
final
baseUrl String?
Optional base URL override for the API.
final
extraParams Map<String, dynamic>?
Additional provider-specific parameters.
final
hashCode int
The hash code for this object.
no setterinherited
maxAttachmentBytes int?
Maximum total bytes for attachments in a single request to prevent OOM or 413 Payload Too Large.
final
maxTokens int?
Maximum tokens to generate in the response.
final
model String
The model to use (e.g., 'gpt-4o', 'gemini-2.0-flash').
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
systemPrompt String?
System prompt to use by default.
final
temperature double?
Temperature for response randomness (0.0 = deterministic, 2.0 = creative).
final
timeout Duration
Request timeout duration.
final
topP double?
Top-p (nucleus sampling) parameter.
final

Methods

copyWith({String? apiKey, String? model, int? maxTokens, double? temperature, double? topP, String? baseUrl, Duration? timeout, String? systemPrompt, Map<String, dynamic>? extraParams, int? maxAttachmentBytes}) AIConfig
Creates a copy with modified fields.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Constants

kDefaultMaxAttachmentBytes → const int
Default maximum attachment size: 20 MB.