@ai-sdk/google 3.0.61 → 3.0.62
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 +6 -0
- package/dist/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -6
- 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 +3 -3
- package/src/google-generative-ai-language-model.ts +26 -19
- package/src/google-generative-ai-options.ts +3 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/google",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.62",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"tsup": "^8",
|
|
45
45
|
"typescript": "5.8.3",
|
|
46
46
|
"zod": "3.25.76",
|
|
47
|
-
"@
|
|
48
|
-
"@ai-
|
|
47
|
+
"@ai-sdk/test-server": "1.0.3",
|
|
48
|
+
"@vercel/ai-tsconfig": "0.0.0"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"zod": "^3.25.76 || ^4.1.8"
|
|
@@ -85,21 +85,24 @@ export class GoogleGenerativeAILanguageModel implements LanguageModelV3 {
|
|
|
85
85
|
return this.config.supportedUrls?.() ?? {};
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
private async getArgs(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
88
|
+
private async getArgs(
|
|
89
|
+
{
|
|
90
|
+
prompt,
|
|
91
|
+
maxOutputTokens,
|
|
92
|
+
temperature,
|
|
93
|
+
topP,
|
|
94
|
+
topK,
|
|
95
|
+
frequencyPenalty,
|
|
96
|
+
presencePenalty,
|
|
97
|
+
stopSequences,
|
|
98
|
+
responseFormat,
|
|
99
|
+
seed,
|
|
100
|
+
tools,
|
|
101
|
+
toolChoice,
|
|
102
|
+
providerOptions,
|
|
103
|
+
}: LanguageModelV3CallOptions,
|
|
104
|
+
{ isStreaming = false }: { isStreaming?: boolean } = {},
|
|
105
|
+
) {
|
|
103
106
|
const warnings: SharedV3Warning[] = [];
|
|
104
107
|
|
|
105
108
|
const providerOptionsName = this.config.provider.includes('vertex')
|
|
@@ -170,9 +173,10 @@ export class GoogleGenerativeAILanguageModel implements LanguageModelV3 {
|
|
|
170
173
|
modelId: this.modelId,
|
|
171
174
|
});
|
|
172
175
|
|
|
173
|
-
const streamFunctionCallArguments =
|
|
174
|
-
|
|
175
|
-
|
|
176
|
+
const streamFunctionCallArguments =
|
|
177
|
+
isStreaming && isVertexProvider
|
|
178
|
+
? (googleOptions?.streamFunctionCallArguments ?? false)
|
|
179
|
+
: undefined;
|
|
176
180
|
|
|
177
181
|
const toolConfig =
|
|
178
182
|
googleToolConfig ||
|
|
@@ -468,7 +472,10 @@ export class GoogleGenerativeAILanguageModel implements LanguageModelV3 {
|
|
|
468
472
|
async doStream(
|
|
469
473
|
options: LanguageModelV3CallOptions,
|
|
470
474
|
): Promise<LanguageModelV3StreamResult> {
|
|
471
|
-
const { args, warnings, providerOptionsName } = await this.getArgs(
|
|
475
|
+
const { args, warnings, providerOptionsName } = await this.getArgs(
|
|
476
|
+
options,
|
|
477
|
+
{ isStreaming: true },
|
|
478
|
+
);
|
|
472
479
|
|
|
473
480
|
const headers = combineHeaders(
|
|
474
481
|
await resolve(this.config.headers),
|
|
@@ -192,9 +192,10 @@ export const googleLanguageModelOptions = lazySchema(() =>
|
|
|
192
192
|
/**
|
|
193
193
|
* Optional. When set to true, function call arguments will be streamed
|
|
194
194
|
* incrementally via partialArgs in streaming responses. Only supported
|
|
195
|
-
* on the Vertex AI API (not the Gemini API)
|
|
195
|
+
* on the Vertex AI API (not the Gemini API) and only for Gemini 3+
|
|
196
|
+
* models.
|
|
196
197
|
*
|
|
197
|
-
* @default
|
|
198
|
+
* @default false
|
|
198
199
|
*
|
|
199
200
|
* https://docs.cloud.google.com/vertex-ai/generative-ai/docs/multimodal/function-calling#streaming-fc
|
|
200
201
|
*/
|