@byfriends/kosong 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.
@@ -0,0 +1,2 @@
1
+ import { a as convertGoogleGenAIError, i as GoogleGenAIStreamedMessage, n as GoogleGenAIGenerationKwargs, o as messagesToGoogleGenAIContents, r as GoogleGenAIOptions, t as GoogleGenAIChatProvider } from "../google-genai-hX0X6CF3.mjs";
2
+ export { GoogleGenAIChatProvider, GoogleGenAIGenerationKwargs, GoogleGenAIOptions, GoogleGenAIStreamedMessage, convertGoogleGenAIError, messagesToGoogleGenAIContents };
@@ -0,0 +1,562 @@
1
+ import { a as APITimeoutError, o as ChatProviderError, s as normalizeAPIStatusError, t as APIConnectionError } from "../errors-WFxxzL1B.mjs";
2
+ import { n as requireProviderApiKey, r as resolveAuthBackedClient } from "../request-auth-DCWSyCKI.mjs";
3
+ import { n as getGoogleGenAIModelCapability } from "../capability-registry-CMBuEYcf.mjs";
4
+ import { ApiError, GoogleGenAI } from "@google/genai";
5
+ //#region src/providers/google-genai.ts
6
+ /**
7
+ * Normalize a Google GenAI (Gemini) `finishReason` value to the unified
8
+ * {@link FinishReason} enum.
9
+ *
10
+ * Source: `candidates[0].finishReason` (works for both stream and
11
+ * non-stream — the SDK normalizes them). Gemini does not emit a
12
+ * `tool_calls`-style reason; tool calls come via `parts[].functionCall`
13
+ * and `finishReason` stays `'completed'` even when the model produces
14
+ * function calls.
15
+ */
16
+ function normalizeGoogleGenAIFinishReason(raw) {
17
+ if (raw === null || raw === void 0) return {
18
+ finishReason: null,
19
+ rawFinishReason: null
20
+ };
21
+ let rawString;
22
+ if (typeof raw === "string") rawString = raw.toUpperCase();
23
+ else if (typeof raw === "number" || typeof raw === "bigint" || typeof raw === "boolean") rawString = String(raw).toUpperCase();
24
+ else return {
25
+ finishReason: null,
26
+ rawFinishReason: null
27
+ };
28
+ if (rawString === "FINISH_REASON_UNSPECIFIED" || rawString === "") return {
29
+ finishReason: null,
30
+ rawFinishReason: null
31
+ };
32
+ switch (rawString) {
33
+ case "STOP": return {
34
+ finishReason: "completed",
35
+ rawFinishReason: rawString
36
+ };
37
+ case "MAX_TOKENS": return {
38
+ finishReason: "truncated",
39
+ rawFinishReason: rawString
40
+ };
41
+ case "SAFETY":
42
+ case "RECITATION":
43
+ case "BLOCKLIST":
44
+ case "PROHIBITED_CONTENT":
45
+ case "SPII":
46
+ case "IMAGE_SAFETY": return {
47
+ finishReason: "filtered",
48
+ rawFinishReason: rawString
49
+ };
50
+ case "MALFORMED_FUNCTION_CALL":
51
+ case "OTHER":
52
+ case "LANGUAGE": return {
53
+ finishReason: "other",
54
+ rawFinishReason: rawString
55
+ };
56
+ default: return {
57
+ finishReason: "other",
58
+ rawFinishReason: rawString
59
+ };
60
+ }
61
+ }
62
+ function toolToGoogleGenAI(tool) {
63
+ return { function_declarations: [{
64
+ name: tool.name,
65
+ description: tool.description,
66
+ parameters_json_schema: tool.parameters
67
+ }] };
68
+ }
69
+ function toolCallIdToName(toolCallId, toolNameById) {
70
+ const name = toolNameById.get(toolCallId);
71
+ if (name !== void 0) return name;
72
+ return /^(.+)_[^_]+$/.exec(toolCallId)?.[1] ?? toolCallId;
73
+ }
74
+ /**
75
+ * Convert a data URL or HTTP URL to a Google GenAI inline/file data part.
76
+ * - data: URLs are parsed into { inlineData: { mimeType, data } }
77
+ * - http(s): URLs use { fileData: { fileUri, mimeType } }
78
+ */
79
+ function convertMediaUrl(url, fallbackMimeType) {
80
+ if (url.startsWith("data:")) {
81
+ const commaIndex = url.indexOf(",");
82
+ if (commaIndex === -1) return { fileData: {
83
+ fileUri: url,
84
+ mimeType: fallbackMimeType
85
+ } };
86
+ const meta = url.slice(0, commaIndex);
87
+ const data = url.slice(commaIndex + 1);
88
+ const colonIndex = meta.indexOf(":");
89
+ const semiIndex = meta.indexOf(";");
90
+ return { inlineData: {
91
+ mimeType: colonIndex !== -1 && semiIndex !== -1 ? meta.slice(colonIndex + 1, semiIndex) : fallbackMimeType,
92
+ data
93
+ } };
94
+ }
95
+ let mimeType = fallbackMimeType;
96
+ try {
97
+ const pathname = new URL(url).pathname.toLowerCase();
98
+ if (pathname.endsWith(".png")) mimeType = "image/png";
99
+ else if (pathname.endsWith(".jpg") || pathname.endsWith(".jpeg")) mimeType = "image/jpeg";
100
+ else if (pathname.endsWith(".gif")) mimeType = "image/gif";
101
+ else if (pathname.endsWith(".webp")) mimeType = "image/webp";
102
+ else if (pathname.endsWith(".mp3") || pathname.endsWith(".mpeg")) mimeType = "audio/mpeg";
103
+ else if (pathname.endsWith(".wav")) mimeType = "audio/wav";
104
+ else if (pathname.endsWith(".ogg")) mimeType = "audio/ogg";
105
+ } catch {}
106
+ return { fileData: {
107
+ fileUri: url,
108
+ mimeType
109
+ } };
110
+ }
111
+ function createAbortError() {
112
+ return new DOMException("The operation was aborted.", "AbortError");
113
+ }
114
+ async function abortPromise(signal) {
115
+ if (signal === void 0) return new Promise(() => {});
116
+ if (signal.aborted) throw createAbortError();
117
+ return new Promise((_, reject) => {
118
+ signal.addEventListener("abort", () => {
119
+ reject(createAbortError());
120
+ }, { once: true });
121
+ });
122
+ }
123
+ function messageToGoogleGenAI(message) {
124
+ if (message.role === "tool") throw new ChatProviderError("Tool messages must be converted via messagesToGoogleGenAIContents.");
125
+ const role = message.role === "assistant" ? "model" : message.role;
126
+ const parts = [];
127
+ for (const part of message.content) switch (part.type) {
128
+ case "text":
129
+ parts.push({ text: part.text });
130
+ break;
131
+ case "think": break;
132
+ case "image_url":
133
+ parts.push(convertMediaUrl(part.imageUrl.url, "image/jpeg"));
134
+ break;
135
+ case "audio_url":
136
+ parts.push(convertMediaUrl(part.audioUrl.url, "audio/mpeg"));
137
+ break;
138
+ case "video_url":
139
+ parts.push(convertMediaUrl(part.videoUrl.url, "video/mp4"));
140
+ break;
141
+ }
142
+ for (const toolCall of message.toolCalls) {
143
+ let args = {};
144
+ if (toolCall.arguments) try {
145
+ const parsed = JSON.parse(toolCall.arguments);
146
+ if (typeof parsed === "object" && parsed !== null && !Array.isArray(parsed)) args = parsed;
147
+ else throw new ChatProviderError("Tool call arguments must be a JSON object.");
148
+ } catch (error) {
149
+ if (error instanceof ChatProviderError) throw error;
150
+ throw new ChatProviderError("Tool call arguments must be valid JSON.");
151
+ }
152
+ const functionCallPart = { function_call: {
153
+ name: toolCall.name,
154
+ args
155
+ } };
156
+ if (toolCall.extras && "thought_signature_b64" in toolCall.extras) functionCallPart["thought_signature"] = toolCall.extras["thought_signature_b64"];
157
+ parts.push(functionCallPart);
158
+ }
159
+ return {
160
+ role,
161
+ parts
162
+ };
163
+ }
164
+ /**
165
+ * Convert a tool message into a list of Google GenAI parts.
166
+ *
167
+ * Returns a `functionResponse` part carrying the text output, followed by
168
+ * independent media parts (`inlineData` / `fileData`) for any image/audio/video
169
+ * content in the tool result. This preserves multimodal tool outputs so the
170
+ * next Gemini/Vertex turn can see them — returning only the text would silently
171
+ * drop media and break tool chains that rely on images or audio.
172
+ */
173
+ function toolMessageToFunctionResponseParts(message, toolNameById) {
174
+ if (message.role !== "tool") throw new ChatProviderError("Expected a tool message.");
175
+ if (message.toolCallId === void 0) throw new ChatProviderError("Tool response is missing `toolCallId`.");
176
+ let textOutput = "";
177
+ const mediaParts = [];
178
+ for (const part of message.content) switch (part.type) {
179
+ case "text":
180
+ if (part.text) textOutput += part.text;
181
+ break;
182
+ case "image_url":
183
+ mediaParts.push(convertMediaUrl(part.imageUrl.url, "image/jpeg"));
184
+ break;
185
+ case "audio_url":
186
+ mediaParts.push(convertMediaUrl(part.audioUrl.url, "audio/mpeg"));
187
+ break;
188
+ case "video_url":
189
+ mediaParts.push(convertMediaUrl(part.videoUrl.url, "video/mp4"));
190
+ break;
191
+ case "think": break;
192
+ }
193
+ return [{ function_response: {
194
+ name: toolCallIdToName(message.toolCallId, toolNameById),
195
+ response: { output: textOutput },
196
+ parts: []
197
+ } }, ...mediaParts];
198
+ }
199
+ function messagesToGoogleGenAIContents(messages) {
200
+ const contents = [];
201
+ const toolNameById = /* @__PURE__ */ new Map();
202
+ let i = 0;
203
+ while (i < messages.length) {
204
+ const message = messages[i];
205
+ if (message === void 0) break;
206
+ if (message.role === "system") {
207
+ const text = message.content.filter((p) => p.type === "text").map((p) => p.text).join("\n");
208
+ if (text.length > 0) contents.push({
209
+ role: "user",
210
+ parts: [{ text: `<system>${text}</system>` }]
211
+ });
212
+ i += 1;
213
+ continue;
214
+ }
215
+ if (message.role === "assistant" && message.toolCalls.length > 0) {
216
+ contents.push(messageToGoogleGenAI(message));
217
+ const expectedToolCallIds = [];
218
+ for (const toolCall of message.toolCalls) {
219
+ toolNameById.set(toolCall.id, toolCall.name);
220
+ expectedToolCallIds.push(toolCall.id);
221
+ }
222
+ let j = i + 1;
223
+ const toolMessages = [];
224
+ while (j < messages.length) {
225
+ const toolMsg = messages[j];
226
+ if (toolMsg === void 0 || toolMsg.role !== "tool") break;
227
+ toolMessages.push(toolMsg);
228
+ j += 1;
229
+ }
230
+ if (toolMessages.length > 0) {
231
+ const toolMsgById = /* @__PURE__ */ new Map();
232
+ const seenToolCallIds = /* @__PURE__ */ new Set();
233
+ for (const toolMsg of toolMessages) {
234
+ if (toolMsg.toolCallId === void 0) throw new ChatProviderError("Tool response is missing `toolCallId`.");
235
+ if (seenToolCallIds.has(toolMsg.toolCallId)) throw new ChatProviderError(`Duplicate tool response for id: ${toolMsg.toolCallId}`);
236
+ seenToolCallIds.add(toolMsg.toolCallId);
237
+ toolMsgById.set(toolMsg.toolCallId, toolMsg);
238
+ }
239
+ const sortedToolMessages = [];
240
+ for (const expectedId of expectedToolCallIds) {
241
+ const msg = toolMsgById.get(expectedId);
242
+ if (msg === void 0) throw new ChatProviderError(`Missing tool responses for ids: ${expectedId}`);
243
+ sortedToolMessages.push(msg);
244
+ toolMsgById.delete(expectedId);
245
+ }
246
+ if (toolMsgById.size > 0) throw new ChatProviderError(`Unexpected tool responses for ids: ${JSON.stringify([...toolMsgById.keys()])}`);
247
+ const parts = [];
248
+ for (const toolMsg of sortedToolMessages) parts.push(...toolMessageToFunctionResponseParts(toolMsg, toolNameById));
249
+ contents.push({
250
+ role: "user",
251
+ parts
252
+ });
253
+ i = j;
254
+ continue;
255
+ }
256
+ i += 1;
257
+ continue;
258
+ }
259
+ if (message.role === "tool") {
260
+ const parts = toolMessageToFunctionResponseParts(message, toolNameById);
261
+ contents.push({
262
+ role: "user",
263
+ parts
264
+ });
265
+ i += 1;
266
+ continue;
267
+ }
268
+ contents.push(messageToGoogleGenAI(message));
269
+ i += 1;
270
+ }
271
+ return contents;
272
+ }
273
+ var GoogleGenAIStreamedMessage = class {
274
+ _id = null;
275
+ _usage = null;
276
+ _finishReason = null;
277
+ _rawFinishReason = null;
278
+ _iter;
279
+ constructor(response, isStream, signal) {
280
+ if (isStream) this._iter = this._convertStreamResponse(response, signal);
281
+ else this._iter = this._convertNonStreamResponse(response, signal);
282
+ }
283
+ get id() {
284
+ return this._id;
285
+ }
286
+ get usage() {
287
+ return this._usage;
288
+ }
289
+ get finishReason() {
290
+ return this._finishReason;
291
+ }
292
+ get rawFinishReason() {
293
+ return this._rawFinishReason;
294
+ }
295
+ async *[Symbol.asyncIterator]() {
296
+ yield* this._iter;
297
+ }
298
+ _captureFinishReason(response) {
299
+ const candidates = response["candidates"];
300
+ if (!candidates || candidates.length === 0) return;
301
+ const first = candidates[0];
302
+ if (first === void 0) return;
303
+ const raw = first["finishReason"] ?? first["finish_reason"];
304
+ if (raw === void 0) return;
305
+ const normalized = normalizeGoogleGenAIFinishReason(raw);
306
+ if (normalized.finishReason !== null || normalized.rawFinishReason !== null) {
307
+ this._finishReason = normalized.finishReason;
308
+ this._rawFinishReason = normalized.rawFinishReason;
309
+ }
310
+ }
311
+ /** Yield parts from a single (non-streamed) GenerateContentResponse. */
312
+ _extractChunkParts(response) {
313
+ const parts = [];
314
+ const candidates = response["candidates"];
315
+ for (const candidate of candidates ?? []) {
316
+ const contentParts = candidate["content"]?.["parts"];
317
+ if (!contentParts) continue;
318
+ for (const part of contentParts) {
319
+ const p = part;
320
+ if (p["thought"] === true && p["text"]) parts.push({
321
+ type: "think",
322
+ think: p["text"]
323
+ });
324
+ else if (p["text"]) parts.push({
325
+ type: "text",
326
+ text: p["text"]
327
+ });
328
+ else if (p["functionCall"] || p["function_call"]) {
329
+ const fc = p["functionCall"] ?? p["function_call"];
330
+ const name = fc["name"];
331
+ if (!name) continue;
332
+ const toolCallId = `${name}_${fc["id"] ?? crypto.randomUUID()}`;
333
+ const thoughtSigB64 = p["thoughtSignature"] ?? p["thought_signature"];
334
+ parts.push({
335
+ type: "function",
336
+ id: toolCallId,
337
+ name,
338
+ arguments: fc["args"] ? JSON.stringify(fc["args"]) : "{}",
339
+ ...thoughtSigB64 ? { extras: { thought_signature_b64: thoughtSigB64 } } : {}
340
+ });
341
+ }
342
+ }
343
+ }
344
+ return parts;
345
+ }
346
+ /** Extract usage metadata from a response chunk. */
347
+ _extractUsage(response) {
348
+ const usageMetadata = response["usageMetadata"];
349
+ if (usageMetadata) {
350
+ const promptTokenCount = typeof usageMetadata["promptTokenCount"] === "number" ? usageMetadata["promptTokenCount"] : 0;
351
+ const cachedContentTokenCount = typeof usageMetadata["cachedContentTokenCount"] === "number" ? usageMetadata["cachedContentTokenCount"] : 0;
352
+ this._usage = {
353
+ inputOther: Math.max(promptTokenCount - cachedContentTokenCount, 0),
354
+ output: usageMetadata["candidatesTokenCount"] ?? 0,
355
+ inputCacheRead: cachedContentTokenCount,
356
+ inputCacheCreation: 0
357
+ };
358
+ }
359
+ }
360
+ /** Extract response ID from a response chunk. */
361
+ _extractId(response) {
362
+ if (response["responseId"] !== void 0) this._id = response["responseId"];
363
+ }
364
+ _throwIfAborted(signal) {
365
+ if (signal !== void 0 && signal.aborted) throw createAbortError();
366
+ }
367
+ async *_convertNonStreamResponse(response, signal) {
368
+ this._throwIfAborted(signal);
369
+ this._extractUsage(response);
370
+ this._extractId(response);
371
+ this._captureFinishReason(response);
372
+ for (const part of this._extractChunkParts(response)) {
373
+ this._throwIfAborted(signal);
374
+ yield part;
375
+ }
376
+ }
377
+ async *_convertStreamResponse(response, signal) {
378
+ try {
379
+ for await (const chunk of response) {
380
+ this._throwIfAborted(signal);
381
+ this._extractUsage(chunk);
382
+ this._extractId(chunk);
383
+ this._captureFinishReason(chunk);
384
+ for (const part of this._extractChunkParts(chunk)) {
385
+ this._throwIfAborted(signal);
386
+ yield part;
387
+ }
388
+ }
389
+ } catch (error) {
390
+ if (error instanceof DOMException && error.name === "AbortError") throw error;
391
+ throw convertGoogleGenAIError(error);
392
+ }
393
+ }
394
+ };
395
+ const NETWORK_RE = /network|connection|connect|disconnect|fetch failed/i;
396
+ const TIMEOUT_RE = /timed?\s*out|timeout|deadline/i;
397
+ /**
398
+ * Convert a Google GenAI SDK error (or raw Error) to a kosong `ChatProviderError`.
399
+ */
400
+ function convertGoogleGenAIError(error) {
401
+ if (error instanceof ApiError) return normalizeAPIStatusError(error.status, error.message);
402
+ if (error instanceof Error) {
403
+ const msg = error.message;
404
+ if (TIMEOUT_RE.test(msg)) return new APITimeoutError(msg);
405
+ if (NETWORK_RE.test(msg) || error instanceof TypeError && msg.includes("fetch")) return new APIConnectionError(msg);
406
+ const statusCode = error.code;
407
+ if (typeof statusCode === "number") return normalizeAPIStatusError(statusCode, msg);
408
+ return new ChatProviderError(`GoogleGenAI error: ${msg}`);
409
+ }
410
+ return new ChatProviderError(`GoogleGenAI error: ${String(error)}`);
411
+ }
412
+ var GoogleGenAIChatProvider = class {
413
+ name = "google_genai";
414
+ _model;
415
+ _client;
416
+ _generationKwargs;
417
+ _vertexai;
418
+ _stream;
419
+ _apiKey;
420
+ _project;
421
+ _location;
422
+ _clientFactory;
423
+ constructor(options) {
424
+ this._model = options.model;
425
+ this._vertexai = options.vertexai ?? false;
426
+ this._stream = options.stream ?? true;
427
+ this._generationKwargs = {};
428
+ const apiKey = options.apiKey ?? process.env["GOOGLE_API_KEY"];
429
+ this._apiKey = apiKey === void 0 || apiKey.length === 0 ? void 0 : apiKey;
430
+ this._project = options.project;
431
+ this._location = options.location;
432
+ this._clientFactory = options.clientFactory;
433
+ this._client = this._vertexai || this._apiKey !== void 0 ? this._buildClient(this._apiKey) : void 0;
434
+ }
435
+ _buildClient(apiKey) {
436
+ return new GoogleGenAI({
437
+ apiKey,
438
+ ...this._vertexai ? {
439
+ vertexai: true,
440
+ project: this._project,
441
+ location: this._location
442
+ } : {}
443
+ });
444
+ }
445
+ get modelName() {
446
+ return this._model;
447
+ }
448
+ get thinkingEffort() {
449
+ const thinkingConfig = this._generationKwargs.thinking_config;
450
+ if (thinkingConfig === void 0) return null;
451
+ if (thinkingConfig.thinking_level !== void 0) switch (thinkingConfig.thinking_level) {
452
+ case "MINIMAL": return thinkingConfig.include_thoughts === false ? "off" : "low";
453
+ case "LOW": return "low";
454
+ case "MEDIUM": return "medium";
455
+ case "HIGH": return "high";
456
+ default: return null;
457
+ }
458
+ if (thinkingConfig.thinking_budget !== void 0) {
459
+ if (thinkingConfig.thinking_budget === 0) return "off";
460
+ if (thinkingConfig.thinking_budget <= 1024) return "low";
461
+ if (thinkingConfig.thinking_budget <= 4096) return "medium";
462
+ return "high";
463
+ }
464
+ return null;
465
+ }
466
+ get modelParameters() {
467
+ return {
468
+ model: this._model,
469
+ ...this._generationKwargs
470
+ };
471
+ }
472
+ getCapability(model) {
473
+ return getGoogleGenAIModelCapability(model ?? this._model);
474
+ }
475
+ async generate(systemPrompt, tools, history, options) {
476
+ if (options?.signal?.aborted === true) throw createAbortError();
477
+ const contents = messagesToGoogleGenAIContents(history);
478
+ const config = {
479
+ ...this._generationKwargs,
480
+ system_instruction: systemPrompt,
481
+ ...tools.length > 0 ? { tools: tools.map((t) => toolToGoogleGenAI(t)) } : {}
482
+ };
483
+ try {
484
+ const models = this._createClient(options?.auth).models;
485
+ const params = {
486
+ model: this._model,
487
+ contents,
488
+ config
489
+ };
490
+ if (this._stream) return new GoogleGenAIStreamedMessage(await Promise.race([models.generateContentStream(params), abortPromise(options?.signal)]), true, options?.signal);
491
+ return new GoogleGenAIStreamedMessage(await Promise.race([models.generateContent(params), abortPromise(options?.signal)]), false, options?.signal);
492
+ } catch (error) {
493
+ if (error instanceof DOMException && error.name === "AbortError") throw error;
494
+ throw convertGoogleGenAIError(error);
495
+ }
496
+ }
497
+ _createClient(auth) {
498
+ return resolveAuthBackedClient({
499
+ cachedClient: this._client,
500
+ clientFactory: this._clientFactory
501
+ }, auth, (a) => {
502
+ if (this._vertexai) return this._buildClient(this._apiKey);
503
+ return this._buildClient(requireProviderApiKey("GoogleGenAIChatProvider", a, this._apiKey));
504
+ });
505
+ }
506
+ withThinking(effort) {
507
+ const thinkingConfig = { include_thoughts: true };
508
+ if (this._model.includes("gemini-3")) switch (effort) {
509
+ case "off":
510
+ thinkingConfig.thinking_level = "MINIMAL";
511
+ thinkingConfig.include_thoughts = false;
512
+ break;
513
+ case "low":
514
+ thinkingConfig.thinking_level = "LOW";
515
+ break;
516
+ case "medium":
517
+ thinkingConfig.thinking_level = "MEDIUM";
518
+ break;
519
+ case "high":
520
+ case "xhigh":
521
+ case "max":
522
+ thinkingConfig.thinking_level = "HIGH";
523
+ break;
524
+ }
525
+ else switch (effort) {
526
+ case "off":
527
+ thinkingConfig.thinking_budget = 0;
528
+ thinkingConfig.include_thoughts = false;
529
+ break;
530
+ case "low":
531
+ thinkingConfig.thinking_budget = 1024;
532
+ thinkingConfig.include_thoughts = true;
533
+ break;
534
+ case "medium":
535
+ thinkingConfig.thinking_budget = 4096;
536
+ thinkingConfig.include_thoughts = true;
537
+ break;
538
+ case "high":
539
+ case "xhigh":
540
+ case "max":
541
+ thinkingConfig.thinking_budget = 32e3;
542
+ thinkingConfig.include_thoughts = true;
543
+ break;
544
+ }
545
+ return this.withGenerationKwargs({ thinking_config: thinkingConfig });
546
+ }
547
+ withGenerationKwargs(kwargs) {
548
+ const clone = this._clone();
549
+ clone._generationKwargs = {
550
+ ...clone._generationKwargs,
551
+ ...kwargs
552
+ };
553
+ return clone;
554
+ }
555
+ _clone() {
556
+ const clone = Object.assign(Object.create(Object.getPrototypeOf(this)), this);
557
+ clone._generationKwargs = { ...this._generationKwargs };
558
+ return clone;
559
+ }
560
+ };
561
+ //#endregion
562
+ export { GoogleGenAIChatProvider, GoogleGenAIStreamedMessage, convertGoogleGenAIError, messagesToGoogleGenAIContents };
@@ -0,0 +1,2 @@
1
+ import { a as convertContentPart, c as extractUsage, d as reasoningEffortToThinkingEffort, f as thinkingEffortToReasoningEffort, i as ToolMessageConversion, l as isFunctionToolCall, n as OpenAIContentPart, o as convertOpenAIError, p as toolToOpenAI, r as OpenAIToolParam, s as convertToolMessageContent, t as FunctionToolCallShape, u as normalizeOpenAIFinishReason } from "../openai-common-B6cK2ig3.mjs";
2
+ export { FunctionToolCallShape, OpenAIContentPart, OpenAIToolParam, ToolMessageConversion, convertContentPart, convertOpenAIError, convertToolMessageContent, extractUsage, isFunctionToolCall, normalizeOpenAIFinishReason, reasoningEffortToThinkingEffort, thinkingEffortToReasoningEffort, toolToOpenAI };
@@ -0,0 +1,2 @@
1
+ import { a as isFunctionToolCall, c as thinkingEffortToReasoningEffort, i as extractUsage, l as toolToOpenAI, n as convertOpenAIError, o as normalizeOpenAIFinishReason, r as convertToolMessageContent, s as reasoningEffortToThinkingEffort, t as convertContentPart } from "../openai-common-08qin3UI.mjs";
2
+ export { convertContentPart, convertOpenAIError, convertToolMessageContent, extractUsage, isFunctionToolCall, normalizeOpenAIFinishReason, reasoningEffortToThinkingEffort, thinkingEffortToReasoningEffort, toolToOpenAI };
@@ -0,0 +1,2 @@
1
+ import { a as ThinkingConfig, i as OpenAICompatOptions, n as GenerationKwargs, o as extractUsageFromChunk, r as OpenAICompatChatProvider, t as ExtraBody } from "../openai-compat-CMrIk-ib.mjs";
2
+ export { ExtraBody, GenerationKwargs, OpenAICompatChatProvider, OpenAICompatOptions, ThinkingConfig, extractUsageFromChunk };
@@ -0,0 +1,2 @@
1
+ import { n as extractUsageFromChunk, t as OpenAICompatChatProvider } from "../openai-compat-CWbwO4b7.mjs";
2
+ export { OpenAICompatChatProvider, extractUsageFromChunk };
@@ -0,0 +1,2 @@
1
+ import { i as OpenAILegacyStreamedMessage, n as OpenAILegacyGenerationKwargs, r as OpenAILegacyOptions, t as OpenAILegacyChatProvider } from "../openai-legacy-B6CVfLlr.mjs";
2
+ export { OpenAILegacyChatProvider, OpenAILegacyGenerationKwargs, OpenAILegacyOptions, OpenAILegacyStreamedMessage };