@ai-sdk/google 4.0.59 → 4.0.61

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-sdk/google",
3
- "version": "4.0.59",
3
+ "version": "4.0.61",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -35,8 +35,8 @@
35
35
  }
36
36
  },
37
37
  "dependencies": {
38
- "@ai-sdk/provider": "4.0.9",
39
- "@ai-sdk/provider-utils": "5.0.34"
38
+ "@ai-sdk/provider": "4.0.10",
39
+ "@ai-sdk/provider-utils": "5.0.35"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@ai-sdk/test-server": "2.0.1",
@@ -43,7 +43,7 @@ const googleBatchInputFileMaxBytes = 2 * 1024 * 1024 * 1024;
43
43
  const googleBatchInlineCreationMaxBytes = 20_000_000;
44
44
  const supportedGoogleBatchContentTypes = new Set<
45
45
  LanguageModelV4GenerateResult['content'][number]['type']
46
- >(['text', 'reasoning', 'source']);
46
+ >(['text', 'reasoning', 'source', 'tool-call', 'tool-result']);
47
47
 
48
48
  type GoogleBatchRequest = Parameters<
49
49
  BatchLanguageModelV4['experimental_doStartBatch']
@@ -63,7 +63,10 @@ export class GoogleFiles implements FilesV4 {
63
63
  schema: googleFilesUploadOptionsSchema,
64
64
  })) as GoogleFilesUploadOptions | undefined;
65
65
 
66
- const resolvedHeaders = this.config.headers();
66
+ const resolvedHeaders = combineHeaders(
67
+ this.config.headers(),
68
+ options.headers,
69
+ );
67
70
  const fetchFn = this.config.fetch ?? globalThis.fetch;
68
71
 
69
72
  const warnings: Array<SharedV4Warning> = [];
@@ -93,6 +96,7 @@ export class GoogleFiles implements FilesV4 {
93
96
  ...(displayName != null ? { display_name: displayName } : {}),
94
97
  },
95
98
  }),
99
+ signal: options.abortSignal,
96
100
  });
97
101
 
98
102
  if (!initResponse.ok) {
@@ -118,6 +122,7 @@ export class GoogleFiles implements FilesV4 {
118
122
  'X-Goog-Upload-Command': 'upload, finalize',
119
123
  },
120
124
  body: ensureArrayBufferBacked(fileBytes),
125
+ signal: options.abortSignal,
121
126
  });
122
127
 
123
128
  if (!uploadResponse.ok) {
@@ -146,7 +151,7 @@ export class GoogleFiles implements FilesV4 {
146
151
  });
147
152
  }
148
153
 
149
- await delay(pollIntervalMs);
154
+ await delay(pollIntervalMs, { abortSignal: options.abortSignal });
150
155
 
151
156
  const fileNameMatch = /^files\/([^/]+)$/.exec(file.name);
152
157
  const filePath =
@@ -162,6 +167,7 @@ export class GoogleFiles implements FilesV4 {
162
167
  googleFileResponseSchema,
163
168
  ),
164
169
  failedResponseHandler: googleFailedResponseHandler,
170
+ abortSignal: options.abortSignal,
165
171
  fetch: this.config.fetch,
166
172
  });
167
173