@jaypie/llm 1.2.37 → 1.2.39
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 +33 -4
- package/dist/cjs/index.cjs +78 -56
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.ts +3 -1
- package/dist/cjs/operate/adapters/{GeminiAdapter.d.ts → GoogleAdapter.d.ts} +4 -4
- package/dist/cjs/operate/adapters/index.d.ts +1 -1
- package/dist/cjs/operate/index.d.ts +1 -1
- package/dist/cjs/providers/{gemini/GeminiProvider.class.d.ts → google/GoogleProvider.class.d.ts} +1 -1
- package/dist/cjs/providers/google/index.d.ts +3 -0
- package/dist/cjs/types/LlmProvider.interface.d.ts +1 -1
- package/dist/esm/constants.d.ts +33 -4
- package/dist/esm/index.d.ts +3 -1
- package/dist/esm/index.js +77 -56
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/operate/adapters/{GeminiAdapter.d.ts → GoogleAdapter.d.ts} +4 -4
- package/dist/esm/operate/adapters/index.d.ts +1 -1
- package/dist/esm/operate/index.d.ts +1 -1
- package/dist/esm/providers/{gemini/GeminiProvider.class.d.ts → google/GoogleProvider.class.d.ts} +1 -1
- package/dist/esm/providers/google/index.d.ts +3 -0
- package/dist/esm/types/LlmProvider.interface.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cjs/providers/gemini/index.d.ts +0 -3
- package/dist/esm/providers/gemini/index.d.ts +0 -3
- /package/dist/cjs/providers/{gemini → google}/types.d.ts +0 -0
- /package/dist/cjs/providers/{gemini → google}/utils.d.ts +0 -0
- /package/dist/esm/providers/{gemini → google}/types.d.ts +0 -0
- /package/dist/esm/providers/{gemini → google}/utils.d.ts +0 -0
package/dist/cjs/constants.d.ts
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
export declare const MODEL: {
|
|
2
|
+
OPUS: string;
|
|
3
|
+
SONNET: string;
|
|
4
|
+
HAIKU: string;
|
|
5
|
+
FABLE: string;
|
|
6
|
+
MYTHOS: string;
|
|
7
|
+
GEMINI_FLASH: string;
|
|
8
|
+
GEMINI_FLASH_LITE: string;
|
|
9
|
+
GEMINI_PRO: string;
|
|
10
|
+
GPT: string;
|
|
11
|
+
GPT_MINI: string;
|
|
12
|
+
GPT_NANO: string;
|
|
13
|
+
GROK: string;
|
|
14
|
+
};
|
|
1
15
|
export declare const PROVIDER: {
|
|
2
16
|
readonly BEDROCK: {
|
|
3
17
|
readonly MODEL: {
|
|
@@ -35,12 +49,27 @@ export declare const PROVIDER: {
|
|
|
35
49
|
readonly SCHEMA_VERSION: "v2";
|
|
36
50
|
};
|
|
37
51
|
};
|
|
52
|
+
/** @deprecated Use PROVIDER.GOOGLE — "Google" is the provider; Gemini is the model family */
|
|
38
53
|
readonly GEMINI: {
|
|
39
54
|
readonly MODEL: {
|
|
40
55
|
readonly DEFAULT: "gemini-3.1-pro-preview";
|
|
41
56
|
readonly LARGE: "gemini-3.1-pro-preview";
|
|
42
57
|
readonly SMALL: "gemini-3.5-flash";
|
|
43
|
-
readonly TINY: "gemini-3.
|
|
58
|
+
readonly TINY: "gemini-3.1-flash-lite";
|
|
59
|
+
};
|
|
60
|
+
readonly MODEL_MATCH_WORDS: readonly ["gemini", "google"];
|
|
61
|
+
readonly NAME: "google";
|
|
62
|
+
readonly ROLE: {
|
|
63
|
+
readonly MODEL: "model";
|
|
64
|
+
readonly USER: "user";
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
readonly GOOGLE: {
|
|
68
|
+
readonly MODEL: {
|
|
69
|
+
readonly DEFAULT: "gemini-3.1-pro-preview";
|
|
70
|
+
readonly LARGE: "gemini-3.1-pro-preview";
|
|
71
|
+
readonly SMALL: "gemini-3.5-flash";
|
|
72
|
+
readonly TINY: "gemini-3.1-flash-lite";
|
|
44
73
|
};
|
|
45
74
|
readonly MODEL_MATCH_WORDS: readonly ["gemini", "google"];
|
|
46
75
|
readonly NAME: "google";
|
|
@@ -88,7 +117,7 @@ export declare const PROVIDER: {
|
|
|
88
117
|
readonly NAME: "xai";
|
|
89
118
|
};
|
|
90
119
|
};
|
|
91
|
-
export type LlmProviderName = typeof PROVIDER.ANTHROPIC.NAME | typeof PROVIDER.BEDROCK.NAME | typeof PROVIDER.
|
|
120
|
+
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;
|
|
92
121
|
export declare const DEFAULT: {
|
|
93
122
|
readonly MODEL: {
|
|
94
123
|
readonly BASE: "gpt-5.4";
|
|
@@ -109,8 +138,8 @@ export declare const DEFAULT: {
|
|
|
109
138
|
};
|
|
110
139
|
export declare const ALL: {
|
|
111
140
|
readonly BASE: readonly ["claude-sonnet-4-6", "gemini-3.1-pro-preview", "gpt-5.4", "grok-latest"];
|
|
112
|
-
readonly COMBINED: readonly ("claude-sonnet-4-6" | "claude-opus-4-8" | "claude-haiku-4-5" | "gemini-3.1-pro-preview" | "gemini-3.5-flash" | "gpt-5.4" | "gpt-5.5" | "gpt-5.4-mini" | "gpt-5.4-nano" | "grok-latest" | "grok-4.3-latest" | "grok-4-1-fast-reasoning" | "grok-4-1-fast-non-reasoning")[];
|
|
141
|
+
readonly COMBINED: readonly ("claude-sonnet-4-6" | "claude-opus-4-8" | "claude-haiku-4-5" | "gemini-3.1-pro-preview" | "gemini-3.5-flash" | "gemini-3.1-flash-lite" | "gpt-5.4" | "gpt-5.5" | "gpt-5.4-mini" | "gpt-5.4-nano" | "grok-latest" | "grok-4.3-latest" | "grok-4-1-fast-reasoning" | "grok-4-1-fast-non-reasoning")[];
|
|
113
142
|
readonly LARGE: readonly ["claude-opus-4-8", "gemini-3.1-pro-preview", "gpt-5.5", "grok-4.3-latest"];
|
|
114
143
|
readonly SMALL: readonly ["claude-sonnet-4-6", "gemini-3.5-flash", "gpt-5.4-mini", "grok-4-1-fast-reasoning"];
|
|
115
|
-
readonly TINY: readonly ["claude-haiku-4-5", "gemini-3.
|
|
144
|
+
readonly TINY: readonly ["claude-haiku-4-5", "gemini-3.1-flash-lite", "gpt-5.4-nano", "grok-4-1-fast-non-reasoning"];
|
|
116
145
|
};
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -22,11 +22,11 @@ const FIRST_CLASS_PROVIDER = {
|
|
|
22
22
|
TINY: "claude-haiku-4-5",
|
|
23
23
|
},
|
|
24
24
|
// https://ai.google.dev/gemini-api/docs/models
|
|
25
|
-
|
|
25
|
+
GOOGLE: {
|
|
26
26
|
DEFAULT: "gemini-3.1-pro-preview",
|
|
27
27
|
LARGE: "gemini-3.1-pro-preview",
|
|
28
28
|
SMALL: "gemini-3.5-flash",
|
|
29
|
-
TINY: "gemini-3.
|
|
29
|
+
TINY: "gemini-3.1-flash-lite",
|
|
30
30
|
},
|
|
31
31
|
// https://developers.openai.com/api/docs/models
|
|
32
32
|
OPENAI: {
|
|
@@ -43,6 +43,39 @@ const FIRST_CLASS_PROVIDER = {
|
|
|
43
43
|
TINY: "grok-4-1-fast-non-reasoning",
|
|
44
44
|
},
|
|
45
45
|
};
|
|
46
|
+
const MODEL = {
|
|
47
|
+
// Anthropic
|
|
48
|
+
OPUS: "claude-opus-4-8",
|
|
49
|
+
SONNET: "claude-sonnet-4-6",
|
|
50
|
+
HAIKU: "claude-haiku-4-5",
|
|
51
|
+
FABLE: "claude-fable-5",
|
|
52
|
+
MYTHOS: "claude-mythos-5",
|
|
53
|
+
// Google
|
|
54
|
+
GEMINI_FLASH: "gemini-3.5-flash",
|
|
55
|
+
GEMINI_FLASH_LITE: "gemini-3.1-flash-lite",
|
|
56
|
+
GEMINI_PRO: "gemini-3.1-pro-preview",
|
|
57
|
+
// OpenAI
|
|
58
|
+
GPT: "gpt-5.5",
|
|
59
|
+
GPT_MINI: "gpt-5.4-mini",
|
|
60
|
+
GPT_NANO: "gpt-5.4-nano",
|
|
61
|
+
// xAI
|
|
62
|
+
GROK: "grok-latest",
|
|
63
|
+
};
|
|
64
|
+
const GOOGLE_PROVIDER = {
|
|
65
|
+
// https://ai.google.dev/gemini-api/docs/models
|
|
66
|
+
MODEL: {
|
|
67
|
+
DEFAULT: FIRST_CLASS_PROVIDER.GOOGLE.DEFAULT,
|
|
68
|
+
LARGE: FIRST_CLASS_PROVIDER.GOOGLE.LARGE,
|
|
69
|
+
SMALL: FIRST_CLASS_PROVIDER.GOOGLE.SMALL,
|
|
70
|
+
TINY: FIRST_CLASS_PROVIDER.GOOGLE.TINY,
|
|
71
|
+
},
|
|
72
|
+
MODEL_MATCH_WORDS: ["gemini", "google"],
|
|
73
|
+
NAME: "google",
|
|
74
|
+
ROLE: {
|
|
75
|
+
MODEL: "model",
|
|
76
|
+
USER: "user",
|
|
77
|
+
},
|
|
78
|
+
};
|
|
46
79
|
const PROVIDER = {
|
|
47
80
|
// https://docs.aws.amazon.com/bedrock/latest/userguide/models-supported.html
|
|
48
81
|
BEDROCK: {
|
|
@@ -96,21 +129,9 @@ const PROVIDER = {
|
|
|
96
129
|
SCHEMA_VERSION: "v2",
|
|
97
130
|
},
|
|
98
131
|
},
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
DEFAULT: FIRST_CLASS_PROVIDER.GEMINI.DEFAULT,
|
|
103
|
-
LARGE: FIRST_CLASS_PROVIDER.GEMINI.LARGE,
|
|
104
|
-
SMALL: FIRST_CLASS_PROVIDER.GEMINI.SMALL,
|
|
105
|
-
TINY: FIRST_CLASS_PROVIDER.GEMINI.TINY,
|
|
106
|
-
},
|
|
107
|
-
MODEL_MATCH_WORDS: ["gemini", "google"],
|
|
108
|
-
NAME: "google",
|
|
109
|
-
ROLE: {
|
|
110
|
-
MODEL: "model",
|
|
111
|
-
USER: "user",
|
|
112
|
-
},
|
|
113
|
-
},
|
|
132
|
+
/** @deprecated Use PROVIDER.GOOGLE — "Google" is the provider; Gemini is the model family */
|
|
133
|
+
GEMINI: GOOGLE_PROVIDER,
|
|
134
|
+
GOOGLE: GOOGLE_PROVIDER,
|
|
114
135
|
OPENAI: {
|
|
115
136
|
// https://platform.openai.com/docs/models
|
|
116
137
|
MODEL: {
|
|
@@ -166,7 +187,7 @@ const DEFAULT = {
|
|
|
166
187
|
const ALL = {
|
|
167
188
|
BASE: [
|
|
168
189
|
PROVIDER.ANTHROPIC.MODEL.DEFAULT,
|
|
169
|
-
PROVIDER.
|
|
190
|
+
PROVIDER.GOOGLE.MODEL.DEFAULT,
|
|
170
191
|
PROVIDER.OPENAI.MODEL.DEFAULT,
|
|
171
192
|
PROVIDER.XAI.MODEL.DEFAULT,
|
|
172
193
|
],
|
|
@@ -176,10 +197,10 @@ const ALL = {
|
|
|
176
197
|
PROVIDER.ANTHROPIC.MODEL.LARGE,
|
|
177
198
|
PROVIDER.ANTHROPIC.MODEL.SMALL,
|
|
178
199
|
PROVIDER.ANTHROPIC.MODEL.TINY,
|
|
179
|
-
PROVIDER.
|
|
180
|
-
PROVIDER.
|
|
181
|
-
PROVIDER.
|
|
182
|
-
PROVIDER.
|
|
200
|
+
PROVIDER.GOOGLE.MODEL.DEFAULT,
|
|
201
|
+
PROVIDER.GOOGLE.MODEL.LARGE,
|
|
202
|
+
PROVIDER.GOOGLE.MODEL.SMALL,
|
|
203
|
+
PROVIDER.GOOGLE.MODEL.TINY,
|
|
183
204
|
PROVIDER.OPENAI.MODEL.DEFAULT,
|
|
184
205
|
PROVIDER.OPENAI.MODEL.LARGE,
|
|
185
206
|
PROVIDER.OPENAI.MODEL.SMALL,
|
|
@@ -192,19 +213,19 @@ const ALL = {
|
|
|
192
213
|
],
|
|
193
214
|
LARGE: [
|
|
194
215
|
PROVIDER.ANTHROPIC.MODEL.LARGE,
|
|
195
|
-
PROVIDER.
|
|
216
|
+
PROVIDER.GOOGLE.MODEL.LARGE,
|
|
196
217
|
PROVIDER.OPENAI.MODEL.LARGE,
|
|
197
218
|
PROVIDER.XAI.MODEL.LARGE,
|
|
198
219
|
],
|
|
199
220
|
SMALL: [
|
|
200
221
|
PROVIDER.ANTHROPIC.MODEL.SMALL,
|
|
201
|
-
PROVIDER.
|
|
222
|
+
PROVIDER.GOOGLE.MODEL.SMALL,
|
|
202
223
|
PROVIDER.OPENAI.MODEL.SMALL,
|
|
203
224
|
PROVIDER.XAI.MODEL.SMALL,
|
|
204
225
|
],
|
|
205
226
|
TINY: [
|
|
206
227
|
PROVIDER.ANTHROPIC.MODEL.TINY,
|
|
207
|
-
PROVIDER.
|
|
228
|
+
PROVIDER.GOOGLE.MODEL.TINY,
|
|
208
229
|
PROVIDER.OPENAI.MODEL.TINY,
|
|
209
230
|
PROVIDER.XAI.MODEL.TINY,
|
|
210
231
|
],
|
|
@@ -214,6 +235,7 @@ var constants = /*#__PURE__*/Object.freeze({
|
|
|
214
235
|
__proto__: null,
|
|
215
236
|
ALL: ALL,
|
|
216
237
|
DEFAULT: DEFAULT,
|
|
238
|
+
MODEL: MODEL,
|
|
217
239
|
PROVIDER: PROVIDER
|
|
218
240
|
});
|
|
219
241
|
|
|
@@ -253,10 +275,10 @@ function determineModelProvider(input) {
|
|
|
253
275
|
provider: PROVIDER.ANTHROPIC.NAME,
|
|
254
276
|
};
|
|
255
277
|
}
|
|
256
|
-
if (input === PROVIDER.
|
|
278
|
+
if (input === PROVIDER.GOOGLE.NAME || input === "gemini") {
|
|
257
279
|
return {
|
|
258
|
-
model: PROVIDER.
|
|
259
|
-
provider: PROVIDER.
|
|
280
|
+
model: PROVIDER.GOOGLE.MODEL.DEFAULT,
|
|
281
|
+
provider: PROVIDER.GOOGLE.NAME,
|
|
260
282
|
};
|
|
261
283
|
}
|
|
262
284
|
if (input === PROVIDER.OPENAI.NAME) {
|
|
@@ -287,11 +309,11 @@ function determineModelProvider(input) {
|
|
|
287
309
|
}
|
|
288
310
|
}
|
|
289
311
|
// Check if input matches a Gemini model exactly
|
|
290
|
-
for (const [, modelValue] of Object.entries(PROVIDER.
|
|
312
|
+
for (const [, modelValue] of Object.entries(PROVIDER.GOOGLE.MODEL)) {
|
|
291
313
|
if (input === modelValue) {
|
|
292
314
|
return {
|
|
293
315
|
model: input,
|
|
294
|
-
provider: PROVIDER.
|
|
316
|
+
provider: PROVIDER.GOOGLE.NAME,
|
|
295
317
|
};
|
|
296
318
|
}
|
|
297
319
|
}
|
|
@@ -350,11 +372,11 @@ function determineModelProvider(input) {
|
|
|
350
372
|
}
|
|
351
373
|
}
|
|
352
374
|
// Check Gemini match words
|
|
353
|
-
for (const matchWord of PROVIDER.
|
|
375
|
+
for (const matchWord of PROVIDER.GOOGLE.MODEL_MATCH_WORDS) {
|
|
354
376
|
if (lowerInput.includes(matchWord)) {
|
|
355
377
|
return {
|
|
356
378
|
model: input,
|
|
357
|
-
provider: PROVIDER.
|
|
379
|
+
provider: PROVIDER.GOOGLE.NAME,
|
|
358
380
|
};
|
|
359
381
|
}
|
|
360
382
|
}
|
|
@@ -2048,8 +2070,7 @@ class BedrockAdapter extends BaseProviderAdapter {
|
|
|
2048
2070
|
if (request.system) {
|
|
2049
2071
|
bedrockRequest.system = [{ text: request.system }];
|
|
2050
2072
|
}
|
|
2051
|
-
if (request.temperature !== undefined &&
|
|
2052
|
-
this.supportsTemperature(model)) {
|
|
2073
|
+
if (request.temperature !== undefined && this.supportsTemperature(model)) {
|
|
2053
2074
|
bedrockRequest.inferenceConfig = {
|
|
2054
2075
|
...bedrockRequest.inferenceConfig,
|
|
2055
2076
|
temperature: request.temperature,
|
|
@@ -2190,10 +2211,7 @@ class BedrockAdapter extends BaseProviderAdapter {
|
|
|
2190
2211
|
return {
|
|
2191
2212
|
...rest,
|
|
2192
2213
|
toolConfig: {
|
|
2193
|
-
tools: [
|
|
2194
|
-
...(rest.toolConfig?.tools ?? []),
|
|
2195
|
-
fakeTool,
|
|
2196
|
-
],
|
|
2214
|
+
tools: [...(rest.toolConfig?.tools ?? []), fakeTool],
|
|
2197
2215
|
},
|
|
2198
2216
|
};
|
|
2199
2217
|
}
|
|
@@ -2417,7 +2435,8 @@ class BedrockAdapter extends BaseProviderAdapter {
|
|
|
2417
2435
|
return this.extractStructuredOutput(response) !== undefined;
|
|
2418
2436
|
}
|
|
2419
2437
|
// Fake-tool path: last content block is a structured_output toolUse
|
|
2420
|
-
const content = (bedrockResponse.output?.message?.content ??
|
|
2438
|
+
const content = (bedrockResponse.output?.message?.content ??
|
|
2439
|
+
[]);
|
|
2421
2440
|
const last = content[content.length - 1];
|
|
2422
2441
|
return (!!last &&
|
|
2423
2442
|
"toolUse" in last &&
|
|
@@ -2426,14 +2445,16 @@ class BedrockAdapter extends BaseProviderAdapter {
|
|
|
2426
2445
|
extractStructuredOutput(response) {
|
|
2427
2446
|
const bedrockResponse = response;
|
|
2428
2447
|
if (bedrockResponse.__jaypieStructuredOutput) {
|
|
2429
|
-
const content = (bedrockResponse.output?.message?.content ??
|
|
2448
|
+
const content = (bedrockResponse.output?.message?.content ??
|
|
2449
|
+
[]);
|
|
2430
2450
|
const textBlock = content.find((b) => "text" in b);
|
|
2431
2451
|
if (!textBlock)
|
|
2432
2452
|
return undefined;
|
|
2433
2453
|
return extractJson(textBlock.text);
|
|
2434
2454
|
}
|
|
2435
2455
|
// Fake-tool path
|
|
2436
|
-
const content = (bedrockResponse.output?.message?.content ??
|
|
2456
|
+
const content = (bedrockResponse.output?.message?.content ??
|
|
2457
|
+
[]);
|
|
2437
2458
|
const last = content[content.length - 1];
|
|
2438
2459
|
if (last &&
|
|
2439
2460
|
"toolUse" in last &&
|
|
@@ -2510,15 +2531,15 @@ const NOT_RETRYABLE_STATUS_CODES = [
|
|
|
2510
2531
|
// Main
|
|
2511
2532
|
//
|
|
2512
2533
|
/**
|
|
2513
|
-
*
|
|
2534
|
+
* GoogleAdapter implements the ProviderAdapter interface for Google's Gemini API.
|
|
2514
2535
|
* It handles request building, response parsing, and error classification
|
|
2515
2536
|
* specific to Gemini's generateContent API.
|
|
2516
2537
|
*/
|
|
2517
|
-
class
|
|
2538
|
+
class GoogleAdapter extends BaseProviderAdapter {
|
|
2518
2539
|
constructor() {
|
|
2519
2540
|
super(...arguments);
|
|
2520
|
-
this.name = PROVIDER.
|
|
2521
|
-
this.defaultModel = PROVIDER.
|
|
2541
|
+
this.name = PROVIDER.GOOGLE.NAME;
|
|
2542
|
+
this.defaultModel = PROVIDER.GOOGLE.MODEL.DEFAULT;
|
|
2522
2543
|
// Session-level cache of Gemini 3 models observed to reject the native
|
|
2523
2544
|
// `responseJsonSchema` + tools combo. When a model is in this set,
|
|
2524
2545
|
// buildRequest engages the legacy fake-tool path instead.
|
|
@@ -2573,7 +2594,7 @@ class GeminiAdapter extends BaseProviderAdapter {
|
|
|
2573
2594
|
? [...request.tools]
|
|
2574
2595
|
: [];
|
|
2575
2596
|
if (request.format && hasUserTools && !useNativeCombo) {
|
|
2576
|
-
log$1.warn(`[
|
|
2597
|
+
log$1.warn(`[GoogleAdapter] Using legacy structured_output tool fallback for model ${geminiRequest.model}; native responseJsonSchema + tools combo is only available on Gemini 3.`);
|
|
2577
2598
|
allTools.push({
|
|
2578
2599
|
name: STRUCTURED_OUTPUT_TOOL_NAME$1,
|
|
2579
2600
|
description: "Output a structured JSON object, " +
|
|
@@ -2704,7 +2725,7 @@ class GeminiAdapter extends BaseProviderAdapter {
|
|
|
2704
2725
|
if (wantsNativeCombo && isStructuredOutputComboUnsupportedError(error)) {
|
|
2705
2726
|
const model = geminiRequest.model;
|
|
2706
2727
|
this.rememberModelRejectsStructuredOutputCombo(model);
|
|
2707
|
-
log$1.warn(`[
|
|
2728
|
+
log$1.warn(`[GoogleAdapter] Model ${model} rejected native responseJsonSchema + tools combo; falling back to legacy structured_output tool emulation.`);
|
|
2708
2729
|
const fallbackRequest = this.toFallbackStructuredOutputRequest(geminiRequest);
|
|
2709
2730
|
const response = await genAI.models.generateContent({
|
|
2710
2731
|
model: fallbackRequest.model,
|
|
@@ -3286,7 +3307,7 @@ class GeminiAdapter extends BaseProviderAdapter {
|
|
|
3286
3307
|
}
|
|
3287
3308
|
}
|
|
3288
3309
|
// Export singleton instance
|
|
3289
|
-
const
|
|
3310
|
+
const googleAdapter = new GoogleAdapter();
|
|
3290
3311
|
|
|
3291
3312
|
// Patterns for OpenAI reasoning models that support extended thinking
|
|
3292
3313
|
const REASONING_MODEL_PATTERNS = [
|
|
@@ -6837,8 +6858,8 @@ function prepareMessages$2(message, { data, placeholders } = {}) {
|
|
|
6837
6858
|
return { messages, systemInstruction: undefined };
|
|
6838
6859
|
}
|
|
6839
6860
|
|
|
6840
|
-
class
|
|
6841
|
-
constructor(model = PROVIDER.
|
|
6861
|
+
class GoogleProvider {
|
|
6862
|
+
constructor(model = PROVIDER.GOOGLE.MODEL.DEFAULT, { apiKey } = {}) {
|
|
6842
6863
|
this.log = getLogger$3();
|
|
6843
6864
|
this.conversationHistory = [];
|
|
6844
6865
|
this.model = model;
|
|
@@ -6857,7 +6878,7 @@ class GeminiProvider {
|
|
|
6857
6878
|
}
|
|
6858
6879
|
const client = await this.getClient();
|
|
6859
6880
|
this._operateLoop = createOperateLoop({
|
|
6860
|
-
adapter:
|
|
6881
|
+
adapter: googleAdapter,
|
|
6861
6882
|
client,
|
|
6862
6883
|
});
|
|
6863
6884
|
return this._operateLoop;
|
|
@@ -6868,7 +6889,7 @@ class GeminiProvider {
|
|
|
6868
6889
|
}
|
|
6869
6890
|
const client = await this.getClient();
|
|
6870
6891
|
this._streamLoop = createStreamLoop({
|
|
6871
|
-
adapter:
|
|
6892
|
+
adapter: googleAdapter,
|
|
6872
6893
|
client,
|
|
6873
6894
|
});
|
|
6874
6895
|
return this._streamLoop;
|
|
@@ -7393,7 +7414,7 @@ class Llm {
|
|
|
7393
7414
|
let finalModel = model;
|
|
7394
7415
|
// Legacy: accept "gemini" but warn
|
|
7395
7416
|
if (providerName === "gemini") {
|
|
7396
|
-
log$1.warn(`Provider "gemini" is deprecated, use "${PROVIDER.
|
|
7417
|
+
log$1.warn(`Provider "gemini" is deprecated, use "${PROVIDER.GOOGLE.NAME}" instead`);
|
|
7397
7418
|
}
|
|
7398
7419
|
if (model) {
|
|
7399
7420
|
const modelDetermined = determineModelProvider(model);
|
|
@@ -7437,8 +7458,8 @@ class Llm {
|
|
|
7437
7458
|
return new AnthropicProvider(model || PROVIDER.ANTHROPIC.MODEL.DEFAULT, { apiKey });
|
|
7438
7459
|
case PROVIDER.BEDROCK.NAME:
|
|
7439
7460
|
return new BedrockProvider(model || PROVIDER.BEDROCK.MODEL.DEFAULT);
|
|
7440
|
-
case PROVIDER.
|
|
7441
|
-
return new
|
|
7461
|
+
case PROVIDER.GOOGLE.NAME:
|
|
7462
|
+
return new GoogleProvider(model || PROVIDER.GOOGLE.MODEL.DEFAULT, {
|
|
7442
7463
|
apiKey,
|
|
7443
7464
|
});
|
|
7444
7465
|
case PROVIDER.OPENAI.NAME:
|
|
@@ -7895,7 +7916,8 @@ const toolkit = new JaypieToolkit(tools);
|
|
|
7895
7916
|
});
|
|
7896
7917
|
|
|
7897
7918
|
exports.BedrockProvider = BedrockProvider;
|
|
7898
|
-
exports.GeminiProvider =
|
|
7919
|
+
exports.GeminiProvider = GoogleProvider;
|
|
7920
|
+
exports.GoogleProvider = GoogleProvider;
|
|
7899
7921
|
exports.JaypieToolkit = JaypieToolkit;
|
|
7900
7922
|
exports.LLM = constants;
|
|
7901
7923
|
exports.Llm = Llm;
|