feat: agent routing engine — cost/capability matrix (P2-003)
Add RoutingService that selects optimal LLM model based on task type, cost tier, capability requirements (reasoning, image, context window), and provider preference. Scoring algorithm ranks all available models. - RoutingService: route() for best match, rank() for scored list - POST /api/providers/route and /api/providers/rank endpoints - Routing types in @mosaic/types (CostTier, TaskType, RoutingCriteria) - Cost tier classification: cheap (<$1/M), standard (<$10/M), premium Closes #21 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3,3 +3,4 @@ export const VERSION = '0.0.0';
|
||||
export * from './chat/index.js';
|
||||
export * from './agent/index.js';
|
||||
export * from './provider/index.js';
|
||||
export * from './routing/index.js';
|
||||
|
||||
25
packages/types/src/routing/index.ts
Normal file
25
packages/types/src/routing/index.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
/** Cost tier for model selection */
|
||||
export type CostTier = 'cheap' | 'standard' | 'premium';
|
||||
|
||||
/** Task type hint for routing */
|
||||
export type TaskType = 'chat' | 'coding' | 'analysis' | 'summarization' | 'general';
|
||||
|
||||
/** Routing criteria for model selection */
|
||||
export interface RoutingCriteria {
|
||||
taskType?: TaskType;
|
||||
costTier?: CostTier;
|
||||
requireReasoning?: boolean;
|
||||
requireImageInput?: boolean;
|
||||
minContextWindow?: number;
|
||||
preferredProvider?: string;
|
||||
preferredModel?: string;
|
||||
}
|
||||
|
||||
/** Result of a routing decision */
|
||||
export interface RoutingResult {
|
||||
provider: string;
|
||||
modelId: string;
|
||||
modelName: string;
|
||||
score: number;
|
||||
reasoning: string;
|
||||
}
|
||||
Reference in New Issue
Block a user