rax-flow-providers 0.1.0

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 (67) hide show
  1. package/dist/claude-adapter.d.ts +41 -0
  2. package/dist/claude-adapter.d.ts.map +1 -0
  3. package/dist/claude-adapter.js +236 -0
  4. package/dist/claude-adapter.js.map +1 -0
  5. package/dist/cohere-adapter.d.ts +37 -0
  6. package/dist/cohere-adapter.d.ts.map +1 -0
  7. package/dist/cohere-adapter.js +160 -0
  8. package/dist/cohere-adapter.js.map +1 -0
  9. package/dist/error-mapper.d.ts +51 -0
  10. package/dist/error-mapper.d.ts.map +1 -0
  11. package/dist/error-mapper.js +132 -0
  12. package/dist/error-mapper.js.map +1 -0
  13. package/dist/gemini-adapter.d.ts +37 -0
  14. package/dist/gemini-adapter.d.ts.map +1 -0
  15. package/dist/gemini-adapter.js +150 -0
  16. package/dist/gemini-adapter.js.map +1 -0
  17. package/dist/groq-adapter.d.ts +35 -0
  18. package/dist/groq-adapter.d.ts.map +1 -0
  19. package/dist/groq-adapter.js +152 -0
  20. package/dist/groq-adapter.js.map +1 -0
  21. package/dist/host-bridge-adapter.d.ts +20 -0
  22. package/dist/host-bridge-adapter.d.ts.map +1 -0
  23. package/dist/host-bridge-adapter.js +145 -0
  24. package/dist/host-bridge-adapter.js.map +1 -0
  25. package/dist/index.d.ts +12 -0
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +12 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/mistral-adapter.d.ts +39 -0
  30. package/dist/mistral-adapter.d.ts.map +1 -0
  31. package/dist/mistral-adapter.js +172 -0
  32. package/dist/mistral-adapter.js.map +1 -0
  33. package/dist/openai-adapter.d.ts +30 -0
  34. package/dist/openai-adapter.d.ts.map +1 -0
  35. package/dist/openai-adapter.js +171 -0
  36. package/dist/openai-adapter.js.map +1 -0
  37. package/dist/pricing.d.ts +15 -0
  38. package/dist/pricing.d.ts.map +1 -0
  39. package/dist/pricing.js +61 -0
  40. package/dist/pricing.js.map +1 -0
  41. package/dist/rest-adapter.d.ts +32 -0
  42. package/dist/rest-adapter.d.ts.map +1 -0
  43. package/dist/rest-adapter.js +124 -0
  44. package/dist/rest-adapter.js.map +1 -0
  45. package/dist/strategy.d.ts +38 -0
  46. package/dist/strategy.d.ts.map +1 -0
  47. package/dist/strategy.js +117 -0
  48. package/dist/strategy.js.map +1 -0
  49. package/dist/utils.d.ts +3 -0
  50. package/dist/utils.d.ts.map +1 -0
  51. package/dist/utils.js +22 -0
  52. package/dist/utils.js.map +1 -0
  53. package/package.json +18 -0
  54. package/src/claude-adapter.ts +350 -0
  55. package/src/cohere-adapter.ts +262 -0
  56. package/src/error-mapper.ts +187 -0
  57. package/src/gemini-adapter.ts +246 -0
  58. package/src/groq-adapter.ts +234 -0
  59. package/src/host-bridge-adapter.ts +189 -0
  60. package/src/index.ts +11 -0
  61. package/src/mistral-adapter.ts +262 -0
  62. package/src/openai-adapter.ts +240 -0
  63. package/src/pricing.ts +77 -0
  64. package/src/rest-adapter.ts +181 -0
  65. package/src/strategy.ts +166 -0
  66. package/src/utils.ts +18 -0
  67. package/tsconfig.json +18 -0
