Skip to content

Commit a7aadbb

Browse files
committed
fix(ci): track dist/routing/jev (was ignored → MODULE_NOT_FOUND in CI); lazy jev import in modelMapper
- dist/ is gitignored but legacy files stay tracked; new jev dist files were silently excluded — force-add them so CI's node test.js works - modelMapper: lazy require + guard, heuristic fallback if jev missing
1 parent f8566f5 commit a7aadbb

16 files changed

Lines changed: 687 additions & 9 deletions

‎dist/routing/jev/jevRouter.d.ts‎

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/**
2+
* JevRouter — System One routing for A3M.
3+
*
4+
* Replaces the autoregressive/heuristic routing loop with a single-pass
5+
* calibrated decision (Jev interface pattern):
6+
*
7+
* prompt ──► OptionAttention engine ──► { provider choice, complexity score,
8+
* capability noul flags }
9+
*
10+
* The engine is distilled from A3M's own System 2 router (advancedRouter.ts):
11+
* tools/distill.mjs runs routeQuery over a synthetic prompt corpus and
12+
* tools/train_jev.py trains the ~25k-parameter option-attention weights.
13+
*
14+
* Confidence guard: if the top provider probability is below MIN_CONFIDENCE,
15+
* we fall back to the full heuristic router (System 2) — Jev decides the easy
16+
* 90%, the heavy router handles the hard 10%.
17+
*/
18+
import { type RouteDecision } from "../advancedRouter";
19+
import { type OptionAttentionWeights } from "./optionAttention";
20+
import type { JevResponse } from "./types";
21+
/** Below this top-probability, defer to the System 2 heuristic router. */
22+
export declare const MIN_CONFIDENCE = 0.22;
23+
export declare function loadWeights(): OptionAttentionWeights | null;
24+
/** For tests / hot-reload of retrained weights. */
25+
export declare function resetWeightsCache(): void;
26+
/**
27+
* Build the option text for a model profile. Option text is what the engine
28+
* embeds — providers unseen at training time are still scored through their
29+
* strengths/tier description.
30+
*/
31+
export declare function optionTextForModel(model: string, profile: {
32+
providerName?: string;
33+
strengths?: string[];
34+
quality_score?: number;
35+
cost_per_1k_input?: number;
36+
cost_per_1k_output?: number;
37+
type?: string;
38+
}): string;
39+
/**
40+
* Single-pass Jev routing decision. Returns a RouteDecision shaped exactly
41+
* like advancedRouter.routeQuery so it is a drop-in replacement.
42+
*/
43+
export declare function jevRoute(prompt: string, available_models?: string[], budget_multiplier?: number): RouteDecision & {
44+
jev?: JevResponse;
45+
};
46+
/** Async variant with remote backend support. */
47+
export declare function jevRouteAsync(prompt: string, available_models?: string[], budget_multiplier?: number): Promise<RouteDecision & {
48+
jev?: JevResponse;
49+
}>;

‎dist/routing/jev/jevRouter.js‎

Lines changed: 231 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/routing/jev/jevRouter.js.map‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)