@jaypie/llm 1.3.10 → 1.3.12
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/dist/cjs/Llm.d.ts +19 -11
- package/dist/cjs/constants.d.ts +15 -1
- package/dist/cjs/errors/LlmError.d.ts +62 -0
- package/dist/cjs/errors/toLlmError.d.ts +11 -0
- package/dist/cjs/index.cjs +5776 -4274
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +147 -15
- package/dist/cjs/index.d.ts +5 -1
- package/dist/cjs/operate/adapters/FireworksAdapter.d.ts +151 -0
- package/dist/cjs/operate/adapters/index.d.ts +1 -0
- package/dist/cjs/operate/index.d.ts +1 -1
- package/dist/cjs/operate/retry/RetryExecutor.d.ts +13 -0
- package/dist/cjs/operate/types.d.ts +12 -1
- package/dist/cjs/providers/fireworks/FireworksProvider.class.d.ts +21 -0
- package/dist/cjs/providers/fireworks/client.d.ts +37 -0
- package/dist/cjs/providers/fireworks/index.d.ts +2 -0
- package/dist/cjs/providers/fireworks/utils.d.ts +15 -0
- package/dist/cjs/types/LlmProvider.interface.d.ts +9 -0
- package/dist/cjs/util/classifyProviderError.d.ts +13 -0
- package/dist/cjs/util/effort.d.ts +1 -0
- package/dist/cjs/util/resolveModelChain.d.ts +17 -0
- package/dist/esm/Llm.d.ts +19 -11
- package/dist/esm/constants.d.ts +15 -1
- package/dist/esm/errors/LlmError.d.ts +62 -0
- package/dist/esm/errors/toLlmError.d.ts +11 -0
- package/dist/esm/index.d.ts +147 -15
- package/dist/esm/index.js +5760 -4264
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/operate/adapters/FireworksAdapter.d.ts +151 -0
- package/dist/esm/operate/adapters/index.d.ts +1 -0
- package/dist/esm/operate/index.d.ts +1 -1
- package/dist/esm/operate/retry/RetryExecutor.d.ts +13 -0
- package/dist/esm/operate/types.d.ts +12 -1
- package/dist/esm/providers/fireworks/FireworksProvider.class.d.ts +21 -0
- package/dist/esm/providers/fireworks/client.d.ts +37 -0
- package/dist/esm/providers/fireworks/index.d.ts +2 -0
- package/dist/esm/providers/fireworks/utils.d.ts +15 -0
- package/dist/esm/types/LlmProvider.interface.d.ts +9 -0
- package/dist/esm/util/classifyProviderError.d.ts +13 -0
- package/dist/esm/util/effort.d.ts +1 -0
- package/dist/esm/util/resolveModelChain.d.ts +17 -0
- package/package.json +1 -1
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { JsonObject, NaturalSchema } from "@jaypie/types";
|
|
2
|
+
import { z } from "zod/v4";
|
|
3
|
+
import { Toolkit } from "../../tools/Toolkit.class.js";
|
|
4
|
+
import { LlmHistory, LlmOperateOptions, LlmUsageItem } from "../../types/LlmProvider.interface.js";
|
|
5
|
+
import { LlmStreamChunk } from "../../types/LlmStreamChunk.interface.js";
|
|
6
|
+
import { ClassifiedError, OperateRequest, ParsedResponse, ProviderToolDefinition, StandardToolCall, StandardToolResult } from "../types.js";
|
|
7
|
+
import { BaseProviderAdapter } from "./ProviderAdapter.interface.js";
|
|
8
|
+
interface FireworksMessage {
|
|
9
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
10
|
+
content?: string | FireworksContentPart[] | null;
|
|
11
|
+
toolCalls?: FireworksToolCall[];
|
|
12
|
+
toolCallId?: string;
|
|
13
|
+
}
|
|
14
|
+
interface FireworksToolCall {
|
|
15
|
+
id: string;
|
|
16
|
+
type: "function";
|
|
17
|
+
function: {
|
|
18
|
+
name: string;
|
|
19
|
+
arguments: string;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
interface FireworksResponseMessage {
|
|
23
|
+
role: "assistant";
|
|
24
|
+
content?: string | null;
|
|
25
|
+
toolCalls?: FireworksToolCall[];
|
|
26
|
+
refusal?: string | null;
|
|
27
|
+
reasoning?: string | null;
|
|
28
|
+
reasoning_content?: string | null;
|
|
29
|
+
}
|
|
30
|
+
interface FireworksChoice {
|
|
31
|
+
index: number;
|
|
32
|
+
message: FireworksResponseMessage;
|
|
33
|
+
finishReason: string | null;
|
|
34
|
+
finish_reason?: string | null;
|
|
35
|
+
}
|
|
36
|
+
interface FireworksUsage {
|
|
37
|
+
promptTokens: number;
|
|
38
|
+
completionTokens: number;
|
|
39
|
+
totalTokens: number;
|
|
40
|
+
prompt_tokens?: number;
|
|
41
|
+
completion_tokens?: number;
|
|
42
|
+
total_tokens?: number;
|
|
43
|
+
completionTokensDetails?: {
|
|
44
|
+
reasoningTokens?: number;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
interface FireworksResponse {
|
|
48
|
+
id: string;
|
|
49
|
+
object: string;
|
|
50
|
+
created: number;
|
|
51
|
+
model: string;
|
|
52
|
+
choices: FireworksChoice[];
|
|
53
|
+
usage?: FireworksUsage;
|
|
54
|
+
}
|
|
55
|
+
interface FireworksTool {
|
|
56
|
+
type: "function";
|
|
57
|
+
function: {
|
|
58
|
+
name: string;
|
|
59
|
+
description: string;
|
|
60
|
+
parameters: JsonObject;
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
interface FireworksJsonSchemaConfig {
|
|
64
|
+
name: string;
|
|
65
|
+
description?: string;
|
|
66
|
+
schema: JsonObject;
|
|
67
|
+
strict?: boolean;
|
|
68
|
+
}
|
|
69
|
+
type FireworksResponseFormat = {
|
|
70
|
+
type: "json_schema";
|
|
71
|
+
json_schema: FireworksJsonSchemaConfig;
|
|
72
|
+
} | {
|
|
73
|
+
type: "json_object";
|
|
74
|
+
} | {
|
|
75
|
+
type: "text";
|
|
76
|
+
};
|
|
77
|
+
interface FireworksRequest {
|
|
78
|
+
model: string;
|
|
79
|
+
messages: FireworksMessage[];
|
|
80
|
+
tools?: FireworksTool[];
|
|
81
|
+
tool_choice?: "auto" | "none" | "required";
|
|
82
|
+
response_format?: FireworksResponseFormat;
|
|
83
|
+
reasoning_effort?: string;
|
|
84
|
+
user?: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Fireworks content part types. Fireworks follows the OpenAI Chat Completions
|
|
88
|
+
* multimodal schema for `image_url` parts (URL or base64 data URI). There is
|
|
89
|
+
* no OpenAI-style `file` part, and the API rejects `data:` URIs for documents
|
|
90
|
+
* ("Unsupported URL scheme 'data'"), so file inputs cannot be delivered.
|
|
91
|
+
*/
|
|
92
|
+
type FireworksContentPart = {
|
|
93
|
+
type: "text";
|
|
94
|
+
text: string;
|
|
95
|
+
} | {
|
|
96
|
+
type: "image_url";
|
|
97
|
+
imageUrl: {
|
|
98
|
+
url: string;
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* FireworksAdapter implements the ProviderAdapter interface for Fireworks AI's
|
|
103
|
+
* OpenAI-compatible Chat Completions API. It handles request building,
|
|
104
|
+
* response parsing, and error classification specific to Fireworks.
|
|
105
|
+
*/
|
|
106
|
+
export declare class FireworksAdapter extends BaseProviderAdapter {
|
|
107
|
+
readonly name: "fireworks";
|
|
108
|
+
readonly defaultModel: string;
|
|
109
|
+
private runtimeNoStructuredOutputModels;
|
|
110
|
+
rememberModelRejectsStructuredOutput(model: string): void;
|
|
111
|
+
clearRuntimeNoStructuredOutputModels(): void;
|
|
112
|
+
private supportsStructuredOutput;
|
|
113
|
+
private runtimeNoTemperatureModels;
|
|
114
|
+
rememberModelRejectsTemperature(model: string): void;
|
|
115
|
+
clearRuntimeNoTemperatureModels(): void;
|
|
116
|
+
private supportsTemperature;
|
|
117
|
+
buildRequest(request: OperateRequest): FireworksRequest;
|
|
118
|
+
formatTools(toolkit: Toolkit, _outputSchema?: JsonObject): ProviderToolDefinition[];
|
|
119
|
+
formatOutputSchema(schema: JsonObject | NaturalSchema | z.ZodType): JsonObject;
|
|
120
|
+
executeRequest(client: unknown, request: unknown, signal?: AbortSignal): Promise<FireworksResponse>;
|
|
121
|
+
/**
|
|
122
|
+
* Serialize the internal request into the OpenAI-compatible wire body for
|
|
123
|
+
* Fireworks' Chat Completions endpoint. Top-level fields (model, tools,
|
|
124
|
+
* tool_choice, response_format, reasoning_effort, user, temperature, and any
|
|
125
|
+
* providerOptions) are already wire-shaped (snake_case); only messages carry
|
|
126
|
+
* camelCase tool fields that must become snake_case on the wire.
|
|
127
|
+
*/
|
|
128
|
+
private toWireBody;
|
|
129
|
+
/**
|
|
130
|
+
* Rebuild a structured-output request without `response_format`, swapping in
|
|
131
|
+
* the legacy fake-tool emulation. Used as a runtime fallback when a model
|
|
132
|
+
* rejects native json_schema.
|
|
133
|
+
*/
|
|
134
|
+
private toFallbackStructuredOutputRequest;
|
|
135
|
+
executeStreamRequest(client: unknown, request: unknown, signal?: AbortSignal): AsyncIterable<LlmStreamChunk>;
|
|
136
|
+
parseResponse(response: unknown, _options?: LlmOperateOptions): ParsedResponse;
|
|
137
|
+
extractToolCalls(response: unknown): StandardToolCall[];
|
|
138
|
+
extractUsage(response: unknown, model: string): LlmUsageItem;
|
|
139
|
+
formatToolResult(toolCall: StandardToolCall, result: StandardToolResult): FireworksMessage;
|
|
140
|
+
appendToolResult(request: unknown, toolCall: StandardToolCall, result: StandardToolResult): FireworksRequest;
|
|
141
|
+
responseToHistoryItems(response: unknown): LlmHistory;
|
|
142
|
+
classifyError(error: unknown): ClassifiedError;
|
|
143
|
+
isComplete(response: unknown): boolean;
|
|
144
|
+
hasStructuredOutput(response: unknown): boolean;
|
|
145
|
+
extractStructuredOutput(response: unknown): JsonObject | undefined;
|
|
146
|
+
private hasToolCalls;
|
|
147
|
+
private extractContent;
|
|
148
|
+
private convertMessagesToFireworks;
|
|
149
|
+
}
|
|
150
|
+
export declare const fireworksAdapter: FireworksAdapter;
|
|
151
|
+
export {};
|
|
@@ -2,6 +2,7 @@ export { BaseProviderAdapter } from "./ProviderAdapter.interface.js";
|
|
|
2
2
|
export type { ProviderAdapter } from "./ProviderAdapter.interface.js";
|
|
3
3
|
export { AnthropicAdapter, anthropicAdapter } from "./AnthropicAdapter.js";
|
|
4
4
|
export { BedrockAdapter, bedrockAdapter } from "./BedrockAdapter.js";
|
|
5
|
+
export { FireworksAdapter, fireworksAdapter } from "./FireworksAdapter.js";
|
|
5
6
|
export { GoogleAdapter, googleAdapter } from "./GoogleAdapter.js";
|
|
6
7
|
export { OpenAiAdapter, openAiAdapter } from "./OpenAiAdapter.js";
|
|
7
8
|
export { OpenRouterAdapter, openRouterAdapter } from "./OpenRouterAdapter.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { AnthropicAdapter, anthropicAdapter, BaseProviderAdapter, BedrockAdapter, bedrockAdapter, GoogleAdapter, googleAdapter, OpenAiAdapter, openAiAdapter, OpenRouterAdapter, openRouterAdapter, XaiAdapter, xaiAdapter, } from "./adapters/index.js";
|
|
1
|
+
export { AnthropicAdapter, anthropicAdapter, BaseProviderAdapter, BedrockAdapter, bedrockAdapter, FireworksAdapter, fireworksAdapter, GoogleAdapter, googleAdapter, OpenAiAdapter, openAiAdapter, OpenRouterAdapter, openRouterAdapter, XaiAdapter, xaiAdapter, } from "./adapters/index.js";
|
|
2
2
|
export type { ProviderAdapter } from "./adapters/index.js";
|
|
3
3
|
export { createOperateLoop, OperateLoop } from "./OperateLoop.js";
|
|
4
4
|
export type { OperateLoopConfig } from "./OperateLoop.js";
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { HookRunner, LlmHooks } from "../hooks/HookRunner.js";
|
|
2
2
|
import { RetryPolicy } from "./RetryPolicy.js";
|
|
3
|
+
import { ClassifiedError } from "../types.js";
|
|
3
4
|
export interface RetryContext {
|
|
4
5
|
input: unknown;
|
|
5
6
|
options?: unknown;
|
|
6
7
|
providerRequest: unknown;
|
|
8
|
+
/** Provider name, carried onto the thrown LlmError */
|
|
9
|
+
provider?: string;
|
|
10
|
+
/** Model in use, carried onto the thrown LlmError */
|
|
11
|
+
model?: string;
|
|
7
12
|
}
|
|
8
13
|
export interface ErrorClassifier {
|
|
9
14
|
isRetryable(error: unknown): boolean;
|
|
10
15
|
isKnownError(error: unknown): boolean;
|
|
16
|
+
/** Full classification, used to throw a typed LlmError on terminal failure */
|
|
17
|
+
classify(error: unknown): ClassifiedError;
|
|
11
18
|
}
|
|
12
19
|
export interface RetryExecutorConfig {
|
|
13
20
|
errorClassifier: ErrorClassifier;
|
|
@@ -27,6 +34,12 @@ export declare class RetryExecutor {
|
|
|
27
34
|
private readonly hookRunner;
|
|
28
35
|
private readonly errorClassifier;
|
|
29
36
|
constructor(config: RetryExecutorConfig);
|
|
37
|
+
/**
|
|
38
|
+
* Build the typed, provider-agnostic error thrown when a request cannot be
|
|
39
|
+
* completed — classified (rate limit / quota / unrecoverable / transient)
|
|
40
|
+
* and carrying the provider, model, and original error as `cause`.
|
|
41
|
+
*/
|
|
42
|
+
private toTerminalError;
|
|
30
43
|
/**
|
|
31
44
|
* Execute an operation with retry logic.
|
|
32
45
|
* Each attempt receives an AbortSignal. On failure, the signal is aborted
|
|
@@ -97,8 +97,14 @@ export interface ProviderToolDefinition {
|
|
|
97
97
|
export declare enum ErrorCategory {
|
|
98
98
|
/** Error is transient and can be retried */
|
|
99
99
|
Retryable = "retryable",
|
|
100
|
-
/** Error is due to rate limiting */
|
|
100
|
+
/** Error is due to short-term rate limiting (retry after a delay) */
|
|
101
101
|
RateLimit = "rate_limit",
|
|
102
|
+
/**
|
|
103
|
+
* Provider quota is exhausted or the account cannot be billed
|
|
104
|
+
* (insufficient funds, daily quota, plan limit). Terminal and actionable —
|
|
105
|
+
* retrying within the request budget will not help.
|
|
106
|
+
*/
|
|
107
|
+
Quota = "quota",
|
|
102
108
|
/** Error cannot be recovered from */
|
|
103
109
|
Unrecoverable = "unrecoverable",
|
|
104
110
|
/** Error type is unknown */
|
|
@@ -116,6 +122,11 @@ export interface ClassifiedError {
|
|
|
116
122
|
shouldRetry: boolean;
|
|
117
123
|
/** Suggested delay before retry (if applicable) */
|
|
118
124
|
suggestedDelayMs?: number;
|
|
125
|
+
/**
|
|
126
|
+
* For {@link ErrorCategory.Quota}, distinguishes an exhausted usage quota
|
|
127
|
+
* from an account that cannot be billed (insufficient funds).
|
|
128
|
+
*/
|
|
129
|
+
reason?: "quota" | "billing";
|
|
119
130
|
}
|
|
120
131
|
import type { ResponseBuilder } from "./response/ResponseBuilder.js";
|
|
121
132
|
/**
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { JsonObject } from "@jaypie/types";
|
|
2
|
+
import { LlmHistory, LlmInputMessage, LlmMessageOptions, LlmOperateOptions, LlmOperateResponse, LlmProvider } from "../../types/LlmProvider.interface.js";
|
|
3
|
+
import { LlmStreamChunk } from "../../types/LlmStreamChunk.interface.js";
|
|
4
|
+
export declare class FireworksProvider implements LlmProvider {
|
|
5
|
+
private model;
|
|
6
|
+
private _client?;
|
|
7
|
+
private _operateLoop?;
|
|
8
|
+
private _streamLoop?;
|
|
9
|
+
private apiKey?;
|
|
10
|
+
private log;
|
|
11
|
+
private conversationHistory;
|
|
12
|
+
constructor(model?: string, { apiKey }?: {
|
|
13
|
+
apiKey?: string;
|
|
14
|
+
});
|
|
15
|
+
private getClient;
|
|
16
|
+
private getOperateLoop;
|
|
17
|
+
private getStreamLoop;
|
|
18
|
+
send(message: string, options?: LlmMessageOptions): Promise<string | JsonObject>;
|
|
19
|
+
operate(input: string | LlmHistory | LlmInputMessage, options?: LlmOperateOptions): Promise<LlmOperateResponse>;
|
|
20
|
+
stream(input: string | LlmHistory | LlmInputMessage, options?: LlmOperateOptions): AsyncIterable<LlmStreamChunk>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { JsonObject } from "@jaypie/types";
|
|
2
|
+
export interface FireworksClientOptions {
|
|
3
|
+
apiKey: string;
|
|
4
|
+
baseURL?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ChatCompletionOptions {
|
|
7
|
+
signal?: AbortSignal;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* HTTP error carrying the upstream status and parsed API message. The
|
|
11
|
+
* FireworksAdapter classifies errors by reading `.status` / `.statusCode` and
|
|
12
|
+
* `.message` / `.error.message`.
|
|
13
|
+
*/
|
|
14
|
+
export declare class FireworksHttpError extends Error {
|
|
15
|
+
readonly status: number;
|
|
16
|
+
readonly statusCode: number;
|
|
17
|
+
readonly error?: {
|
|
18
|
+
message?: string;
|
|
19
|
+
};
|
|
20
|
+
constructor(status: number, message: string, error?: {
|
|
21
|
+
message?: string;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Minimal `fetch`-based client for Fireworks AI's OpenAI-compatible Chat
|
|
26
|
+
* Completions endpoint. The adapter only needs a single POST (streaming and
|
|
27
|
+
* non-streaming), header auth, and HTTP error surfacing.
|
|
28
|
+
*/
|
|
29
|
+
export declare class FireworksClient {
|
|
30
|
+
private readonly apiKey;
|
|
31
|
+
private readonly baseURL;
|
|
32
|
+
constructor({ apiKey, baseURL, }: FireworksClientOptions);
|
|
33
|
+
private headers;
|
|
34
|
+
private toError;
|
|
35
|
+
chatCompletion(body: Record<string, unknown>, { signal }?: ChatCompletionOptions): Promise<JsonObject>;
|
|
36
|
+
streamChatCompletion(body: Record<string, unknown>, { signal }?: ChatCompletionOptions): AsyncIterable<JsonObject>;
|
|
37
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { createLogger } from "@jaypie/logger";
|
|
2
|
+
import { LlmMessageOptions } from "../../types/LlmProvider.interface.js";
|
|
3
|
+
import { FireworksClient } from "./client.js";
|
|
4
|
+
export declare const getLogger: () => ReturnType<typeof createLogger>;
|
|
5
|
+
export declare function initializeClient({ apiKey, }?: {
|
|
6
|
+
apiKey?: string;
|
|
7
|
+
}): Promise<FireworksClient>;
|
|
8
|
+
export declare function getDefaultModel(): string;
|
|
9
|
+
export interface ChatMessage {
|
|
10
|
+
role: "system" | "user" | "assistant";
|
|
11
|
+
content: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function formatSystemMessage(systemPrompt: string, { data, placeholders }?: Pick<LlmMessageOptions, "data" | "placeholders">): ChatMessage;
|
|
14
|
+
export declare function formatUserMessage(message: string, { data, placeholders }?: Pick<LlmMessageOptions, "data" | "placeholders">): ChatMessage;
|
|
15
|
+
export declare function prepareMessages(message: string, { system, data, placeholders }?: LlmMessageOptions): ChatMessage[];
|
|
@@ -295,6 +295,15 @@ export interface LlmOperateOptions {
|
|
|
295
295
|
turns?: boolean | number;
|
|
296
296
|
user?: string;
|
|
297
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* A single model name, or a preference-ordered array of model names.
|
|
300
|
+
* An array is interpreted as a fallback chain: index 0 is primary, later
|
|
301
|
+
* entries are tried in order when earlier ones fail (provider auto-detected
|
|
302
|
+
* per entry). Accepted by the `Llm` constructor and static/instance
|
|
303
|
+
* `operate`/`send`/`stream` methods; normalized to a scalar model plus a
|
|
304
|
+
* derived fallback chain before reaching providers.
|
|
305
|
+
*/
|
|
306
|
+
export type LlmModelOption = string | string[];
|
|
298
307
|
export interface LlmOptions {
|
|
299
308
|
apiKey?: string;
|
|
300
309
|
/** Chain of fallback providers to try if primary fails */
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ClassifiedError } from "../operate/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Shared, provider-agnostic first pass over an error. Returns a
|
|
4
|
+
* {@link ClassifiedError} when the message unambiguously identifies a
|
|
5
|
+
* cross-provider condition (retryable structured-output timeout, exhausted
|
|
6
|
+
* quota, or a billing failure), or `undefined` to defer to the adapter's own
|
|
7
|
+
* status/name classification.
|
|
8
|
+
*
|
|
9
|
+
* Adapters call this before their existing logic so that, for example, a
|
|
10
|
+
* `429` carrying a daily-quota message is classified as {@link
|
|
11
|
+
* ErrorCategory.Quota} rather than {@link ErrorCategory.RateLimit}.
|
|
12
|
+
*/
|
|
13
|
+
export declare function classifyProviderError(error: unknown): ClassifiedError | undefined;
|
|
@@ -39,4 +39,5 @@ export declare function toXaiEffort(effort: LlmEffort): LlmEffortMapping;
|
|
|
39
39
|
export declare function toAnthropicEffort(effort: LlmEffort): LlmEffortMapping;
|
|
40
40
|
export declare function toGeminiThinkingLevel(effort: LlmEffort): LlmEffortMapping;
|
|
41
41
|
export declare function toGeminiThinkingBudget(effort: LlmEffort): LlmEffortMapping<number>;
|
|
42
|
+
export declare function toFireworksEffort(effort: LlmEffort): LlmEffortMapping;
|
|
42
43
|
export declare function toOpenRouterEffort(effort: LlmEffort): LlmEffortMapping;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LlmFallbackConfig } from "../types/LlmProvider.interface.js";
|
|
2
|
+
/**
|
|
3
|
+
* Normalizes a `model` option that may be a single model name or a
|
|
4
|
+
* preference-ordered array of model names.
|
|
5
|
+
*
|
|
6
|
+
* A `string[]` is interpreted as a fallback chain: index `0` is the primary
|
|
7
|
+
* model, indices `1..` become fallback entries with an auto-detected provider
|
|
8
|
+
* (reusing `determineModelProvider`, exactly as the constructor's first
|
|
9
|
+
* argument does).
|
|
10
|
+
*
|
|
11
|
+
* Returns the primary model plus the derived fallback chain. A bare string
|
|
12
|
+
* yields an empty chain and is unchanged.
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveModelChain(model?: string | string[]): {
|
|
15
|
+
model?: string;
|
|
16
|
+
fallback: LlmFallbackConfig[];
|
|
17
|
+
};
|