@jaypie/llm 1.3.11 → 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/constants.d.ts +15 -1
- package/dist/cjs/index.cjs +1308 -139
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +35 -2
- package/dist/cjs/index.d.ts +1 -0
- 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/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/util/effort.d.ts +1 -0
- package/dist/esm/constants.d.ts +15 -1
- package/dist/esm/index.d.ts +35 -2
- package/dist/esm/index.js +1308 -140
- 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/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/util/effort.d.ts +1 -0
- package/package.json +1 -1
package/dist/cjs/index.d.cts
CHANGED
|
@@ -26,6 +26,13 @@ declare const MODEL: {
|
|
|
26
26
|
SONNET: string;
|
|
27
27
|
HAIKU: string;
|
|
28
28
|
MYTHOS: string;
|
|
29
|
+
FIREWORKS: {
|
|
30
|
+
DEEPSEEK: string;
|
|
31
|
+
GLM: string;
|
|
32
|
+
KIMI: string;
|
|
33
|
+
MINIMAX: string;
|
|
34
|
+
QWEN: string;
|
|
35
|
+
};
|
|
29
36
|
GEMINI_FLASH: string;
|
|
30
37
|
GEMINI_FLASH_LITE: string;
|
|
31
38
|
GEMINI_PRO: string;
|
|
@@ -86,6 +93,13 @@ declare const PROVIDER: {
|
|
|
86
93
|
readonly SCHEMA_VERSION: "v2";
|
|
87
94
|
};
|
|
88
95
|
};
|
|
96
|
+
readonly FIREWORKS: {
|
|
97
|
+
readonly API_KEY: "FIREWORKS_API_KEY";
|
|
98
|
+
readonly BASE_URL: "https://api.fireworks.ai/inference/v1";
|
|
99
|
+
readonly DEFAULT: string;
|
|
100
|
+
readonly MODEL_MATCH_WORDS: readonly ["fireworks"];
|
|
101
|
+
readonly NAME: "fireworks";
|
|
102
|
+
};
|
|
89
103
|
/** @deprecated Use PROVIDER.GOOGLE — "Google" is the provider; Gemini is the model family */
|
|
90
104
|
readonly GEMINI: {
|
|
91
105
|
readonly DEFAULT: string;
|
|
@@ -164,7 +178,7 @@ declare const PROVIDER: {
|
|
|
164
178
|
readonly NAME: "xai";
|
|
165
179
|
};
|
|
166
180
|
};
|
|
167
|
-
type LlmProviderName = typeof PROVIDER.ANTHROPIC.NAME | typeof PROVIDER.BEDROCK.NAME | typeof PROVIDER.GOOGLE.NAME | typeof PROVIDER.OPENAI.NAME | typeof PROVIDER.OPENROUTER.NAME | typeof PROVIDER.XAI.NAME;
|
|
181
|
+
type LlmProviderName = typeof PROVIDER.ANTHROPIC.NAME | typeof PROVIDER.BEDROCK.NAME | typeof PROVIDER.FIREWORKS.NAME | typeof PROVIDER.GOOGLE.NAME | typeof PROVIDER.OPENAI.NAME | typeof PROVIDER.OPENROUTER.NAME | typeof PROVIDER.XAI.NAME;
|
|
168
182
|
declare const DEFAULT: {
|
|
169
183
|
/** @deprecated Size tiers are retired in 2.0. Use DEFAULT.PROVIDER.DEFAULT, or pick a specific model from MODEL.*. */
|
|
170
184
|
readonly MODEL: {
|
|
@@ -840,6 +854,25 @@ declare class BedrockProvider implements LlmProvider {
|
|
|
840
854
|
stream(input: string | LlmHistory | LlmInputMessage, options?: LlmOperateOptions): AsyncIterable<LlmStreamChunk>;
|
|
841
855
|
}
|
|
842
856
|
|
|
857
|
+
declare class FireworksProvider implements LlmProvider {
|
|
858
|
+
private model;
|
|
859
|
+
private _client?;
|
|
860
|
+
private _operateLoop?;
|
|
861
|
+
private _streamLoop?;
|
|
862
|
+
private apiKey?;
|
|
863
|
+
private log;
|
|
864
|
+
private conversationHistory;
|
|
865
|
+
constructor(model?: string, { apiKey }?: {
|
|
866
|
+
apiKey?: string;
|
|
867
|
+
});
|
|
868
|
+
private getClient;
|
|
869
|
+
private getOperateLoop;
|
|
870
|
+
private getStreamLoop;
|
|
871
|
+
send(message: string, options?: LlmMessageOptions): Promise<string | JsonObject>;
|
|
872
|
+
operate(input: string | LlmHistory | LlmInputMessage, options?: LlmOperateOptions): Promise<LlmOperateResponse>;
|
|
873
|
+
stream(input: string | LlmHistory | LlmInputMessage, options?: LlmOperateOptions): AsyncIterable<LlmStreamChunk>;
|
|
874
|
+
}
|
|
875
|
+
|
|
843
876
|
declare class GoogleProvider implements LlmProvider {
|
|
844
877
|
private model;
|
|
845
878
|
private _client?;
|
|
@@ -897,5 +930,5 @@ declare class XaiProvider implements LlmProvider {
|
|
|
897
930
|
stream(input: string | LlmHistory | LlmInputMessage, options?: LlmOperateOptions): AsyncIterable<LlmStreamChunk>;
|
|
898
931
|
}
|
|
899
932
|
|
|
900
|
-
export { BedrockProvider, ErrorCategory, GoogleProvider as GeminiProvider, GoogleProvider, JaypieToolkit, constants as LLM, Llm, LlmError, LlmMessageRole, LlmMessageType, LlmProgressEventType, LlmQuotaError, LlmRateLimitError, LlmStreamChunkType, LlmTransientError, LlmUnrecoverableError, OpenRouterProvider, Toolkit, XaiProvider, extractReasoning, isLlmOperateInput, isLlmOperateInputContent, isLlmOperateInputFile, isLlmOperateInputImage, jsonSchemaToNaturalSchema, naturalSchemaToJsonSchema, toolkit, tools };
|
|
933
|
+
export { BedrockProvider, ErrorCategory, FireworksProvider, GoogleProvider as GeminiProvider, GoogleProvider, JaypieToolkit, constants as LLM, Llm, LlmError, LlmMessageRole, LlmMessageType, LlmProgressEventType, LlmQuotaError, LlmRateLimitError, LlmStreamChunkType, LlmTransientError, LlmUnrecoverableError, OpenRouterProvider, Toolkit, XaiProvider, extractReasoning, isLlmOperateInput, isLlmOperateInputContent, isLlmOperateInputFile, isLlmOperateInputImage, jsonSchemaToNaturalSchema, naturalSchemaToJsonSchema, toolkit, tools };
|
|
901
934
|
export type { LlmEffort, LlmErrorOptions, LlmFallbackConfig, LlmHistory, LlmInputContent, LlmInputContentFile, LlmInputContentImage, LlmInputContentText, LlmInputMessage, LlmMessageOptions, LlmModelOption, LlmOperateInput, LlmOperateInputContent, LlmOperateInputFile, LlmOperateInputImage, LlmOperateOptions, LlmOperateResponse, LlmOptions, LlmProgressCallback, LlmProgressEvent, LlmProgressToolCall, LlmProvider, LlmStreamChunk, LlmStreamChunkDone, LlmStreamChunkError, LlmStreamChunkText, LlmStreamChunkToolCall, LlmStreamChunkToolResult, LlmTool };
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export { ErrorCategory } from "./operate/types.js";
|
|
|
14
14
|
export { extractReasoning } from "./util/extractReasoning.js";
|
|
15
15
|
export { jsonSchemaToNaturalSchema, naturalSchemaToJsonSchema, } from "./util/jsonSchema.js";
|
|
16
16
|
export { BedrockProvider } from "./providers/bedrock/index.js";
|
|
17
|
+
export { FireworksProvider } from "./providers/fireworks/index.js";
|
|
17
18
|
/** @deprecated Use GoogleProvider — "Google" is the provider; Gemini is the model family */
|
|
18
19
|
export { GoogleProvider as GeminiProvider } from "./providers/google/index.js";
|
|
19
20
|
export { GoogleProvider } from "./providers/google/index.js";
|
|
@@ -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";
|
|
@@ -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[];
|
|
@@ -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;
|
package/dist/esm/constants.d.ts
CHANGED
|
@@ -21,6 +21,13 @@ export declare const MODEL: {
|
|
|
21
21
|
SONNET: string;
|
|
22
22
|
HAIKU: string;
|
|
23
23
|
MYTHOS: string;
|
|
24
|
+
FIREWORKS: {
|
|
25
|
+
DEEPSEEK: string;
|
|
26
|
+
GLM: string;
|
|
27
|
+
KIMI: string;
|
|
28
|
+
MINIMAX: string;
|
|
29
|
+
QWEN: string;
|
|
30
|
+
};
|
|
24
31
|
GEMINI_FLASH: string;
|
|
25
32
|
GEMINI_FLASH_LITE: string;
|
|
26
33
|
GEMINI_PRO: string;
|
|
@@ -81,6 +88,13 @@ export declare const PROVIDER: {
|
|
|
81
88
|
readonly SCHEMA_VERSION: "v2";
|
|
82
89
|
};
|
|
83
90
|
};
|
|
91
|
+
readonly FIREWORKS: {
|
|
92
|
+
readonly API_KEY: "FIREWORKS_API_KEY";
|
|
93
|
+
readonly BASE_URL: "https://api.fireworks.ai/inference/v1";
|
|
94
|
+
readonly DEFAULT: string;
|
|
95
|
+
readonly MODEL_MATCH_WORDS: readonly ["fireworks"];
|
|
96
|
+
readonly NAME: "fireworks";
|
|
97
|
+
};
|
|
84
98
|
/** @deprecated Use PROVIDER.GOOGLE — "Google" is the provider; Gemini is the model family */
|
|
85
99
|
readonly GEMINI: {
|
|
86
100
|
readonly DEFAULT: string;
|
|
@@ -159,7 +173,7 @@ export declare const PROVIDER: {
|
|
|
159
173
|
readonly NAME: "xai";
|
|
160
174
|
};
|
|
161
175
|
};
|
|
162
|
-
export type LlmProviderName = typeof PROVIDER.ANTHROPIC.NAME | typeof PROVIDER.BEDROCK.NAME | typeof PROVIDER.GOOGLE.NAME | typeof PROVIDER.OPENAI.NAME | typeof PROVIDER.OPENROUTER.NAME | typeof PROVIDER.XAI.NAME;
|
|
176
|
+
export type LlmProviderName = typeof PROVIDER.ANTHROPIC.NAME | typeof PROVIDER.BEDROCK.NAME | typeof PROVIDER.FIREWORKS.NAME | typeof PROVIDER.GOOGLE.NAME | typeof PROVIDER.OPENAI.NAME | typeof PROVIDER.OPENROUTER.NAME | typeof PROVIDER.XAI.NAME;
|
|
163
177
|
export declare const DEFAULT: {
|
|
164
178
|
/** @deprecated Size tiers are retired in 2.0. Use DEFAULT.PROVIDER.DEFAULT, or pick a specific model from MODEL.*. */
|
|
165
179
|
readonly MODEL: {
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -26,6 +26,13 @@ declare const MODEL: {
|
|
|
26
26
|
SONNET: string;
|
|
27
27
|
HAIKU: string;
|
|
28
28
|
MYTHOS: string;
|
|
29
|
+
FIREWORKS: {
|
|
30
|
+
DEEPSEEK: string;
|
|
31
|
+
GLM: string;
|
|
32
|
+
KIMI: string;
|
|
33
|
+
MINIMAX: string;
|
|
34
|
+
QWEN: string;
|
|
35
|
+
};
|
|
29
36
|
GEMINI_FLASH: string;
|
|
30
37
|
GEMINI_FLASH_LITE: string;
|
|
31
38
|
GEMINI_PRO: string;
|
|
@@ -86,6 +93,13 @@ declare const PROVIDER: {
|
|
|
86
93
|
readonly SCHEMA_VERSION: "v2";
|
|
87
94
|
};
|
|
88
95
|
};
|
|
96
|
+
readonly FIREWORKS: {
|
|
97
|
+
readonly API_KEY: "FIREWORKS_API_KEY";
|
|
98
|
+
readonly BASE_URL: "https://api.fireworks.ai/inference/v1";
|
|
99
|
+
readonly DEFAULT: string;
|
|
100
|
+
readonly MODEL_MATCH_WORDS: readonly ["fireworks"];
|
|
101
|
+
readonly NAME: "fireworks";
|
|
102
|
+
};
|
|
89
103
|
/** @deprecated Use PROVIDER.GOOGLE — "Google" is the provider; Gemini is the model family */
|
|
90
104
|
readonly GEMINI: {
|
|
91
105
|
readonly DEFAULT: string;
|
|
@@ -164,7 +178,7 @@ declare const PROVIDER: {
|
|
|
164
178
|
readonly NAME: "xai";
|
|
165
179
|
};
|
|
166
180
|
};
|
|
167
|
-
type LlmProviderName = typeof PROVIDER.ANTHROPIC.NAME | typeof PROVIDER.BEDROCK.NAME | typeof PROVIDER.GOOGLE.NAME | typeof PROVIDER.OPENAI.NAME | typeof PROVIDER.OPENROUTER.NAME | typeof PROVIDER.XAI.NAME;
|
|
181
|
+
type LlmProviderName = typeof PROVIDER.ANTHROPIC.NAME | typeof PROVIDER.BEDROCK.NAME | typeof PROVIDER.FIREWORKS.NAME | typeof PROVIDER.GOOGLE.NAME | typeof PROVIDER.OPENAI.NAME | typeof PROVIDER.OPENROUTER.NAME | typeof PROVIDER.XAI.NAME;
|
|
168
182
|
declare const DEFAULT: {
|
|
169
183
|
/** @deprecated Size tiers are retired in 2.0. Use DEFAULT.PROVIDER.DEFAULT, or pick a specific model from MODEL.*. */
|
|
170
184
|
readonly MODEL: {
|
|
@@ -840,6 +854,25 @@ declare class BedrockProvider implements LlmProvider {
|
|
|
840
854
|
stream(input: string | LlmHistory | LlmInputMessage, options?: LlmOperateOptions): AsyncIterable<LlmStreamChunk>;
|
|
841
855
|
}
|
|
842
856
|
|
|
857
|
+
declare class FireworksProvider implements LlmProvider {
|
|
858
|
+
private model;
|
|
859
|
+
private _client?;
|
|
860
|
+
private _operateLoop?;
|
|
861
|
+
private _streamLoop?;
|
|
862
|
+
private apiKey?;
|
|
863
|
+
private log;
|
|
864
|
+
private conversationHistory;
|
|
865
|
+
constructor(model?: string, { apiKey }?: {
|
|
866
|
+
apiKey?: string;
|
|
867
|
+
});
|
|
868
|
+
private getClient;
|
|
869
|
+
private getOperateLoop;
|
|
870
|
+
private getStreamLoop;
|
|
871
|
+
send(message: string, options?: LlmMessageOptions): Promise<string | JsonObject>;
|
|
872
|
+
operate(input: string | LlmHistory | LlmInputMessage, options?: LlmOperateOptions): Promise<LlmOperateResponse>;
|
|
873
|
+
stream(input: string | LlmHistory | LlmInputMessage, options?: LlmOperateOptions): AsyncIterable<LlmStreamChunk>;
|
|
874
|
+
}
|
|
875
|
+
|
|
843
876
|
declare class GoogleProvider implements LlmProvider {
|
|
844
877
|
private model;
|
|
845
878
|
private _client?;
|
|
@@ -897,5 +930,5 @@ declare class XaiProvider implements LlmProvider {
|
|
|
897
930
|
stream(input: string | LlmHistory | LlmInputMessage, options?: LlmOperateOptions): AsyncIterable<LlmStreamChunk>;
|
|
898
931
|
}
|
|
899
932
|
|
|
900
|
-
export { BedrockProvider, ErrorCategory, GoogleProvider as GeminiProvider, GoogleProvider, JaypieToolkit, constants as LLM, Llm, LlmError, LlmMessageRole, LlmMessageType, LlmProgressEventType, LlmQuotaError, LlmRateLimitError, LlmStreamChunkType, LlmTransientError, LlmUnrecoverableError, OpenRouterProvider, Toolkit, XaiProvider, extractReasoning, isLlmOperateInput, isLlmOperateInputContent, isLlmOperateInputFile, isLlmOperateInputImage, jsonSchemaToNaturalSchema, naturalSchemaToJsonSchema, toolkit, tools };
|
|
933
|
+
export { BedrockProvider, ErrorCategory, FireworksProvider, GoogleProvider as GeminiProvider, GoogleProvider, JaypieToolkit, constants as LLM, Llm, LlmError, LlmMessageRole, LlmMessageType, LlmProgressEventType, LlmQuotaError, LlmRateLimitError, LlmStreamChunkType, LlmTransientError, LlmUnrecoverableError, OpenRouterProvider, Toolkit, XaiProvider, extractReasoning, isLlmOperateInput, isLlmOperateInputContent, isLlmOperateInputFile, isLlmOperateInputImage, jsonSchemaToNaturalSchema, naturalSchemaToJsonSchema, toolkit, tools };
|
|
901
934
|
export type { LlmEffort, LlmErrorOptions, LlmFallbackConfig, LlmHistory, LlmInputContent, LlmInputContentFile, LlmInputContentImage, LlmInputContentText, LlmInputMessage, LlmMessageOptions, LlmModelOption, LlmOperateInput, LlmOperateInputContent, LlmOperateInputFile, LlmOperateInputImage, LlmOperateOptions, LlmOperateResponse, LlmOptions, LlmProgressCallback, LlmProgressEvent, LlmProgressToolCall, LlmProvider, LlmStreamChunk, LlmStreamChunkDone, LlmStreamChunkError, LlmStreamChunkText, LlmStreamChunkToolCall, LlmStreamChunkToolResult, LlmTool };
|