@sema-agent/core
Version:
Stateless, task-oriented AI agent core
19 lines (18 loc) • 826 B
TypeScript
import type { Brain } from "../core/types.js";
export interface RoutingBrainOptions {
/** Which field of the Model selects the route. Default "provider". */
by?: "provider" | "api";
/** Brain used when no route matches. If omitted, an unmatched model yields an error. */
fallback?: Brain;
}
/**
* Route to different brains by a Model field (default `model.provider`). Lets one Runner serve
* multiple providers/gateways; compose with `createFailoverBrain` for per-route failover.
*
* @example
* createRoutingBrain({
* "vllm": createOpenAIBrain({ baseUrl: VLLM }),
* "openai": createOpenAIBrain({ baseUrl: OPENAI, apiKey }),
* }, { fallback: createOpenAIBrain({ baseUrl: VLLM }) });
*/
export declare function createRoutingBrain(routes: Record<string, Brain>, opts?: RoutingBrainOptions): Brain;