AIProvider class abstract

Full-featured AI provider interface.

Combines completion, streaming, capability discovery, and token estimation. By programming against this interface, your app can switch between OpenAI, Gemini, Claude, or any custom provider.

Implemented types

Constructors

AIProvider()

Properties

capabilities List<AICapability>
List of capabilities this provider supports.
no setter
config AIConfig
The configuration for this provider.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
model String
The current model being used.
no setterinherited
name String
Human-readable name of this provider.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

complete(List<AIMessage> messages, {int? maxTokens, double? temperature, List<AITool>? tools}) Future<AIResponse>
Sends a completion request and returns the full response.
inherited
completeStream(List<AIMessage> messages, {int? maxTokens, double? temperature, List<AITool>? tools}) Stream<AIStreamChunk>
Sends a completion request and returns a stream of chunks.
inherited
dispose() Future<void>
Releases any resources held by this provider.
override
embed(String text) Future<List<double>>
Generates embeddings for the given text.
estimateTokens(String text) int
Estimates the number of tokens in the given text.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
supports(AICapability capability) bool
Whether this provider supports a specific capability.
toString() String
A string representation of this object.
inherited

Operators

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

Constants

kApproxCharsPerToken → const int
Approximate characters per token for rough estimation.