@ai-sdk/google-vertex 4.0.232 → 4.0.234
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 +23 -0
- package/dist/anthropic/edge/index.js +1 -1
- package/dist/anthropic/edge/index.mjs +1 -1
- package/dist/edge/index.d.mts +30 -2
- package/dist/edge/index.d.ts +30 -2
- package/dist/edge/index.js +12 -3
- package/dist/edge/index.js.map +1 -1
- package/dist/edge/index.mjs +12 -3
- package/dist/edge/index.mjs.map +1 -1
- package/dist/index.d.mts +30 -2
- package/dist/index.d.ts +30 -2
- package/dist/index.js +12 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -3
- package/dist/index.mjs.map +1 -1
- package/dist/maas/edge/index.js +1 -1
- package/dist/maas/edge/index.mjs +1 -1
- package/dist/xai/edge/index.js +1 -1
- package/dist/xai/edge/index.mjs +1 -1
- package/docs/16-google-vertex.mdx +36 -3
- package/package.json +5 -5
- package/src/google-vertex-provider.ts +46 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @ai-sdk/google-vertex
|
|
2
2
|
|
|
3
|
+
## 4.0.234
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- ccd2caa: Limit the size of Google Vertex tool result file downloads with `toolResultDownloads.maxBytes`, which defaults to 7 MiB. This is lower than the previous 2 GiB default for these downloads; raise `toolResultDownloads.maxBytes` for larger files.
|
|
8
|
+
- 578c141: Keep Google Vertex tool result downloads on the built-in validated transport and stop using the provider `fetch` option for them. Set `toolResultDownloads.fetch` to choose another transport for those downloads.
|
|
9
|
+
|
|
10
|
+
The built-in transport resolves every hostname through a validating lookup hook and pins the connection to the resolved address on Node.js. Reusing the provider `fetch` option for downloads would adopt a logging, tracing, or proxy wrapper that does not validate DNS results, so tool result URLs whose hostnames resolve to private addresses could reach internal hosts. A transport set with `toolResultDownloads.fetch` must perform equivalent connect-time DNS validation, for example a guarded fetch on Bun or Deno.
|
|
11
|
+
|
|
12
|
+
- Updated dependencies [d59eee0]
|
|
13
|
+
- Updated dependencies [ccd2caa]
|
|
14
|
+
- @ai-sdk/provider-utils@4.0.67
|
|
15
|
+
- @ai-sdk/google@3.0.147
|
|
16
|
+
- @ai-sdk/anthropic@3.0.143
|
|
17
|
+
- @ai-sdk/openai-compatible@2.0.94
|
|
18
|
+
|
|
19
|
+
## 4.0.233
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [271ca50]
|
|
24
|
+
- @ai-sdk/google@3.0.146
|
|
25
|
+
|
|
3
26
|
## 4.0.232
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
|
@@ -32,7 +32,7 @@ var import_provider_utils3 = require("@ai-sdk/provider-utils");
|
|
|
32
32
|
var import_provider_utils = require("@ai-sdk/provider-utils");
|
|
33
33
|
|
|
34
34
|
// src/version.ts
|
|
35
|
-
var VERSION = true ? "4.0.
|
|
35
|
+
var VERSION = true ? "4.0.234" : "0.0.0-test";
|
|
36
36
|
|
|
37
37
|
// src/edge/google-vertex-auth-edge.ts
|
|
38
38
|
var loadCredentials = async () => {
|
package/dist/edge/index.d.mts
CHANGED
|
@@ -136,8 +136,12 @@ interface GoogleVertexProviderSettings$1 {
|
|
|
136
136
|
*/
|
|
137
137
|
headers?: Resolvable<Record<string, string | undefined>>;
|
|
138
138
|
/**
|
|
139
|
-
* Custom fetch implementation. You can use it as a
|
|
140
|
-
* or to provide a custom fetch
|
|
139
|
+
* Custom fetch implementation for Vertex API requests. You can use it as a
|
|
140
|
+
* middleware to intercept requests, or to provide a custom fetch
|
|
141
|
+
* implementation for e.g. testing.
|
|
142
|
+
*
|
|
143
|
+
* It is not used to download tool result files; those downloads use the
|
|
144
|
+
* validated default transport unless `toolResultDownloads.fetch` is set.
|
|
141
145
|
*/
|
|
142
146
|
fetch?: FetchFunction;
|
|
143
147
|
generateId?: () => string;
|
|
@@ -145,6 +149,30 @@ interface GoogleVertexProviderSettings$1 {
|
|
|
145
149
|
* Base URL for the Google Vertex API calls.
|
|
146
150
|
*/
|
|
147
151
|
baseURL?: string;
|
|
152
|
+
/**
|
|
153
|
+
* Configuration for downloading tool result files whose URLs cannot be
|
|
154
|
+
* referenced in Vertex function responses.
|
|
155
|
+
*/
|
|
156
|
+
toolResultDownloads?: {
|
|
157
|
+
/**
|
|
158
|
+
* Maximum number of bytes per downloaded tool result file.
|
|
159
|
+
* Defaults to 7 MiB.
|
|
160
|
+
*/
|
|
161
|
+
maxBytes?: number;
|
|
162
|
+
/**
|
|
163
|
+
* Transport used to download tool result files.
|
|
164
|
+
*
|
|
165
|
+
* Downloads default to a validated transport that resolves every hostname
|
|
166
|
+
* through a validating lookup hook and pins the connection to the resolved
|
|
167
|
+
* address on Node.js. Pass a fetch here only if it provides equivalent
|
|
168
|
+
* connect-time DNS validation for the URLs you download, e.g. a guarded
|
|
169
|
+
* fetch on Bun or Deno.
|
|
170
|
+
*
|
|
171
|
+
* The `fetch` option is not used for these downloads, and the Vertex API key
|
|
172
|
+
* is never attached to them.
|
|
173
|
+
*/
|
|
174
|
+
fetch?: FetchFunction;
|
|
175
|
+
};
|
|
148
176
|
}
|
|
149
177
|
|
|
150
178
|
interface GoogleCredentials {
|
package/dist/edge/index.d.ts
CHANGED
|
@@ -136,8 +136,12 @@ interface GoogleVertexProviderSettings$1 {
|
|
|
136
136
|
*/
|
|
137
137
|
headers?: Resolvable<Record<string, string | undefined>>;
|
|
138
138
|
/**
|
|
139
|
-
* Custom fetch implementation. You can use it as a
|
|
140
|
-
* or to provide a custom fetch
|
|
139
|
+
* Custom fetch implementation for Vertex API requests. You can use it as a
|
|
140
|
+
* middleware to intercept requests, or to provide a custom fetch
|
|
141
|
+
* implementation for e.g. testing.
|
|
142
|
+
*
|
|
143
|
+
* It is not used to download tool result files; those downloads use the
|
|
144
|
+
* validated default transport unless `toolResultDownloads.fetch` is set.
|
|
141
145
|
*/
|
|
142
146
|
fetch?: FetchFunction;
|
|
143
147
|
generateId?: () => string;
|
|
@@ -145,6 +149,30 @@ interface GoogleVertexProviderSettings$1 {
|
|
|
145
149
|
* Base URL for the Google Vertex API calls.
|
|
146
150
|
*/
|
|
147
151
|
baseURL?: string;
|
|
152
|
+
/**
|
|
153
|
+
* Configuration for downloading tool result files whose URLs cannot be
|
|
154
|
+
* referenced in Vertex function responses.
|
|
155
|
+
*/
|
|
156
|
+
toolResultDownloads?: {
|
|
157
|
+
/**
|
|
158
|
+
* Maximum number of bytes per downloaded tool result file.
|
|
159
|
+
* Defaults to 7 MiB.
|
|
160
|
+
*/
|
|
161
|
+
maxBytes?: number;
|
|
162
|
+
/**
|
|
163
|
+
* Transport used to download tool result files.
|
|
164
|
+
*
|
|
165
|
+
* Downloads default to a validated transport that resolves every hostname
|
|
166
|
+
* through a validating lookup hook and pins the connection to the resolved
|
|
167
|
+
* address on Node.js. Pass a fetch here only if it provides equivalent
|
|
168
|
+
* connect-time DNS validation for the URLs you download, e.g. a guarded
|
|
169
|
+
* fetch on Bun or Deno.
|
|
170
|
+
*
|
|
171
|
+
* The `fetch` option is not used for these downloads, and the Vertex API key
|
|
172
|
+
* is never attached to them.
|
|
173
|
+
*/
|
|
174
|
+
fetch?: FetchFunction;
|
|
175
|
+
};
|
|
148
176
|
}
|
|
149
177
|
|
|
150
178
|
interface GoogleCredentials {
|
package/dist/edge/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var import_internal3 = require("@ai-sdk/google/internal");
|
|
|
33
33
|
var import_provider_utils10 = require("@ai-sdk/provider-utils");
|
|
34
34
|
|
|
35
35
|
// src/version.ts
|
|
36
|
-
var VERSION = true ? "4.0.
|
|
36
|
+
var VERSION = true ? "4.0.234" : "0.0.0-test";
|
|
37
37
|
|
|
38
38
|
// src/google-vertex-embedding-model.ts
|
|
39
39
|
var import_provider = require("@ai-sdk/provider");
|
|
@@ -1339,6 +1339,7 @@ var googleVertexVideoModelOptionsSchema = (0, import_provider_utils9.lazySchema)
|
|
|
1339
1339
|
|
|
1340
1340
|
// src/google-vertex-provider.ts
|
|
1341
1341
|
var EXPRESS_MODE_BASE_URL = "https://aiplatform.googleapis.com/v1/publishers/google";
|
|
1342
|
+
var DEFAULT_TOOL_RESULT_DOWNLOAD_MAX_BYTES = 7 * 1024 * 1024;
|
|
1342
1343
|
function createExpressModeFetch(apiKey, customFetch) {
|
|
1343
1344
|
return async (url, init) => {
|
|
1344
1345
|
const modifiedInit = {
|
|
@@ -1403,7 +1404,7 @@ function createVertex(options = {}) {
|
|
|
1403
1404
|
};
|
|
1404
1405
|
};
|
|
1405
1406
|
const createChatModel = (modelId) => {
|
|
1406
|
-
var _a;
|
|
1407
|
+
var _a, _b, _c, _d;
|
|
1407
1408
|
return new import_internal3.GoogleGenerativeAILanguageModel(modelId, {
|
|
1408
1409
|
...createConfig("chat"),
|
|
1409
1410
|
generateId: (_a = options.generateId) != null ? _a : import_provider_utils10.generateId,
|
|
@@ -1414,7 +1415,15 @@ function createVertex(options = {}) {
|
|
|
1414
1415
|
// Google Cloud Storage URLs:
|
|
1415
1416
|
/^gs:\/\/.*$/
|
|
1416
1417
|
]
|
|
1417
|
-
})
|
|
1418
|
+
}),
|
|
1419
|
+
downloadToolResultFiles: {
|
|
1420
|
+
maxBytes: (_c = (_b = options.toolResultDownloads) == null ? void 0 : _b.maxBytes) != null ? _c : DEFAULT_TOOL_RESULT_DOWNLOAD_MAX_BYTES,
|
|
1421
|
+
// Tool result hosts are unrelated to the Vertex API, so this must be an
|
|
1422
|
+
// explicit download transport. The provider `fetch` is often a logging
|
|
1423
|
+
// or proxy wrapper that would replace the DNS-pinned default transport,
|
|
1424
|
+
// and the Express Mode wrapper would leak the API key to those hosts.
|
|
1425
|
+
fetch: (_d = options.toolResultDownloads) == null ? void 0 : _d.fetch
|
|
1426
|
+
}
|
|
1418
1427
|
});
|
|
1419
1428
|
};
|
|
1420
1429
|
const createInteractionsModel = (modelIdOrAgent) => {
|