AxBalancerAdaptiveStrategy Generated TypeScript API reference. typescript api api/reference build/apidocs/TypeAlias.AxBalancerAdaptiveStrategy.md type AxBalancerAdaptiveStrategy

AxBalancerAdaptiveStrategy

TypeScript
type AxBalancerAdaptiveStrategy<TModelKey> = Readonly<{
  badOutcomeCost: number;
  deadlineMs: number;
  estimateCost?: (context: AxBalancerCostContext<TModelKey>) => number;
  expectedTokens?: AxBalancerExpectedTokens;
  namespace?: string;
  onRoutingEvent?: (event: AxBalancerRoutingEvent) => void | Promise<void>;
  routeKey?: (service: AxAIService<unknown, unknown, TModelKey>, serviceIndex: number) => string;
  slice?: (context: AxBalancerRoutingContext<TModelKey>) => string;
  statsStore?: AxBalancerStatsStore;
  type: "adaptive";
}>;

Defined in: https://github.com/ax-llm/ax/blob/e4219a44b7581a55a40d9dd62d2c281062ff078d/src/ax/ai/balance_adaptive.ts#L179

Opt-in adaptive provider-routing strategy for AxBalancer.

Type Parameters

Type ParameterDefault type
TModelKeystring
Docs