adaptive-memory-multi-model-router 2.14.17 → 2.14.19
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.
- package/AGENT_COUNCIL_FINDINGS.md +142 -0
- package/LAUNCH_CHECKLIST.md +141 -0
- package/README.md.bak +836 -0
- package/articles/CHINESE_SUBMISSIONS_READY.md +322 -0
- package/articles/DEVTO_READY.md +255 -0
- package/articles/HN_POST_READY.md +137 -0
- package/articles/INDIEHACKERS_READY.md +120 -0
- package/articles/NEWSLETTER_SEND_NOW.md +259 -0
- package/articles/PRODUCTHUNT_READY.md +106 -0
- package/articles/REDDIT_SUBMISSION_READY.md +348 -0
- package/articles/TWEET_STORM_READY.md +165 -0
- package/benchmark-results.json +24 -24
- package/council-votes/architecture-vote.md +121 -0
- package/council-votes/coverage-vote.md +93 -0
- package/dist/cost/costTracker.d.ts +109 -44
- package/dist/cost/costTracker.js +321 -98
- package/dist/cost/costTracker.js.map +1 -1
- package/dist/index.d.ts +6 -4
- package/dist/routing/advancedRouter.d.ts +38 -43
- package/dist/routing/advancedRouter.js +396 -408
- package/dist/routing/advancedRouter.js.map +1 -1
- package/dist/routing/providers/providerConfig.d.ts +49 -0
- package/dist/routing/providers/providerConfig.js +883 -0
- package/dist/routing/routing/advancedRouter.d.ts +62 -0
- package/dist/routing/routing/advancedRouter.js +447 -0
- package/dist/routing/utils/tokenUtils.d.ts +52 -0
- package/dist/routing/utils/tokenUtils.js +129 -0
- package/dist/server/proxyServer.d.ts +1 -1
- package/dist/utils/costUtils.d.ts +57 -0
- package/dist/utils/costUtils.js +150 -0
- package/dist/utils/costUtils.js.map +1 -0
- package/dist/utils/sorting.d.ts +12 -0
- package/dist/utils/sorting.js +37 -0
- package/dist/utils/sorting.js.map +1 -0
- package/package.json +1 -1
- package/research/ensemble-voting.md +324 -0
- package/research/loss-functions.md +545 -0
- package/research-log.md +49 -0
- package/src/cost/costTracker.ts +576 -0
- package/src/routing/advancedRouter.ts +540 -0
- package/src/utils/costUtils.ts +157 -0
- package/src/utils/sorting.ts +42 -0
- package/test-council/AGENT_COUNCIL_ARCHITECTURE.md +349 -0
- package/tests/security/guardrailEngine.test.ts +700 -0
- package/research/PUBLISH_LOG.md +0 -3
|
@@ -1,68 +1,63 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* A3M Router - Generic Adaptive Routing (RouteLLM Style)
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
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
|
-
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
|
68
|
-
|
|
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 {};
|