AIRouter class
Smart router that decides which AI provider handles each request.
Supports multiple routing strategies, capability-based filtering, and automatic fallback when a provider fails.
Constructors
-
AIRouter({required List<
AIProvider> providers, RoutingStrategyHandler? strategyHandler, RoutingStrategy strategy = RoutingStrategy.primary}) - Creates a router with a RoutingStrategyHandler.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
providers
→ List<
AIProvider> -
Available providers to route to.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- strategyHandler → RoutingStrategyHandler
-
The strategy handler for provider selection.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
route(
List< AIMessage> messages, {int? maxTokens, double? temperature, AICapability? requiredCapability, List<AITool> ? tools}) → Future<AIResponse> - Routes a completion request to the best available provider.
-
routeStream(
List< AIMessage> messages, {int? maxTokens, double? temperature, AICapability? requiredCapability, List<AITool> ? tools}) → Stream<AIStreamChunk> - Routes a streaming request to the best available provider.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited