adaptive-memory-multi-model-router 2.14.17 → 2.14.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/AGENT_COUNCIL_FINDINGS.md +142 -0
  2. package/LAUNCH_CHECKLIST.md +141 -0
  3. package/README.md.bak +836 -0
  4. package/articles/CHINESE_SUBMISSIONS_READY.md +322 -0
  5. package/articles/DEVTO_READY.md +255 -0
  6. package/articles/HN_POST_READY.md +137 -0
  7. package/articles/INDIEHACKERS_READY.md +120 -0
  8. package/articles/NEWSLETTER_SEND_NOW.md +259 -0
  9. package/articles/PRODUCTHUNT_READY.md +106 -0
  10. package/articles/REDDIT_SUBMISSION_READY.md +348 -0
  11. package/articles/TWEET_STORM_READY.md +165 -0
  12. package/council-votes/architecture-vote.md +121 -0
  13. package/council-votes/coverage-vote.md +93 -0
  14. package/dist/cost/costTracker.d.ts +109 -44
  15. package/dist/cost/costTracker.js +321 -98
  16. package/dist/cost/costTracker.js.map +1 -1
  17. package/dist/index.d.ts +6 -4
  18. package/dist/routing/advancedRouter.d.ts +38 -43
  19. package/dist/routing/advancedRouter.js +394 -408
  20. package/dist/routing/advancedRouter.js.map +1 -1
  21. package/dist/routing/providers/providerConfig.d.ts +49 -0
  22. package/dist/routing/providers/providerConfig.js +883 -0
  23. package/dist/routing/routing/advancedRouter.d.ts +62 -0
  24. package/dist/routing/routing/advancedRouter.js +447 -0
  25. package/dist/routing/utils/tokenUtils.d.ts +52 -0
  26. package/dist/routing/utils/tokenUtils.js +129 -0
  27. package/dist/server/proxyServer.d.ts +1 -1
  28. package/package.json +1 -1
  29. package/research-log.md +49 -0
  30. package/src/cost/costTracker.ts +576 -0
  31. package/src/routing/advancedRouter.ts +536 -0
  32. package/test-council/AGENT_COUNCIL_ARCHITECTURE.md +349 -0
  33. package/tests/security/guardrailEngine.test.ts +700 -0
  34. package/research/PUBLISH_LOG.md +0 -3
@@ -1,68 +1,63 @@
1
1
  /**
2
- * TMLPD Advanced Routing - RouteLLM Style
2
+ * A3M Router - Generic Adaptive Routing (RouteLLM Style)
3
3
  *
4
- * Learned routing based on arXiv:2404.06035 (RouteLLM)
5
- * Balances cost-quality tradeoff with confidence-based model selection
4
+ * Routes queries to the best available LLM based on:
5
+ * - Query features (code, math, creative, etc.)
6
+ * - Provider availability (checks API keys)
7
+ * - Cost optimization
8
+ * - Quality vs speed tradeoff
9
+ *
10
+ * All provider references are dynamically loaded from providerConfig.
11
+ * Users can add/remove providers via environment variables or config files.
6
12
  */
7
- export interface QueryFeatures {
8
- complexity: number;
9
- length: number;
10
- has_code: boolean;
11
- has_math: boolean;
12
- is_multilingual: boolean;
13
- is_creative: boolean;
14
- requires_reasoning: boolean;
15
- }
16
- export interface ModelProfile {
13
+ interface ModelProfile {
17
14
  name: string;
18
15
  provider: string;
16
+ providerName: string;
19
17
  cost_per_1k_input: number;
20
18
  cost_per_1k_output: number;
21
19
  latency_ms: number;
22
20
  quality_score: number;
23
21
  strengths: string[];
24
22
  context_window: number;
23
+ type: string;
24
+ priority: number;
25
+ }
26
+ export declare let MODEL_PROFILES: Record<string, ModelProfile>;
27
+ export interface QueryFeatures {
28
+ length: number;
29
+ wordCount: number;
30
+ complexity: number;
31
+ has_code: boolean;
32
+ requires_reasoning: boolean;
33
+ is_multilingual: boolean;
34
+ is_translation: boolean;
35
+ domain: string | null;
36
+ intent: string;
37
+ detected_language: string | null;
25
38
  }
39
+ export declare function extractQueryFeatures(prompt: string): QueryFeatures;
26
40
  export interface RouteDecision {
27
- primary_model: string;
41
+ primary_model: string | null;
28
42
  fallback_models: string[];
29
43
  confidence: number;
30
44
  reasoning: string;
31
45
  estimated_cost: number;
32
46
  estimated_latency_ms: number;
47
+ features?: QueryFeatures;
48
+ provider_type?: string;
33
49
  }
34
- export declare const MODEL_PROFILES: Record<string, ModelProfile>;
35
- /**
36
- * Extract features from prompt for routing decision
37
- */
38
- export declare function extractQueryFeatures(prompt: string): QueryFeatures;
39
- /**
40
- * RouteLLM-style learned routing decision
41
- */
42
50
  export declare function routeQuery(prompt: string, available_models?: string[], budget_multiplier?: number): RouteDecision;
43
- /**
44
- * Batch routing for multiple prompts
45
- */
46
51
  export declare function routeBatch(prompts: string[], options?: {
47
52
  same_model?: boolean;
48
53
  max_cost_per_prompt?: number;
49
- balance_cost?: boolean;
50
54
  }): RouteDecision[];
51
- /**
52
- * Get model recommendation for task type
53
- */
54
- export declare function recommendForTask(task: string): string[];
55
- /**
56
- * Update model profile from execution feedback (online learning)
57
- */
58
- export declare function updateModelProfile(model_name: string, actual_latency_ms: number, actual_cost: number, quality_rating: number): void;
59
- declare const _default: {
60
- extractQueryFeatures: typeof extractQueryFeatures;
61
- routeQuery: typeof routeQuery;
62
- routeBatch: typeof routeBatch;
63
- recommendForTask: typeof recommendForTask;
64
- updateModelProfile: typeof updateModelProfile;
65
- MODEL_PROFILES: Record<string, ModelProfile>;
55
+ export declare function recommendForTask(task: string): {
56
+ primary: string;
57
+ fallbacks: string[];
58
+ reason: string;
59
+ features: QueryFeatures;
66
60
  };
67
- export default _default;
68
- //# sourceMappingURL=advancedRouter.d.ts.map
61
+ export declare function updateModelProfile(model_name: string, actual_latency_ms: number, actual_cost: number, quality_rating: number): void;
62
+ export declare function getProviderHealth(): Promise<any>;
63
+ export {};