@ai-sdk/google-vertex 5.0.127 → 5.0.129
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 +27 -0
- package/dist/anthropic/edge/index.js +1 -1
- package/dist/edge/index.d.ts +2 -1
- package/dist/edge/index.d.ts.map +1 -1
- package/dist/edge/index.js +9 -7
- package/dist/edge/index.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/dist/maas/edge/index.js +1 -1
- package/dist/xai/edge/index.js +1 -1
- package/docs/16-google-vertex.mdx +6 -1
- package/package.json +6 -6
- package/src/edge/google-vertex-provider-edge.ts +7 -4
- package/src/google-vertex-provider-base.ts +22 -7
- package/src/google-vertex-provider.ts +7 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
# @ai-sdk/google-vertex
|
|
2
2
|
|
|
3
|
+
## 5.0.129
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [f4c5f1e]
|
|
8
|
+
- Updated dependencies [e10aebb]
|
|
9
|
+
- Updated dependencies [b0d51fe]
|
|
10
|
+
- @ai-sdk/anthropic@4.0.94
|
|
11
|
+
|
|
12
|
+
## 5.0.128
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- 7716e18: Support promises and synchronous or asynchronous callbacks in provider API key and token settings. Resolve credentials per authenticated request while preserving existing authentication behavior and synchronous credential serialization.
|
|
17
|
+
|
|
18
|
+
The experimental OpenAI Live `getServerWebSocketConfig()` method can now resolve asynchronously. Await its result before using the connection settings.
|
|
19
|
+
|
|
20
|
+
- Updated dependencies [7716e18]
|
|
21
|
+
- Updated dependencies [dfed8e8]
|
|
22
|
+
- Updated dependencies [5c247e9]
|
|
23
|
+
- Updated dependencies [dcd2f8d]
|
|
24
|
+
- @ai-sdk/google@4.0.109
|
|
25
|
+
- @ai-sdk/openai-compatible@3.0.82
|
|
26
|
+
- @ai-sdk/provider-utils@5.0.72
|
|
27
|
+
- @ai-sdk/provider@4.0.35
|
|
28
|
+
- @ai-sdk/anthropic@4.0.93
|
|
29
|
+
|
|
3
30
|
## 5.0.127
|
|
4
31
|
|
|
5
32
|
### Patch Changes
|
|
@@ -3,7 +3,7 @@ import { InvalidArgumentError, NoSuchModelError } from "@ai-sdk/provider";
|
|
|
3
3
|
import { AnthropicLanguageModel, anthropicTools } from "@ai-sdk/anthropic/internal";
|
|
4
4
|
import { z } from "zod/v4";
|
|
5
5
|
//#region src/version.ts
|
|
6
|
-
const VERSION = "5.0.
|
|
6
|
+
const VERSION = "5.0.129";
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/edge/google-vertex-auth-edge.ts
|
|
9
9
|
const loadCredentials = async () => {
|
package/dist/edge/index.d.ts
CHANGED
|
@@ -144,8 +144,9 @@ interface GoogleVertexProviderSettings$1 {
|
|
|
144
144
|
* Optional. The API key for the Google Cloud project. If provided, the
|
|
145
145
|
* provider will use express mode with API key authentication. Defaults to
|
|
146
146
|
* the value of the `GOOGLE_VERTEX_API_KEY` environment variable.
|
|
147
|
+
* A callback is resolved before each request and must return a non-empty key.
|
|
147
148
|
*/
|
|
148
|
-
apiKey?: string
|
|
149
|
+
apiKey?: Resolvable<string>;
|
|
149
150
|
/**
|
|
150
151
|
* Your Google Vertex location. Defaults to the environment variable `GOOGLE_VERTEX_LOCATION`.
|
|
151
152
|
*/
|
package/dist/edge/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":["GoogleVertexProviderSettings","GoogleVertexProviderSettingsOriginal"],"sources":["../../src/google-vertex-embedding-model-options.ts","../../src/google-vertex-config.ts","../../src/google-vertex-embedding-model.ts","../../src/google-vertex-image-settings.ts","../../src/google-vertex-options.ts","../../src/google-vertex-tools.ts","../../src/google-vertex-transcription-model-options.ts","../../src/google-vertex-video-settings.ts","../../src/google-vertex-speech-model-options.ts","../../src/google-vertex-provider-base.ts","../../src/edge/google-vertex-auth-edge.ts","../../src/edge/google-vertex-provider-edge.ts"],"mappings":";;;;;KAQY;;;UCNK;EACf;EACA;EACA,UAAU,WAAW;EACrB,QAAQ;;;;cCkBG,sCAAsC;WACxC;WACA,SAAS;WACT;mBAEQ;UAET,oBAAoB,OAAO;;;;UAO3B,sBAAsB;IAC5B;IACA,QAAQ;MACT;MAIG;MAMA;EAKF,YAAA,SAAS,8BACT,QAAQ;EAMJ,UACJ,QACA,YACA,SACA,aACA,mBACC,WAAW,kCAAkC,QAC9C,QAAQ,WAAW;;;;KCtEX;;;KCGA;;;cCDC;;;;MASqpoB,YAAC;MAAsD,cAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KCF9soB;;;KCTA;;;KCMA;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":["GoogleVertexProviderSettings","GoogleVertexProviderSettingsOriginal"],"sources":["../../src/google-vertex-embedding-model-options.ts","../../src/google-vertex-config.ts","../../src/google-vertex-embedding-model.ts","../../src/google-vertex-image-settings.ts","../../src/google-vertex-options.ts","../../src/google-vertex-tools.ts","../../src/google-vertex-transcription-model-options.ts","../../src/google-vertex-video-settings.ts","../../src/google-vertex-speech-model-options.ts","../../src/google-vertex-provider-base.ts","../../src/edge/google-vertex-auth-edge.ts","../../src/edge/google-vertex-provider-edge.ts"],"mappings":";;;;;KAQY;;;UCNK;EACf;EACA;EACA,UAAU,WAAW;EACrB,QAAQ;;;;cCkBG,sCAAsC;WACxC;WACA,SAAS;WACT;mBAEQ;UAET,oBAAoB,OAAO;;;;UAO3B,sBAAsB;IAC5B;IACA,QAAQ;MACT;MAIG;MAMA;EAKF,YAAA,SAAS,8BACT,QAAQ;EAMJ,UACJ,QACA,YACA,SACA,aACA,mBACC,WAAW,kCAAkC,QAC9C,QAAQ,WAAW;;;;KCtEX;;;KCGA;;;cCDC;;;;MASqpoB,YAAC;MAAsD,cAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KCF9soB;;;KCTA;;;KCMA;;;UCgFK,6BAA6B;;;;GAI3C,SAAS,sBAAsB;EAEhC,gBAAgB,SAAS,wBAAwB;;;;;;;EAQjD,aACE,gBACI;IACE,OAAO;;IACP;MACL;;;;EAKH,MAAM,SAAS,2BAA2B;;;;EAK1C,WAAW,SAAS,2BAA2B;EAE/C,cAAc;;;;EAKd,mBACE,SAAS,+BACR;;;;EAKH,MAAM,SAAS,2BAA2B;;;;EAK1C,WAAW,SAAS,2BAA2B;;;;EAK/C,OAAO,SAAS,4BAA4B;;;;EAK5C,YAAY,SAAS,4BAA4B;;;;EAKjD,cACE,SAAS,mCACR;;;;EAKH,mBACE,SAAS,mCACR;;UAGYA;;;;;;;EAOf,SAAS;;;;EAKT;;;;EAKA;;;;;;;;EASA,UAAU,WAAW;;;;;EAMrB,QAAQ;EAGR;;;;EAKA;;;;;;EAOA,YAAY;;;;;EAMZ;;;;IAIE;;;;;UClNa;;;;;EAKf;;;;;EAMA;;;;;EAMA;;;;UCbe,qCAAqCC;;;;;;EAMpD,oBAAoB;;wBAGN,mBACd,UAAS,+BACR;;;;qBA2BU,cAAY"}
|
package/dist/edge/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { WORKFLOW_DESERIALIZE, WORKFLOW_SERIALIZE, combineHeaders, connectToWebSocket, convertBase64ToUint8Array, convertToBase64, convertUint8ArrayToBase64, createJsonErrorResponseHandler, createJsonResponseHandler, generateId, getRuntimeEnvironmentUserAgent, isValidHostnamePart, lazySchema, loadOptionalSetting, loadSetting, normalizeHeaders, parseProviderOptions, postJsonToApi, resolve, safeParseJSON, serializeModelOptions, waitForWebSocketBufferDrain, withUserAgentSuffix, withoutTrailingSlash, zodSchema } from "@ai-sdk/provider-utils";
|
|
2
2
|
import { GoogleInteractionsLanguageModel, GoogleLanguageModel, GoogleSpeechModel, googleTools } from "@ai-sdk/google/internal";
|
|
3
|
-
import { AISDKError, InvalidArgumentError, TooManyEmbeddingValuesForCallError } from "@ai-sdk/provider";
|
|
3
|
+
import { AISDKError, InvalidArgumentError, LoadAPIKeyError, TooManyEmbeddingValuesForCallError } from "@ai-sdk/provider";
|
|
4
4
|
import { z } from "zod/v4";
|
|
5
5
|
//#region src/version.ts
|
|
6
|
-
const VERSION = "5.0.
|
|
6
|
+
const VERSION = "5.0.129";
|
|
7
7
|
//#endregion
|
|
8
8
|
//#region src/google-vertex-error.ts
|
|
9
9
|
const googleVertexErrorDataSchema = lazySchema(() => zodSchema(z.object({ error: z.object({
|
|
@@ -1244,11 +1244,13 @@ function isEndpointModelId(modelId) {
|
|
|
1244
1244
|
}
|
|
1245
1245
|
function createExpressModeFetch(apiKey, customFetch) {
|
|
1246
1246
|
return async (url, init) => {
|
|
1247
|
+
const resolvedApiKey = await resolve(apiKey);
|
|
1248
|
+
if (typeof apiKey !== "string" && (typeof resolvedApiKey !== "string" || !resolvedApiKey.trim())) throw new LoadAPIKeyError({ message: "Google Vertex API key must be a non-empty string." });
|
|
1247
1249
|
const modifiedInit = {
|
|
1248
1250
|
...init,
|
|
1249
1251
|
headers: {
|
|
1250
1252
|
...init?.headers ? normalizeHeaders(init.headers) : {},
|
|
1251
|
-
"x-goog-api-key":
|
|
1253
|
+
"x-goog-api-key": resolvedApiKey
|
|
1252
1254
|
}
|
|
1253
1255
|
};
|
|
1254
1256
|
return (customFetch ?? fetch)(url.toString(), modifiedInit);
|
|
@@ -1258,10 +1260,10 @@ function createExpressModeFetch(apiKey, customFetch) {
|
|
|
1258
1260
|
* Create a Google Vertex AI provider instance.
|
|
1259
1261
|
*/
|
|
1260
1262
|
function createGoogleVertex$1(options = {}) {
|
|
1261
|
-
const apiKey = loadOptionalSetting({
|
|
1263
|
+
const apiKey = typeof options.apiKey === "string" || options.apiKey == null ? loadOptionalSetting({
|
|
1262
1264
|
settingValue: options.apiKey,
|
|
1263
1265
|
environmentVariableName: "GOOGLE_VERTEX_API_KEY"
|
|
1264
|
-
});
|
|
1266
|
+
}) : options.apiKey;
|
|
1265
1267
|
const loadGoogleVertexProject = () => loadSetting({
|
|
1266
1268
|
settingValue: options.project,
|
|
1267
1269
|
settingName: "project",
|
|
@@ -1468,10 +1470,10 @@ async function generateAuthToken(credentials) {
|
|
|
1468
1470
|
//#endregion
|
|
1469
1471
|
//#region src/edge/google-vertex-provider-edge.ts
|
|
1470
1472
|
function createGoogleVertex(options = {}) {
|
|
1471
|
-
if (loadOptionalSetting({
|
|
1473
|
+
if (typeof options.apiKey === "string" || options.apiKey == null ? loadOptionalSetting({
|
|
1472
1474
|
settingValue: options.apiKey,
|
|
1473
1475
|
environmentVariableName: "GOOGLE_VERTEX_API_KEY"
|
|
1474
|
-
})) return createGoogleVertex$1(options);
|
|
1476
|
+
}) : options.apiKey) return createGoogleVertex$1(options);
|
|
1475
1477
|
return createGoogleVertex$1({
|
|
1476
1478
|
...options,
|
|
1477
1479
|
headers: async () => ({
|