@ai-sdk/google 4.0.0-beta.45 → 4.0.0-beta.46
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.d.ts +7 -7
- package/dist/index.js +57 -54
- package/dist/index.js.map +1 -1
- package/dist/internal/index.d.ts +7 -7
- package/dist/internal/index.js +40 -37
- package/dist/internal/index.js.map +1 -1
- package/package.json +5 -4
- package/src/convert-to-google-messages.ts +1 -1
- package/src/google-language-model.ts +1 -0
- package/src/google-prepare-tools.ts +6 -2
- package/src/tool/code-execution.ts +2 -2
- package/src/tool/enterprise-web-search.ts +9 -3
- package/src/tool/file-search.ts +5 -7
- package/src/tool/google-maps.ts +3 -2
- package/src/tool/google-search.ts +10 -11
- package/src/tool/url-context.ts +4 -2
- package/src/tool/vertex-rag-store.ts +9 -6
package/dist/internal/index.d.ts
CHANGED
|
@@ -246,7 +246,7 @@ declare const googleTools: {
|
|
|
246
246
|
* Creates a Google search tool that gives Google direct access to real-time web content.
|
|
247
247
|
* Must have name "google_search".
|
|
248
248
|
*/
|
|
249
|
-
googleSearch: _ai_sdk_provider_utils.
|
|
249
|
+
googleSearch: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {}, {
|
|
250
250
|
[x: string]: unknown;
|
|
251
251
|
searchTypes?: {
|
|
252
252
|
webSearch?: Record<string, never> | undefined;
|
|
@@ -267,7 +267,7 @@ declare const googleTools: {
|
|
|
267
267
|
*
|
|
268
268
|
* @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/web-grounding-enterprise
|
|
269
269
|
*/
|
|
270
|
-
enterpriseWebSearch: _ai_sdk_provider_utils.
|
|
270
|
+
enterpriseWebSearch: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {}, {}, {}>;
|
|
271
271
|
/**
|
|
272
272
|
* Creates a Google Maps grounding tool that gives the model access to Google Maps data.
|
|
273
273
|
* Must have name "google_maps".
|
|
@@ -275,12 +275,12 @@ declare const googleTools: {
|
|
|
275
275
|
* @see https://ai.google.dev/gemini-api/docs/maps-grounding
|
|
276
276
|
* @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-maps
|
|
277
277
|
*/
|
|
278
|
-
googleMaps: _ai_sdk_provider_utils.
|
|
278
|
+
googleMaps: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {}, {}, {}>;
|
|
279
279
|
/**
|
|
280
280
|
* Creates a URL context tool that gives Google direct access to real-time web content.
|
|
281
281
|
* Must have name "url_context".
|
|
282
282
|
*/
|
|
283
|
-
urlContext: _ai_sdk_provider_utils.
|
|
283
|
+
urlContext: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {}, {}, {}>;
|
|
284
284
|
/**
|
|
285
285
|
* Enables Retrieval Augmented Generation (RAG) via the Gemini File Search tool.
|
|
286
286
|
* Must have name "file_search".
|
|
@@ -291,7 +291,7 @@ declare const googleTools: {
|
|
|
291
291
|
*
|
|
292
292
|
* @see https://ai.google.dev/gemini-api/docs/file-search
|
|
293
293
|
*/
|
|
294
|
-
fileSearch: _ai_sdk_provider_utils.
|
|
294
|
+
fileSearch: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {}, {
|
|
295
295
|
[x: string]: unknown;
|
|
296
296
|
fileSearchStoreNames: string[];
|
|
297
297
|
topK?: number | undefined;
|
|
@@ -307,7 +307,7 @@ declare const googleTools: {
|
|
|
307
307
|
* @see https://ai.google.dev/gemini-api/docs/code-execution (Google AI)
|
|
308
308
|
* @see https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/code-execution-api (Vertex AI)
|
|
309
309
|
*/
|
|
310
|
-
codeExecution: _ai_sdk_provider_utils.
|
|
310
|
+
codeExecution: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{
|
|
311
311
|
language: string;
|
|
312
312
|
code: string;
|
|
313
313
|
}, {
|
|
@@ -318,7 +318,7 @@ declare const googleTools: {
|
|
|
318
318
|
* Creates a Vertex RAG Store tool that enables the model to perform RAG searches against a Vertex RAG Store.
|
|
319
319
|
* Must have name "vertex_rag_store".
|
|
320
320
|
*/
|
|
321
|
-
vertexRagStore: _ai_sdk_provider_utils.
|
|
321
|
+
vertexRagStore: _ai_sdk_provider_utils.ProviderExecutedToolFactory<{}, {}, {
|
|
322
322
|
ragCorpus: string;
|
|
323
323
|
topK?: number;
|
|
324
324
|
}, {}>;
|
package/dist/internal/index.js
CHANGED
|
@@ -506,7 +506,7 @@ function convertToGoogleMessages(prompt, options) {
|
|
|
506
506
|
name: part.toolName,
|
|
507
507
|
response: {
|
|
508
508
|
name: part.toolName,
|
|
509
|
-
content: output.type === "execution-denied" ? (_h = output.reason) != null ? _h : "Tool execution denied." : output.value
|
|
509
|
+
content: output.type === "execution-denied" ? (_h = output.reason) != null ? _h : "Tool call execution denied." : output.value
|
|
510
510
|
}
|
|
511
511
|
}
|
|
512
512
|
});
|
|
@@ -707,7 +707,8 @@ import {
|
|
|
707
707
|
function prepareTools({
|
|
708
708
|
tools,
|
|
709
709
|
toolChoice,
|
|
710
|
-
modelId
|
|
710
|
+
modelId,
|
|
711
|
+
isVertexProvider = false
|
|
711
712
|
}) {
|
|
712
713
|
var _a, _b;
|
|
713
714
|
tools = (tools == null ? void 0 : tools.length) ? tools : void 0;
|
|
@@ -843,7 +844,9 @@ function prepareTools({
|
|
|
843
844
|
}
|
|
844
845
|
const combinedToolConfig = {
|
|
845
846
|
functionCallingConfig: { mode: "VALIDATED" },
|
|
846
|
-
|
|
847
|
+
...!isVertexProvider && {
|
|
848
|
+
includeServerSideToolInvocations: true
|
|
849
|
+
}
|
|
847
850
|
};
|
|
848
851
|
if (toolChoice != null) {
|
|
849
852
|
switch (toolChoice.type) {
|
|
@@ -1290,7 +1293,8 @@ var GoogleLanguageModel = class _GoogleLanguageModel {
|
|
|
1290
1293
|
} = prepareTools({
|
|
1291
1294
|
tools,
|
|
1292
1295
|
toolChoice,
|
|
1293
|
-
modelId: this.modelId
|
|
1296
|
+
modelId: this.modelId,
|
|
1297
|
+
isVertexProvider
|
|
1294
1298
|
});
|
|
1295
1299
|
const resolvedThinking = resolveThinkingConfig({
|
|
1296
1300
|
reasoning,
|
|
@@ -2282,9 +2286,9 @@ var chunkSchema = lazySchema3(
|
|
|
2282
2286
|
);
|
|
2283
2287
|
|
|
2284
2288
|
// src/tool/code-execution.ts
|
|
2285
|
-
import {
|
|
2289
|
+
import { createProviderExecutedToolFactory } from "@ai-sdk/provider-utils";
|
|
2286
2290
|
import { z as z4 } from "zod/v4";
|
|
2287
|
-
var codeExecution =
|
|
2291
|
+
var codeExecution = createProviderExecutedToolFactory({
|
|
2288
2292
|
id: "google.code_execution",
|
|
2289
2293
|
inputSchema: z4.object({
|
|
2290
2294
|
language: z4.string().describe("The programming language of the code."),
|
|
@@ -2298,19 +2302,20 @@ var codeExecution = createProviderToolFactoryWithOutputSchema({
|
|
|
2298
2302
|
|
|
2299
2303
|
// src/tool/enterprise-web-search.ts
|
|
2300
2304
|
import {
|
|
2301
|
-
|
|
2305
|
+
createProviderExecutedToolFactory as createProviderExecutedToolFactory2,
|
|
2302
2306
|
lazySchema as lazySchema4,
|
|
2303
2307
|
zodSchema as zodSchema4
|
|
2304
2308
|
} from "@ai-sdk/provider-utils";
|
|
2305
2309
|
import { z as z5 } from "zod/v4";
|
|
2306
|
-
var enterpriseWebSearch =
|
|
2310
|
+
var enterpriseWebSearch = createProviderExecutedToolFactory2({
|
|
2307
2311
|
id: "google.enterprise_web_search",
|
|
2308
|
-
inputSchema: lazySchema4(() => zodSchema4(z5.object({})))
|
|
2312
|
+
inputSchema: lazySchema4(() => zodSchema4(z5.object({}))),
|
|
2313
|
+
outputSchema: lazySchema4(() => zodSchema4(z5.object({})))
|
|
2309
2314
|
});
|
|
2310
2315
|
|
|
2311
2316
|
// src/tool/file-search.ts
|
|
2312
2317
|
import {
|
|
2313
|
-
|
|
2318
|
+
createProviderExecutedToolFactory as createProviderExecutedToolFactory3,
|
|
2314
2319
|
lazySchema as lazySchema5,
|
|
2315
2320
|
zodSchema as zodSchema5
|
|
2316
2321
|
} from "@ai-sdk/provider-utils";
|
|
@@ -2331,29 +2336,28 @@ var fileSearchArgsBaseSchema = z6.object({
|
|
|
2331
2336
|
"Metadata filter to apply to the file search retrieval documents. See https://google.aip.dev/160 for the syntax of the filter expression."
|
|
2332
2337
|
).optional()
|
|
2333
2338
|
}).passthrough();
|
|
2334
|
-
var
|
|
2335
|
-
() => zodSchema5(fileSearchArgsBaseSchema)
|
|
2336
|
-
);
|
|
2337
|
-
var fileSearch = createProviderToolFactory2({
|
|
2339
|
+
var fileSearch = createProviderExecutedToolFactory3({
|
|
2338
2340
|
id: "google.file_search",
|
|
2339
|
-
inputSchema:
|
|
2341
|
+
inputSchema: lazySchema5(() => zodSchema5(z6.object({}))),
|
|
2342
|
+
outputSchema: lazySchema5(() => zodSchema5(z6.object({})))
|
|
2340
2343
|
});
|
|
2341
2344
|
|
|
2342
2345
|
// src/tool/google-maps.ts
|
|
2343
2346
|
import {
|
|
2344
|
-
|
|
2347
|
+
createProviderExecutedToolFactory as createProviderExecutedToolFactory4,
|
|
2345
2348
|
lazySchema as lazySchema6,
|
|
2346
2349
|
zodSchema as zodSchema6
|
|
2347
2350
|
} from "@ai-sdk/provider-utils";
|
|
2348
2351
|
import { z as z7 } from "zod/v4";
|
|
2349
|
-
var googleMaps =
|
|
2352
|
+
var googleMaps = createProviderExecutedToolFactory4({
|
|
2350
2353
|
id: "google.google_maps",
|
|
2351
|
-
inputSchema: lazySchema6(() => zodSchema6(z7.object({})))
|
|
2354
|
+
inputSchema: lazySchema6(() => zodSchema6(z7.object({}))),
|
|
2355
|
+
outputSchema: lazySchema6(() => zodSchema6(z7.object({})))
|
|
2352
2356
|
});
|
|
2353
2357
|
|
|
2354
2358
|
// src/tool/google-search.ts
|
|
2355
2359
|
import {
|
|
2356
|
-
|
|
2360
|
+
createProviderExecutedToolFactory as createProviderExecutedToolFactory5,
|
|
2357
2361
|
lazySchema as lazySchema7,
|
|
2358
2362
|
zodSchema as zodSchema7
|
|
2359
2363
|
} from "@ai-sdk/provider-utils";
|
|
@@ -2368,37 +2372,36 @@ var googleSearchToolArgsBaseSchema = z8.object({
|
|
|
2368
2372
|
endTime: z8.string()
|
|
2369
2373
|
}).optional()
|
|
2370
2374
|
}).passthrough();
|
|
2371
|
-
var
|
|
2372
|
-
|
|
2373
|
-
)
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
id: "google.google_search",
|
|
2377
|
-
inputSchema: googleSearchToolArgsSchema
|
|
2378
|
-
}
|
|
2379
|
-
);
|
|
2375
|
+
var googleSearch = createProviderExecutedToolFactory5({
|
|
2376
|
+
id: "google.google_search",
|
|
2377
|
+
inputSchema: lazySchema7(() => zodSchema7(z8.object({}))),
|
|
2378
|
+
outputSchema: lazySchema7(() => zodSchema7(z8.object({})))
|
|
2379
|
+
});
|
|
2380
2380
|
|
|
2381
2381
|
// src/tool/url-context.ts
|
|
2382
2382
|
import {
|
|
2383
|
-
|
|
2383
|
+
createProviderExecutedToolFactory as createProviderExecutedToolFactory6,
|
|
2384
2384
|
lazySchema as lazySchema8,
|
|
2385
2385
|
zodSchema as zodSchema8
|
|
2386
2386
|
} from "@ai-sdk/provider-utils";
|
|
2387
2387
|
import { z as z9 } from "zod/v4";
|
|
2388
|
-
var urlContext =
|
|
2388
|
+
var urlContext = createProviderExecutedToolFactory6({
|
|
2389
2389
|
id: "google.url_context",
|
|
2390
|
-
inputSchema: lazySchema8(() => zodSchema8(z9.object({})))
|
|
2390
|
+
inputSchema: lazySchema8(() => zodSchema8(z9.object({}))),
|
|
2391
|
+
outputSchema: lazySchema8(() => zodSchema8(z9.object({})))
|
|
2391
2392
|
});
|
|
2392
2393
|
|
|
2393
2394
|
// src/tool/vertex-rag-store.ts
|
|
2394
|
-
import {
|
|
2395
|
+
import {
|
|
2396
|
+
createProviderExecutedToolFactory as createProviderExecutedToolFactory7,
|
|
2397
|
+
lazySchema as lazySchema9,
|
|
2398
|
+
zodSchema as zodSchema9
|
|
2399
|
+
} from "@ai-sdk/provider-utils";
|
|
2395
2400
|
import { z as z10 } from "zod/v4";
|
|
2396
|
-
var vertexRagStore =
|
|
2401
|
+
var vertexRagStore = createProviderExecutedToolFactory7({
|
|
2397
2402
|
id: "google.vertex_rag_store",
|
|
2398
|
-
inputSchema: z10.object({
|
|
2399
|
-
|
|
2400
|
-
topK: z10.number().optional()
|
|
2401
|
-
})
|
|
2403
|
+
inputSchema: lazySchema9(() => zodSchema9(z10.object({}))),
|
|
2404
|
+
outputSchema: lazySchema9(() => zodSchema9(z10.object({})))
|
|
2402
2405
|
});
|
|
2403
2406
|
|
|
2404
2407
|
// src/google-tools.ts
|