@depup/ai-sdk__google 4.0.58-depup.0 → 4.0.61-depup.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.
- package/CHANGELOG.md +21 -0
- package/README.md +2 -2
- package/changes.json +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.js +54 -29
- package/dist/index.js.map +1 -1
- package/dist/internal/index.js +42 -23
- package/dist/internal/index.js.map +1 -1
- package/docs/15-google.mdx +32 -7
- package/package.json +5 -5
- package/src/google-batch.ts +1 -1
- package/src/google-files.ts +8 -2
- package/src/interactions/google-interactions-language-model-options.ts +12 -2
- package/src/interactions/google-interactions-language-model.ts +11 -0
- package/src/interactions/google-interactions-prompt.ts +15 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @ai-sdk/google
|
|
2
2
|
|
|
3
|
+
## 4.0.61
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5190b67: feat(provider): extend the FilesV4 interface with optional `getFileMetadata`, `downloadFile` (streaming), and `deleteFile` operations, plus `abortSignal`/`headers` call options and a `{ type: 'stream' }` upload data variant; upload results now expose `byteSize`, `createdAt`, and `expiresAt` (also surfaced by the core `uploadFile()` helper, which now forwards `abortSignal`/`headers`); add `postMultipartStreamToApi` (streaming multipart uploads with deterministic part ordering and failure-path stream teardown), `deleteFromApi`, and `createBinaryStreamResponseHandler` to provider-utils
|
|
8
|
+
- Updated dependencies [5190b67]
|
|
9
|
+
- @ai-sdk/provider@4.0.10
|
|
10
|
+
- @ai-sdk/provider-utils@5.0.35
|
|
11
|
+
|
|
12
|
+
## 4.0.60
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- e07b577: feat: add tool calling support to batch
|
|
17
|
+
|
|
18
|
+
## 4.0.59
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- ca29e9b: fix(google): support video response formats in Gemini Interactions
|
|
23
|
+
|
|
3
24
|
## 4.0.58
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -13,8 +13,8 @@ npm install @depup/ai-sdk__google
|
|
|
13
13
|
|
|
14
14
|
| Field | Value |
|
|
15
15
|
|-------|-------|
|
|
16
|
-
| Original | [@ai-sdk/google](https://www.npmjs.com/package/@ai-sdk/google) @ 4.0.
|
|
17
|
-
| Processed | 2026-
|
|
16
|
+
| Original | [@ai-sdk/google](https://www.npmjs.com/package/@ai-sdk/google) @ 4.0.61 |
|
|
17
|
+
| Processed | 2026-09-02 |
|
|
18
18
|
| Smoke test | failed |
|
|
19
19
|
| Deps updated | 0 |
|
|
20
20
|
|
package/changes.json
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -358,6 +358,14 @@ declare const googleInteractionsLanguageModelOptions: _ai_sdk_provider_utils.Laz
|
|
|
358
358
|
[x: string]: unknown;
|
|
359
359
|
type: "audio";
|
|
360
360
|
mimeType?: string | null | undefined;
|
|
361
|
+
} | {
|
|
362
|
+
[x: string]: unknown;
|
|
363
|
+
type: "video";
|
|
364
|
+
aspectRatio?: "9:16" | "16:9" | null | undefined;
|
|
365
|
+
resolution?: "360p" | "720p" | "1080p" | "4k" | null | undefined;
|
|
366
|
+
duration?: string | null | undefined;
|
|
367
|
+
delivery?: "uri" | "inline" | null | undefined;
|
|
368
|
+
gcsUri?: string | null | undefined;
|
|
361
369
|
})[] | null | undefined;
|
|
362
370
|
imageConfig?: {
|
|
363
371
|
aspectRatio?: "1:1" | "2:3" | "3:2" | "3:4" | "4:3" | "4:5" | "5:4" | "9:16" | "16:9" | "21:9" | "1:8" | "8:1" | "1:4" | "4:1" | null | undefined;
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "@ai-sdk/provider-utils";
|
|
8
8
|
|
|
9
9
|
// src/version.ts
|
|
10
|
-
var VERSION = true ? "4.0.
|
|
10
|
+
var VERSION = true ? "4.0.61" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -3024,7 +3024,7 @@ var chunkSchema = lazySchema5(
|
|
|
3024
3024
|
// src/google-batch.ts
|
|
3025
3025
|
var googleBatchInputFileMaxBytes = 2 * 1024 * 1024 * 1024;
|
|
3026
3026
|
var googleBatchInlineCreationMaxBytes = 2e7;
|
|
3027
|
-
var supportedGoogleBatchContentTypes = /* @__PURE__ */ new Set(["text", "reasoning", "source"]);
|
|
3027
|
+
var supportedGoogleBatchContentTypes = /* @__PURE__ */ new Set(["text", "reasoning", "source", "tool-call", "tool-result"]);
|
|
3028
3028
|
var googleRpcStatusSchema = z6.object({
|
|
3029
3029
|
code: z6.union([z6.number(), z6.string()]).nullish(),
|
|
3030
3030
|
message: z6.string().nullish(),
|
|
@@ -3927,7 +3927,10 @@ var GoogleFiles = class {
|
|
|
3927
3927
|
providerOptions: options.providerOptions,
|
|
3928
3928
|
schema: googleFilesUploadOptionsSchema
|
|
3929
3929
|
});
|
|
3930
|
-
const resolvedHeaders =
|
|
3930
|
+
const resolvedHeaders = combineHeaders4(
|
|
3931
|
+
this.config.headers(),
|
|
3932
|
+
options.headers
|
|
3933
|
+
);
|
|
3931
3934
|
const fetchFn = (_a = this.config.fetch) != null ? _a : globalThis.fetch;
|
|
3932
3935
|
const warnings = [];
|
|
3933
3936
|
if (options.filename != null) {
|
|
@@ -3951,7 +3954,8 @@ var GoogleFiles = class {
|
|
|
3951
3954
|
file: {
|
|
3952
3955
|
...displayName != null ? { display_name: displayName } : {}
|
|
3953
3956
|
}
|
|
3954
|
-
})
|
|
3957
|
+
}),
|
|
3958
|
+
signal: options.abortSignal
|
|
3955
3959
|
});
|
|
3956
3960
|
if (!initResponse.ok) {
|
|
3957
3961
|
const errorBody = await initResponse.text();
|
|
@@ -3973,7 +3977,8 @@ var GoogleFiles = class {
|
|
|
3973
3977
|
"X-Goog-Upload-Offset": "0",
|
|
3974
3978
|
"X-Goog-Upload-Command": "upload, finalize"
|
|
3975
3979
|
},
|
|
3976
|
-
body: ensureArrayBufferBacked(fileBytes)
|
|
3980
|
+
body: ensureArrayBufferBacked(fileBytes),
|
|
3981
|
+
signal: options.abortSignal
|
|
3977
3982
|
});
|
|
3978
3983
|
if (!uploadResponse.ok) {
|
|
3979
3984
|
const errorBody = await uploadResponse.text();
|
|
@@ -3994,7 +3999,7 @@ var GoogleFiles = class {
|
|
|
3994
3999
|
message: `File processing timed out after ${pollTimeoutMs}ms`
|
|
3995
4000
|
});
|
|
3996
4001
|
}
|
|
3997
|
-
await delay(pollIntervalMs);
|
|
4002
|
+
await delay(pollIntervalMs, { abortSignal: options.abortSignal });
|
|
3998
4003
|
const fileNameMatch = /^files\/([^/]+)$/.exec(file.name);
|
|
3999
4004
|
const filePath = fileNameMatch != null ? `files/${encodePathSegment(fileNameMatch[1])}` : encodePathSegment(file.name);
|
|
4000
4005
|
const { value: fileStatus } = await getFromApi2({
|
|
@@ -4005,6 +4010,7 @@ var GoogleFiles = class {
|
|
|
4005
4010
|
googleFileResponseSchema
|
|
4006
4011
|
),
|
|
4007
4012
|
failedResponseHandler: googleFailedResponseHandler,
|
|
4013
|
+
abortSignal: options.abortSignal,
|
|
4008
4014
|
fetch: this.config.fetch
|
|
4009
4015
|
});
|
|
4010
4016
|
file = fileStatus;
|
|
@@ -6212,8 +6218,8 @@ var googleInteractionsLanguageModelOptions = lazySchema19(
|
|
|
6212
6218
|
thinkingSummaries: z21.enum(["auto", "none"]).nullish(),
|
|
6213
6219
|
/**
|
|
6214
6220
|
* Output-format entries that map directly to the API's `response_format`
|
|
6215
|
-
* array. Use this to request image, audio, or non-JSON text
|
|
6216
|
-
* with
|
|
6221
|
+
* array. Use this to request image, audio, video, or non-JSON text
|
|
6222
|
+
* outputs with modality-specific controls.
|
|
6217
6223
|
*
|
|
6218
6224
|
* Entries are sent in order. The AI SDK call-level `responseFormat: {
|
|
6219
6225
|
* type: 'json', schema }` still drives JSON-mode and adds a matching
|
|
@@ -6250,6 +6256,14 @@ var googleInteractionsLanguageModelOptions = lazySchema19(
|
|
|
6250
6256
|
z21.object({
|
|
6251
6257
|
type: z21.literal("audio"),
|
|
6252
6258
|
mimeType: z21.string().nullish()
|
|
6259
|
+
}).loose(),
|
|
6260
|
+
z21.object({
|
|
6261
|
+
type: z21.literal("video"),
|
|
6262
|
+
aspectRatio: z21.enum(["16:9", "9:16"]).nullish(),
|
|
6263
|
+
resolution: z21.enum(["360p", "720p", "1080p", "4k"]).nullish(),
|
|
6264
|
+
duration: z21.string().nullish(),
|
|
6265
|
+
delivery: z21.enum(["inline", "uri"]).nullish(),
|
|
6266
|
+
gcsUri: z21.string().nullish()
|
|
6253
6267
|
}).loose()
|
|
6254
6268
|
])
|
|
6255
6269
|
).nullish(),
|
|
@@ -7157,7 +7171,7 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
7157
7171
|
};
|
|
7158
7172
|
}
|
|
7159
7173
|
async getArgs(options) {
|
|
7160
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A;
|
|
7174
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F;
|
|
7161
7175
|
const warnings = [];
|
|
7162
7176
|
const googleOptions = await parseProviderOptions7({
|
|
7163
7177
|
provider: "google",
|
|
@@ -7233,6 +7247,17 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
7233
7247
|
mime_type: (_g = entry.mimeType) != null ? _g : void 0
|
|
7234
7248
|
})
|
|
7235
7249
|
);
|
|
7250
|
+
} else if (entry.type === "video") {
|
|
7251
|
+
responseFormatEntries.push(
|
|
7252
|
+
pruneUndefined({
|
|
7253
|
+
type: "video",
|
|
7254
|
+
aspect_ratio: (_h = entry.aspectRatio) != null ? _h : void 0,
|
|
7255
|
+
resolution: (_i = entry.resolution) != null ? _i : void 0,
|
|
7256
|
+
duration: (_j = entry.duration) != null ? _j : void 0,
|
|
7257
|
+
delivery: (_k = entry.delivery) != null ? _k : void 0,
|
|
7258
|
+
gcs_uri: (_l = entry.gcsUri) != null ? _l : void 0
|
|
7259
|
+
})
|
|
7260
|
+
);
|
|
7236
7261
|
}
|
|
7237
7262
|
}
|
|
7238
7263
|
}
|
|
@@ -7242,13 +7267,13 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
7242
7267
|
warnings: convWarnings
|
|
7243
7268
|
} = convertToGoogleInteractionsInput({
|
|
7244
7269
|
prompt: options.prompt,
|
|
7245
|
-
previousInteractionId: (
|
|
7246
|
-
store: (
|
|
7247
|
-
mediaResolution: (
|
|
7270
|
+
previousInteractionId: (_m = googleOptions == null ? void 0 : googleOptions.previousInteractionId) != null ? _m : void 0,
|
|
7271
|
+
store: (_n = googleOptions == null ? void 0 : googleOptions.store) != null ? _n : void 0,
|
|
7272
|
+
mediaResolution: (_o = googleOptions == null ? void 0 : googleOptions.mediaResolution) != null ? _o : void 0
|
|
7248
7273
|
});
|
|
7249
7274
|
warnings.push(...convWarnings);
|
|
7250
7275
|
let systemInstruction = convertedSystemInstruction;
|
|
7251
|
-
const optionSystemInstruction = (
|
|
7276
|
+
const optionSystemInstruction = (_p = googleOptions == null ? void 0 : googleOptions.systemInstruction) != null ? _p : void 0;
|
|
7252
7277
|
if (systemInstruction != null && optionSystemInstruction != null) {
|
|
7253
7278
|
warnings.push({
|
|
7254
7279
|
type: "other",
|
|
@@ -7288,14 +7313,14 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
7288
7313
|
generationConfig = void 0;
|
|
7289
7314
|
} else {
|
|
7290
7315
|
generationConfig = pruneUndefined({
|
|
7291
|
-
temperature: (
|
|
7292
|
-
top_p: (
|
|
7293
|
-
top_k: (
|
|
7294
|
-
seed: (
|
|
7316
|
+
temperature: (_q = options.temperature) != null ? _q : void 0,
|
|
7317
|
+
top_p: (_r = options.topP) != null ? _r : void 0,
|
|
7318
|
+
top_k: (_s = options.topK) != null ? _s : void 0,
|
|
7319
|
+
seed: (_t = options.seed) != null ? _t : void 0,
|
|
7295
7320
|
stop_sequences: options.stopSequences != null && options.stopSequences.length > 0 ? options.stopSequences : void 0,
|
|
7296
|
-
max_output_tokens: (
|
|
7297
|
-
thinking_level: (
|
|
7298
|
-
thinking_summaries: (
|
|
7321
|
+
max_output_tokens: (_u = options.maxOutputTokens) != null ? _u : void 0,
|
|
7322
|
+
thinking_level: (_v = googleOptions == null ? void 0 : googleOptions.thinkingLevel) != null ? _v : void 0,
|
|
7323
|
+
thinking_summaries: (_w = googleOptions == null ? void 0 : googleOptions.thinkingSummaries) != null ? _w : void 0,
|
|
7299
7324
|
tool_choice: toolChoiceForBody
|
|
7300
7325
|
});
|
|
7301
7326
|
if ((googleOptions == null ? void 0 : googleOptions.imageConfig) != null) {
|
|
@@ -7322,9 +7347,9 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
7322
7347
|
if (agentConfigOptions.type === "deep-research") {
|
|
7323
7348
|
agentConfig = pruneUndefined({
|
|
7324
7349
|
type: "deep-research",
|
|
7325
|
-
thinking_summaries: (
|
|
7326
|
-
visualization: (
|
|
7327
|
-
collaborative_planning: (
|
|
7350
|
+
thinking_summaries: (_x = agentConfigOptions.thinkingSummaries) != null ? _x : void 0,
|
|
7351
|
+
visualization: (_y = agentConfigOptions.visualization) != null ? _y : void 0,
|
|
7352
|
+
collaborative_planning: (_z = agentConfigOptions.collaborativePlanning) != null ? _z : void 0
|
|
7328
7353
|
});
|
|
7329
7354
|
} else if (agentConfigOptions.type === "dynamic") {
|
|
7330
7355
|
agentConfig = { type: "dynamic" };
|
|
@@ -7341,7 +7366,7 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
7341
7366
|
environment = googleOptions.environment;
|
|
7342
7367
|
} else {
|
|
7343
7368
|
const environmentOptions = googleOptions.environment;
|
|
7344
|
-
const sources = (
|
|
7369
|
+
const sources = (_A = environmentOptions.sources) == null ? void 0 : _A.map((source) => {
|
|
7345
7370
|
var _a2;
|
|
7346
7371
|
if (source.type === "inline") {
|
|
7347
7372
|
return {
|
|
@@ -7386,20 +7411,20 @@ var GoogleInteractionsLanguageModel = class _GoogleInteractionsLanguageModel {
|
|
|
7386
7411
|
tools: toolsForBody,
|
|
7387
7412
|
response_format: responseFormatEntries.length > 0 ? responseFormatEntries : void 0,
|
|
7388
7413
|
response_modalities: (googleOptions == null ? void 0 : googleOptions.responseModalities) != null ? googleOptions.responseModalities : void 0,
|
|
7389
|
-
previous_interaction_id: (
|
|
7390
|
-
service_tier: (
|
|
7391
|
-
store: (
|
|
7414
|
+
previous_interaction_id: (_B = googleOptions == null ? void 0 : googleOptions.previousInteractionId) != null ? _B : void 0,
|
|
7415
|
+
service_tier: (_C = googleOptions == null ? void 0 : googleOptions.serviceTier) != null ? _C : void 0,
|
|
7416
|
+
store: (_D = googleOptions == null ? void 0 : googleOptions.store) != null ? _D : void 0,
|
|
7392
7417
|
generation_config: generationConfig != null && Object.keys(generationConfig).length > 0 ? generationConfig : void 0,
|
|
7393
7418
|
agent_config: agentConfig,
|
|
7394
7419
|
environment,
|
|
7395
|
-
background: (
|
|
7420
|
+
background: (_E = googleOptions == null ? void 0 : googleOptions.background) != null ? _E : void 0
|
|
7396
7421
|
});
|
|
7397
7422
|
return {
|
|
7398
7423
|
args,
|
|
7399
7424
|
warnings,
|
|
7400
7425
|
isAgent,
|
|
7401
7426
|
isBackground: (googleOptions == null ? void 0 : googleOptions.background) === true,
|
|
7402
|
-
pollingTimeoutMs: (
|
|
7427
|
+
pollingTimeoutMs: (_F = googleOptions == null ? void 0 : googleOptions.pollingTimeoutMs) != null ? _F : void 0
|
|
7403
7428
|
};
|
|
7404
7429
|
}
|
|
7405
7430
|
async doGenerate(options) {
|