@@ -0,0 +1,61 @@
1
+ /**
2
+ * @file pricing.ts
3
+ * Token pricing catalog and cost calculation.
4
+ *
5
+ * Prices are in USD per 1M tokens unless specified.
6
+ * Updated: 2026-02 (simulated current date)
7
+ */
8
+ // ─────────────────────────────────────────────────────────────────────────────
9
+ // Official Pricing Catalog (approximate / standard rates)
10
+ // ─────────────────────────────────────────────────────────────────────────────
11
+ const PRICING_CATALOG = {
12
+ // OpenAI
13
+ "gpt-4o": { input: 2.50, output: 10.00 },
14
+ "gpt-4o-2024-05-13": { input: 2.50, output: 10.00 },
15
+ "gpt-4o-mini": { input: 0.15, output: 0.60 },
16
+ "gpt-4.5-preview": { input: 75.00, output: 150.00 }, // hypothetical high-end
17
+ "o1": { input: 15.00, output: 60.00 },
18
+ "o3-mini": { input: 1.10, output: 4.40 },
19
+ // Anthropic
20
+ "claude-3-5-sonnet-latest": { input: 3.00, output: 15.00 },
21
+ "claude-3-5-haiku-latest": { input: 0.25, output: 1.25 },
22
+ "claude-3-opus-20240229": { input: 15.00, output: 75.00 },
23
+ // Google (Gemini 1.5 / 2.0)
24
+ "gemini-2.0-flash": { input: 0.10, output: 0.40 },
25
+ "gemini-1.5-flash": { input: 0.075, output: 0.30 },
26
+ "gemini-1.5-pro": { input: 1.25, output: 5.00 },
27
+ // Mistral
28
+ "mistral-large-latest": { input: 2.00, output: 6.00 },
29
+ "mistral-small-latest": { input: 0.20, output: 0.60 },
30
+ "codestral-latest": { input: 1.00, output: 3.00 },
31
+ "open-mixtral-8x22b": { input: 2.00, output: 6.00 },
32
+ // Groq (Llama 3 hosted)
33
+ "llama-3.3-70b-versatile": { input: 0.59, output: 0.79 },
34
+ "llama3-8b-8192": { input: 0.05, output: 0.08 },
35
+ "mixtral-8x7b-32768": { input: 0.24, output: 0.24 },
36
+ // Cohere
37
+ "command-r-plus-08-2024": { input: 2.50, output: 10.00 },
38
+ "command-r-08-2024": { input: 0.15, output: 0.60 },
39
+ };
40
+ // Default fallback price (cheap generic model assumption)
41
+ const DEFAULT_PRICE = { input: 0.50, output: 1.50 };
42
+ /** Returns the price config for a given model ID (with fuzzy matching). */
43
+ function getPriceConfig(model) {
44
+ if (PRICING_CATALOG[model])
45
+ return PRICING_CATALOG[model];
46
+ // Fuzzy match for versioned models (e.g. gpt-4o-2024-08-06 -> gpt-4o)
47
+ const base = Object.keys(PRICING_CATALOG).find((k) => model.startsWith(k));
48
+ return base ? PRICING_CATALOG[base] : DEFAULT_PRICE;
49
+ }
50
+ /**
51
+ * Calculates the estimated cost in USD for a given usage.
52
+ */
53
+ export function calculateCost(model, usage) {
54
+ if (!usage)
55
+ return 0;
56
+ const price = getPriceConfig(model);
57
+ const inputCost = (usage.promptTokens / 1_000_000) * price.input;
58
+ const outputCost = (usage.completionTokens / 1_000_000) * price.output;
59
+ return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AC,KAAK;QAAE,OAAO,CAAC,CAAC;IACrB,MAAM,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IACpC,MAAM,SAAS,GAAG,CAAC,KAAK,CAAC,YAAY,GAAG,SAAS,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC;IACjE,MAAM,UAAU,GAAG,CAAC,KAAK,CAAC,gBAAgB,GAAG,SAAS,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;IACvE,OAAO,SAAS,GAAG,UAAU,CAAC;AAClC,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * @file rest-adapter.ts
3
+ * Generic REST bridge adapter.
4
+ *
5
+ * Targets any OpenAI-compatible or custom LLM endpoint that accepts a simple
6
+ * JSON body with { model, prompt, temperature, maxTokens } and returns
7
+ * { output | content | text }.
8
+ *
9
+ * Useful for: LM Studio, local Ollama proxy, custom inference servers, etc.
10
+ */
11
+ import { IModelProvider, ModelResponse, ProviderCallOptions } from "@rax-flow/core";
12
+ export interface GenericRestAdapterOptions {
13
+ endpoint: string;
14
+ token?: string;
15
+ defaultModel?: string;
16
+ timeoutMs?: number;
17
+ }
18
+ export declare class GenericRestAdapter implements IModelProvider {
19
+ private readonly endpoint;
20
+ private readonly token?;
21
+ private readonly defaultModel;
22
+ private readonly timeoutMs;
23
+ constructor(options: GenericRestAdapterOptions);
24
+ /** @deprecated Prefer the options-object constructor. */
25
+ constructor(endpoint: string, token?: string);
26
+ private post;
27
+ private extractText;
28
+ callModel(prompt: string, options?: ProviderCallOptions): Promise<ModelResponse<string>>;
29
+ callStructured<T>(prompt: string, schema: object, options?: ProviderCallOptions): Promise<ModelResponse<T>>;
30
+ healthCheck(): Promise<boolean>;
31
+ }
32
+ //# sourceMappingURL=rest-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rest-adapter.d.ts","sourceRoot":"","sources":["../src/rest-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAqBpF,MAAM,WAAW,yBAAyB;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,kBAAmB,YAAW,cAAc;IACvD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IACtC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEvB,OAAO,EAAE,yBAAyB;IAC9C,yDAAyD;gBAC7C,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM;YAoB9B,IAAI;IAkClB,OAAO,CAAC,WAAW;IASb,SAAS,CACb,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAuB3B,cAAc,CAAC,CAAC,EACpB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAqCtB,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;CAGtC"}
@@ -0,0 +1,124 @@
1
+ /**
2
+ * @file rest-adapter.ts
3
+ * Generic REST bridge adapter.
4
+ *
5
+ * Targets any OpenAI-compatible or custom LLM endpoint that accepts a simple
6
+ * JSON body with { model, prompt, temperature, maxTokens } and returns
7
+ * { output | content | text }.
8
+ *
9
+ * Useful for: LM Studio, local Ollama proxy, custom inference servers, etc.
10
+ */
11
+ import { parseJsonObjectFromText } from "./utils.js";
12
+ import { mapHttpError, mapNetworkError, mapParseError } from "./error-mapper.js";
13
+ // ─────────────────────────────────────────────────────────────────────────────
14
+ // Adapter
15
+ // ─────────────────────────────────────────────────────────────────────────────
16
+ const VENDOR = "rest";
17
+ export class GenericRestAdapter {
18
+ endpoint;
19
+ token;
20
+ defaultModel;
21
+ timeoutMs;
22
+ constructor(optionsOrEndpoint, legacyToken) {
23
+ if (typeof optionsOrEndpoint === "string") {
24
+ this.endpoint = optionsOrEndpoint;
25
+ this.token = legacyToken;
26
+ this.defaultModel = "generic-llm";
27
+ this.timeoutMs = 30_000;
28
+ }
29
+ else {
30
+ this.endpoint = optionsOrEndpoint.endpoint;
31
+ this.token = optionsOrEndpoint.token;
32
+ this.defaultModel = optionsOrEndpoint.defaultModel ?? "generic-llm";
33
+ this.timeoutMs = optionsOrEndpoint.timeoutMs ?? 30_000;
34
+ }
35
+ }
36
+ // ── private helpers ────────────────────────────────────────────────────────
37
+ async post(body, context) {
38
+ const controller = new AbortController();
39
+ const timer = setTimeout(() => controller.abort(), this.timeoutMs);
40
+ let res;
41
+ try {
42
+ res = await fetch(this.endpoint, {
43
+ method: "POST",
44
+ headers: {
45
+ "content-type": "application/json",
46
+ ...(this.token ? { authorization: `Bearer ${this.token}` } : {}),
47
+ },
48
+ body: JSON.stringify(body),
49
+ signal: controller.signal,
50
+ });
51
+ }
52
+ catch (err) {
53
+ clearTimeout(timer);
54
+ throw mapNetworkError(VENDOR, err);
55
+ }
56
+ finally {
57
+ clearTimeout(timer);
58
+ }
59
+ const raw = await res.json().catch(() => ({}));
60
+ if (!res.ok) {
61
+ throw mapHttpError(VENDOR, res.status, raw, context);
62
+ }
63
+ return raw;
64
+ }
65
+ extractText(payload) {
66
+ if (typeof payload.output === "string")
67
+ return payload.output;
68
+ if (payload.content)
69
+ return payload.content;
70
+ if (payload.text)
71
+ return payload.text;
72
+ return JSON.stringify(payload.output ?? payload);
73
+ }
74
+ // ── IModelProvider ─────────────────────────────────────────────────────────
75
+ async callModel(prompt, options) {
76
+ const started = Date.now();
77
+ const model = options?.model ?? this.defaultModel;
78
+ const payload = await this.post({
79
+ model,
80
+ prompt,
81
+ temperature: options?.temperature ?? 0.2,
82
+ maxTokens: options?.maxTokens ?? 1200,
83
+ }, "callModel");
84
+ return {
85
+ provider: VENDOR,
86
+ model,
87
+ latencyMs: Date.now() - started,
88
+ output: this.extractText(payload),
89
+ raw: payload,
90
+ };
91
+ }
92
+ async callStructured(prompt, schema, options) {
93
+ const started = Date.now();
94
+ const model = options?.model ?? this.defaultModel;
95
+ const augmentedPrompt = [
96
+ prompt,
97
+ "",
98
+ "Return ONLY valid JSON matching this schema:",
99
+ JSON.stringify(schema),
100
+ ].join("\n");
101
+ const payload = await this.post({
102
+ model,
103
+ prompt: augmentedPrompt,
104
+ temperature: 0,
105
+ maxTokens: options?.maxTokens ?? 1400,
106
+ }, "callStructured");
107
+ const text = this.extractText(payload);
108
+ const parsed = parseJsonObjectFromText(text);
109
+ if (!parsed) {
110
+ throw mapParseError(VENDOR, "callStructured", text);
111
+ }
112
+ return {
113
+ provider: VENDOR,
114
+ model,
115
+ latencyMs: Date.now() - started,
116
+ output: parsed,
117
+ raw: payload,
118
+ };
119
+ }
120
+ async healthCheck() {
121
+ return Boolean(this.endpoint);
122
+ }
123
+ }
124
+ //# sourceMappingURL=rest-adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rest-adapter.js","sourceRoot":"","sources":["../src/rest-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAajF,gFAAgF;AAChF,UAAU;AACV,gFAAgF;AAEhF,MAAM,MAAM,GAAG,MAAM,CAAC;AAStB,MAAM,OAAO,kBAAkB;IACZ,QAAQ,CAAS;IACjB,KAAK,CAAU;IACf,YAAY,CAAS;IACrB,SAAS,CAAS;IAKnC,YACE,iBAAqD,EACrD,WAAoB;QAEpB,IAAI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+ * Provider selection strategies: smart fallback, retries, aggregation.
4
+ *
5
+ * Uses `RaxProviderError` codes to decide whether to retry the same provider
6
+ * or immediately move to the next one in the fallback chain.
7
+ */
8
+ import { IModelProvider, ModelResponse, ProviderCallOptions } from "@rax-flow/core";
9
+ export interface FallbackCallOptions {
10
+ /** How many times to retry a retryable error on the SAME provider before moving on. */
11
+ maxRetriesPerProvider?: number;
12
+ /** Delay in ms between retries (simple linear backoff). */
13
+ retryDelayMs?: number;
14
+ /** Per-call options forwarded to each provider. */
15
+ callOptions?: ProviderCallOptions;
16
+ }
17
+ /**
18
+ * Tries each provider in order.
19
+ * - If a `RaxProviderError` with `isRetryable=true` is thrown, retries up to
20
+ * `maxRetriesPerProvider` times (with linear back-off) before moving on.
21
+ * - If a `RaxProviderError` with `shouldFallback=true` is thrown, skips to
22
+ * the next provider immediately.
23
+ * - Any other error is also treated as a skip trigger.
24
+ */
25
+ export declare function fallbackCall(providers: IModelProvider[], prompt: string, options?: FallbackCallOptions): Promise<ModelResponse<string>>;
26
+ /**
27
+ * Structured-output variant of the fallback chain.
28
+ */
29
+ export declare function fallbackCallStructured<T>(providers: IModelProvider[], prompt: string, schema: object, options?: FallbackCallOptions): Promise<ModelResponse<T>>;
30
+ /**
31
+ * Calls all providers in parallel and picks the longest non-empty output
32
+ * as a simple consensus heuristic. Useful for ensemble verification.
33
+ */
34
+ export declare function aggregateCalls(providers: IModelProvider[], prompt: string, callOptions?: ProviderCallOptions): Promise<{
35
+ outputs: ModelResponse<string>[];
36
+ consensus: string;
37
+ }>;
38
+ //# sourceMappingURL=strategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strategy.d.ts","sourceRoot":"","sources":["../src/strategy.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAOpF,MAAM,WAAW,mBAAmB;IAClC,uFAAuF;IACvF,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,2DAA2D;IAC3D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mDAAmD;IACnD,WAAW,CAAC,EAAE,mBAAmB,CAAC;CACnC;AAMD;;;;;;;GAOG;AACH,wBAAsB,YAAY,CAChC,SAAS,EAAE,cAAc,EAAE,EAC3B,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CA2ChC;AAED;;GAEG;AACH,wBAAsB,sBAAsB,CAAC,CAAC,EAC5C,SAAS,EAAE,cAAc,EAAE,EAC3B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CA6B3B;AAMD;;;GAGG;AACH,wBAAsB,cAAc,CAClC,SAAS,EAAE,cAAc,EAAE,EAC3B,MAAM,EAAE,MAAM,EACd,WAAW,CAAC,EAAE,mBAAmB,GAChC,OAAO,CAAC;IAAE,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAqBlE"}
@@ -0,0 +1,117 @@
1
+ /**
2
+ * @file strategy.ts
3
+ * Provider selection strategies: smart fallback, retries, aggregation.
4
+ *
5
+ * Uses `RaxProviderError` codes to decide whether to retry the same provider
6
+ * or immediately move to the next one in the fallback chain.
7
+ */
8
+ import { RaxProviderError } from "./error-mapper.js";
9
+ // ─────────────────────────────────────────────────────────────────────────────
10
+ // Smart fallback
11
+ // ─────────────────────────────────────────────────────────────────────────────
12
+ /**
13
+ * Tries each provider in order.
14
+ * - If a `RaxProviderError` with `isRetryable=true` is thrown, retries up to
15
+ * `maxRetriesPerProvider` times (with linear back-off) before moving on.
16
+ * - If a `RaxProviderError` with `shouldFallback=true` is thrown, skips to
17
+ * the next provider immediately.
18
+ * - Any other error is also treated as a skip trigger.
19
+ */
20
+ export async function fallbackCall(providers, prompt, options = {}) {
21
+ const { maxRetriesPerProvider = 1, retryDelayMs = 500, callOptions } = options;
22
+ const errors = [];
23
+ for (const provider of providers) {
24
+ const healthy = await provider.healthCheck().catch(() => false);
25
+ if (!healthy)
26
+ continue;
27
+ let attempt = 0;
28
+ let lastError;
29
+ while (attempt <= maxRetriesPerProvider) {
30
+ try {
31
+ return await provider.callModel(prompt, callOptions);
32
+ }
33
+ catch (err) {
34
+ lastError = err;
35
+ if (err instanceof RaxProviderError) {
36
+ if (err.isRetryable && attempt < maxRetriesPerProvider) {
37
+ // Retry this provider after a delay
38
+ await sleep(retryDelayMs * (attempt + 1));
39
+ attempt++;
40
+ continue;
41
+ }
42
+ // Non-retryable or retries exhausted → next provider
43
+ errors.push(err.message);
44
+ break;
45
+ }
46
+ // Unknown error → move on immediately
47
+ errors.push(err instanceof Error ? err.message : String(err));
48
+ break;
49
+ }
50
+ }
51
+ if (lastError) {
52
+ // Log for observability but continue to next provider
53
+ continue;
54
+ }
55
+ }
56
+ throw new Error(`fallback_chain_exhausted: all providers failed.\n${errors.join("\n")}`);
57
+ }
58
+ /**
59
+ * Structured-output variant of the fallback chain.
60
+ */
61
+ export async function fallbackCallStructured(providers, prompt, schema, options = {}) {
62
+ const { maxRetriesPerProvider = 1, retryDelayMs = 500, callOptions } = options;
63
+ const errors = [];
64
+ for (const provider of providers) {
65
+ const healthy = await provider.healthCheck().catch(() => false);
66
+ if (!healthy)
67
+ continue;
68
+ let attempt = 0;
69
+ while (attempt <= maxRetriesPerProvider) {
70
+ try {
71
+ return await provider.callStructured(prompt, schema, callOptions);
72
+ }
73
+ catch (err) {
74
+ if (err instanceof RaxProviderError && err.isRetryable && attempt < maxRetriesPerProvider) {
75
+ await sleep(retryDelayMs * (attempt + 1));
76
+ attempt++;
77
+ continue;
78
+ }
79
+ errors.push(err instanceof Error ? err.message : String(err));
80
+ break;
81
+ }
82
+ }
83
+ }
84
+ throw new Error(`fallback_structured_chain_exhausted: all providers failed.\n${errors.join("\n")}`);
85
+ }
86
+ // ─────────────────────────────────────────────────────────────────────────────
87
+ // Aggregate / consensus
88
+ // ─────────────────────────────────────────────────────────────────────────────
89
+ /**
90
+ * Calls all providers in parallel and picks the longest non-empty output
91
+ * as a simple consensus heuristic. Useful for ensemble verification.
92
+ */
93
+ export async function aggregateCalls(providers, prompt, callOptions) {
94
+ const outputs = await Promise.all(providers.map(async (p) => {
95
+ try {
96
+ return await p.callModel(prompt, callOptions);
97
+ }
98
+ catch {
99
+ return {
100
+ provider: "unknown",
101
+ model: "failed",
102
+ latencyMs: 0,
103
+ output: "",
104
+ };
105
+ }
106
+ }));
107
+ const nonEmpty = outputs.filter((o) => o.output.length > 0);
108
+ const consensus = nonEmpty.sort((a, b) => b.output.length - a.output.length)[0]?.output ?? "";
109
+ return { outputs, consensus };
110
+ }
111
+ // ─────────────────────────────────────────────────────────────────────────────
112
+ // Internal helpers
113
+ // ─────────────────────────────────────────────────────────────────────────────
114
+ function sleep(ms) {
115
+ return new Promise((resolve) => setTimeout(resolve, ms));
116
+ }
117
+ //# sourceMappingURL=strategy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strategy.js","sourceRoot":"","sources":["../src/strategy.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,gBAAgB,EAAmB,MAAM,mBAAmB,CAAC;AAetE,gFAAgF;AAChF,iBAAiB;AACjB,gFAAgF;AAEhF;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,SAA2B,EAC3B,MAAc,EACd,UAA+B,EAAE;IAEjC,MAAM,EAAE,qBAAqB,GAAG,CAAC,EAAE,YAAY,GAAG,GAAG,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC;IAE/E,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,W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AAG,CAC/B,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE;QACxB,IAAI,CAAC;YACH,OAAO,MAAM,CAAC,CAAC,SAAS,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;QAChD,CAAC;QAAC,MAAM,CAAC;YACP,OAAO;gBACL,QAAQ,EAAE,SAAS;gBACnB,KAAK,EAAE,QAAQ;gBACf,SAAS,EAAE,CAAC;gBACZ,MAAM,EAAE,EAAE;aACc,CAAC;QAC7B,CAAC;IACH,CAAC,CAAC,CACH,CAAC;IAEF,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAwB,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACnF,MAAM,SAAS,GACb,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAwB,EAAE,CAAwB,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,IAAI,EAAE,CAAC;IAE5H,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;AAChC,CAAC;AAED,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare function parseJsonObjectFromText<T>(text: string): T | null;
2
+ export declare function asString(value: unknown): string;
3
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CAYjE;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAG/C"}
package/dist/utils.js ADDED
@@ -0,0 +1,22 @@
1
+ export function parseJsonObjectFromText(text) {
2
+ try {
3
+ return JSON.parse(text);
4
+ }
5
+ catch {
6
+ const match = text.match(/\{[\s\S]*\}/);
7
+ if (!match)
8
+ return null;
9
+ try {
10
+ return JSON.parse(match[0]);
11
+ }
12
+ catch {
13
+ return null;
14
+ }
15
+ }
16
+ }
17
+ export function asString(value) {
18
+ if (typeof value === "string")
19
+ return value;
20
+ return JSON.stringify(value);
21
+ }
22
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,uBAAuB,CAAI,IAAY;IACrD,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAM,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QACxC,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC;QACxB,IAAI,CAAC;YACH,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAM,CAAC;QACnC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC"}
package/package.json ADDED
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "rax-flow-providers",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "scripts": {
8
+ "build": "tsc -p tsconfig.json",
9
+ "test": "vitest run --passWithNoTests",
10
+ "typecheck": "tsc -p tsconfig.json --noEmit"
11
+ },
12
+ "dependencies": {
13
+ "rax-flow-core": "0.1.0"
14
+ },
15
+ "publishConfig": {
16
+ "access": "public"
17
+ }
18
+ }