@ai-sdk/google 4.0.0-beta.33 → 4.0.0-beta.35
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 +10 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -10
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +9 -5
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +9 -5
- 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 +28 -31
- package/src/google-generative-ai-options.ts +3 -2
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.35" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-generative-ai-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -885,9 +885,10 @@ var googleLanguageModelOptions = lazySchema4(
|
|
|
885
885
|
/**
|
|
886
886
|
* Optional. When set to true, function call arguments will be streamed
|
|
887
887
|
* incrementally via partialArgs in streaming responses. Only supported
|
|
888
|
-
* on the Vertex AI API (not the Gemini API)
|
|
888
|
+
* on the Vertex AI API (not the Gemini API) and only for Gemini 3+
|
|
889
|
+
* models.
|
|
889
890
|
*
|
|
890
|
-
* @default
|
|
891
|
+
* @default false
|
|
891
892
|
*
|
|
892
893
|
* https://docs.cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling#streaming-fc
|
|
893
894
|
*/
|
|
@@ -1432,7 +1433,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1432
1433
|
toolChoice,
|
|
1433
1434
|
reasoning,
|
|
1434
1435
|
providerOptions
|
|
1435
|
-
}) {
|
|
1436
|
+
}, { isStreaming = false } = {}) {
|
|
1436
1437
|
var _a, _b;
|
|
1437
1438
|
const warnings = [];
|
|
1438
1439
|
const providerOptionsName = this.config.provider.includes("vertex") ? "vertex" : "google";
|
|
@@ -1488,7 +1489,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1488
1489
|
warnings
|
|
1489
1490
|
});
|
|
1490
1491
|
const thinkingConfig = (googleOptions == null ? void 0 : googleOptions.thinkingConfig) || resolvedThinking ? { ...resolvedThinking, ...googleOptions == null ? void 0 : googleOptions.thinkingConfig } : void 0;
|
|
1491
|
-
const streamFunctionCallArguments = isVertexProvider ? (_a = googleOptions == null ? void 0 : googleOptions.streamFunctionCallArguments) != null ? _a :
|
|
1492
|
+
const streamFunctionCallArguments = isStreaming && isVertexProvider ? (_a = googleOptions == null ? void 0 : googleOptions.streamFunctionCallArguments) != null ? _a : false : void 0;
|
|
1492
1493
|
const toolConfig = googleToolConfig || streamFunctionCallArguments || (googleOptions == null ? void 0 : googleOptions.retrievalConfig) ? {
|
|
1493
1494
|
...googleToolConfig,
|
|
1494
1495
|
...streamFunctionCallArguments && {
|
|
@@ -1726,7 +1727,10 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1726
1727
|
};
|
|
1727
1728
|
}
|
|
1728
1729
|
async doStream(options) {
|
|
1729
|
-
const { args, warnings, providerOptionsName } = await this.getArgs(
|
|
1730
|
+
const { args, warnings, providerOptionsName } = await this.getArgs(
|
|
1731
|
+
options,
|
|
1732
|
+
{ isStreaming: true }
|
|
1733
|
+
);
|
|
1730
1734
|
const headers = combineHeaders2(
|
|
1731
1735
|
await resolve2(this.config.headers),
|
|
1732
1736
|
options.headers
|
|
@@ -3068,13 +3072,13 @@ import {
|
|
|
3068
3072
|
} from "@ai-sdk/provider";
|
|
3069
3073
|
import {
|
|
3070
3074
|
combineHeaders as combineHeaders5,
|
|
3071
|
-
convertUint8ArrayToBase64
|
|
3075
|
+
convertUint8ArrayToBase64,
|
|
3072
3076
|
createJsonResponseHandler as createJsonResponseHandler5,
|
|
3073
3077
|
delay as delay2,
|
|
3074
3078
|
getFromApi as getFromApi2,
|
|
3075
3079
|
lazySchema as lazySchema13,
|
|
3076
3080
|
parseProviderOptions as parseProviderOptions5,
|
|
3077
|
-
postJsonToApi as
|
|
3081
|
+
postJsonToApi as postJsonToApi4,
|
|
3078
3082
|
resolve as resolve4,
|
|
3079
3083
|
zodSchema as zodSchema13
|
|
3080
3084
|
} from "@ai-sdk/provider-utils";
|
|
@@ -3113,7 +3117,7 @@ var GoogleGenerativeAIVideoModel = class {
|
|
|
3113
3117
|
details: "Google Generative AI video models require base64-encoded images. URL will be ignored."
|
|
3114
3118
|
});
|
|
3115
3119
|
} else {
|
|
3116
|
-
const base64Data = typeof options.image.data === "string" ? options.image.data :
|
|
3120
|
+
const base64Data = typeof options.image.data === "string" ? options.image.data : convertUint8ArrayToBase64(options.image.data);
|
|
3117
3121
|
instance.image = {
|
|
3118
3122
|
inlineData: {
|
|
3119
3123
|
mimeType: options.image.mediaType || "image/png",
|
|
@@ -3179,7 +3183,7 @@ var GoogleGenerativeAIVideoModel = class {
|
|
|
3179
3183
|
}
|
|
3180
3184
|
}
|
|
3181
3185
|
}
|
|
3182
|
-
const { value: operation } = await
|
|
3186
|
+
const { value: operation } = await postJsonToApi4({
|
|
3183
3187
|
url: `${this.config.baseURL}/models/${this.modelId}:predictLongRunning`,
|
|
3184
3188
|
headers: combineHeaders5(
|
|
3185
3189
|
await resolve4(this.config.headers),
|