@ai-sdk/google 4.0.0-beta.34 → 4.0.0-beta.36
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 +14 -0
- package/dist/index.js +11 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -6
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +10 -1
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +10 -1
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/google-generative-ai-files.ts +0 -2
- package/src/google-generative-ai-language-model.ts +9 -12
- package/src/google-generative-ai-options.ts +7 -0
package/dist/index.mjs
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.0-beta.
|
|
10
|
+
var VERSION = true ? "4.0.0-beta.36" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-generative-ai-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -900,6 +900,11 @@ var googleLanguageModelOptions = lazySchema4(
|
|
|
900
900
|
})
|
|
901
901
|
)
|
|
902
902
|
);
|
|
903
|
+
var VertexServiceTierMap = {
|
|
904
|
+
standard: "SERVICE_TIER_STANDARD",
|
|
905
|
+
flex: "SERVICE_TIER_FLEX",
|
|
906
|
+
priority: "SERVICE_TIER_PRIORITY"
|
|
907
|
+
};
|
|
903
908
|
|
|
904
909
|
// src/google-prepare-tools.ts
|
|
905
910
|
import {
|
|
@@ -1464,6 +1469,10 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1464
1469
|
message: `'streamFunctionCallArguments' is only supported on the Vertex AI API and will be ignored with the current Google provider (${this.config.provider}). See https://docs.cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling#streaming-fc`
|
|
1465
1470
|
});
|
|
1466
1471
|
}
|
|
1472
|
+
let sanitizedServiceTier = googleOptions == null ? void 0 : googleOptions.serviceTier;
|
|
1473
|
+
if ((googleOptions == null ? void 0 : googleOptions.serviceTier) && isVertexProvider) {
|
|
1474
|
+
sanitizedServiceTier = VertexServiceTierMap[googleOptions.serviceTier];
|
|
1475
|
+
}
|
|
1467
1476
|
const isGemmaModel = this.modelId.toLowerCase().startsWith("gemma-");
|
|
1468
1477
|
const supportsFunctionResponseParts = this.modelId.startsWith("gemini-3");
|
|
1469
1478
|
const { contents, systemInstruction } = convertToGoogleGenerativeAIMessages(
|
|
@@ -1540,7 +1549,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1540
1549
|
toolConfig,
|
|
1541
1550
|
cachedContent: googleOptions == null ? void 0 : googleOptions.cachedContent,
|
|
1542
1551
|
labels: googleOptions == null ? void 0 : googleOptions.labels,
|
|
1543
|
-
serviceTier:
|
|
1552
|
+
serviceTier: sanitizedServiceTier
|
|
1544
1553
|
},
|
|
1545
1554
|
warnings: [...warnings, ...toolWarnings],
|
|
1546
1555
|
providerOptionsName
|
|
@@ -3072,13 +3081,13 @@ import {
|
|
|
3072
3081
|
} from "@ai-sdk/provider";
|
|
3073
3082
|
import {
|
|
3074
3083
|
combineHeaders as combineHeaders5,
|
|
3075
|
-
convertUint8ArrayToBase64
|
|
3084
|
+
convertUint8ArrayToBase64,
|
|
3076
3085
|
createJsonResponseHandler as createJsonResponseHandler5,
|
|
3077
3086
|
delay as delay2,
|
|
3078
3087
|
getFromApi as getFromApi2,
|
|
3079
3088
|
lazySchema as lazySchema13,
|
|
3080
3089
|
parseProviderOptions as parseProviderOptions5,
|
|
3081
|
-
postJsonToApi as
|
|
3090
|
+
postJsonToApi as postJsonToApi4,
|
|
3082
3091
|
resolve as resolve4,
|
|
3083
3092
|
zodSchema as zodSchema13
|
|
3084
3093
|
} from "@ai-sdk/provider-utils";
|
|
@@ -3117,7 +3126,7 @@ var GoogleGenerativeAIVideoModel = class {
|
|
|
3117
3126
|
details: "Google Generative AI video models require base64-encoded images. URL will be ignored."
|
|
3118
3127
|
});
|
|
3119
3128
|
} else {
|
|
3120
|
-
const base64Data = typeof options.image.data === "string" ? options.image.data :
|
|
3129
|
+
const base64Data = typeof options.image.data === "string" ? options.image.data : convertUint8ArrayToBase64(options.image.data);
|
|
3121
3130
|
instance.image = {
|
|
3122
3131
|
inlineData: {
|
|
3123
3132
|
mimeType: options.image.mediaType || "image/png",
|
|
@@ -3183,7 +3192,7 @@ var GoogleGenerativeAIVideoModel = class {
|
|
|
3183
3192
|
}
|
|
3184
3193
|
}
|
|
3185
3194
|
}
|
|
3186
|
-
const { value: operation } = await
|
|
3195
|
+
const { value: operation } = await postJsonToApi4({
|
|
3187
3196
|
url: `${this.config.baseURL}/models/${this.modelId}:predictLongRunning`,
|
|
3188
3197
|
headers: combineHeaders5(
|
|
3189
3198
|
await resolve4(this.config.headers),
|