@depup/ai-sdk__google 3.0.43-depup.0
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 +2531 -0
- package/LICENSE +13 -0
- package/README.md +25 -0
- package/changes.json +5 -0
- package/dist/index.d.mts +367 -0
- package/dist/index.d.ts +367 -0
- package/dist/index.js +2404 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2454 -0
- package/dist/index.mjs.map +1 -0
- package/dist/internal/index.d.mts +283 -0
- package/dist/internal/index.d.ts +283 -0
- package/dist/internal/index.js +1670 -0
- package/dist/internal/index.js.map +1 -0
- package/dist/internal/index.mjs +1678 -0
- package/dist/internal/index.mjs.map +1 -0
- package/docs/15-google-generative-ai.mdx +1298 -0
- package/internal.d.ts +1 -0
- package/package.json +96 -0
- package/src/convert-google-generative-ai-usage.ts +51 -0
- package/src/convert-json-schema-to-openapi-schema.ts +158 -0
- package/src/convert-to-google-generative-ai-messages.ts +236 -0
- package/src/get-model-path.ts +3 -0
- package/src/google-error.ts +26 -0
- package/src/google-generative-ai-embedding-model.ts +159 -0
- package/src/google-generative-ai-embedding-options.ts +51 -0
- package/src/google-generative-ai-image-model.ts +359 -0
- package/src/google-generative-ai-image-settings.ts +17 -0
- package/src/google-generative-ai-language-model.ts +1056 -0
- package/src/google-generative-ai-options.ts +198 -0
- package/src/google-generative-ai-prompt.ts +38 -0
- package/src/google-generative-ai-video-model.ts +374 -0
- package/src/google-generative-ai-video-settings.ts +8 -0
- package/src/google-prepare-tools.ts +254 -0
- package/src/google-provider.ts +227 -0
- package/src/google-supported-file-url.ts +20 -0
- package/src/google-tools.ts +71 -0
- package/src/index.ts +29 -0
- package/src/internal/index.ts +3 -0
- package/src/map-google-generative-ai-finish-reason.ts +29 -0
- package/src/tool/code-execution.ts +35 -0
- package/src/tool/enterprise-web-search.ts +18 -0
- package/src/tool/file-search.ts +51 -0
- package/src/tool/google-maps.ts +14 -0
- package/src/tool/google-search.ts +43 -0
- package/src/tool/url-context.ts +16 -0
- package/src/tool/vertex-rag-store.ts +31 -0
- package/src/version.ts +6 -0
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createProviderToolFactory,
|
|
3
|
+
lazySchema,
|
|
4
|
+
zodSchema,
|
|
5
|
+
} from '@ai-sdk/provider-utils';
|
|
6
|
+
import { z } from 'zod/v4';
|
|
7
|
+
|
|
8
|
+
/** Tool to retrieve knowledge from the File Search Stores. */
|
|
9
|
+
const fileSearchArgsBaseSchema = z
|
|
10
|
+
.object({
|
|
11
|
+
/** The names of the file_search_stores to retrieve from.
|
|
12
|
+
* Example: `fileSearchStores/my-file-search-store-123`
|
|
13
|
+
*/
|
|
14
|
+
fileSearchStoreNames: z
|
|
15
|
+
.array(z.string())
|
|
16
|
+
.describe(
|
|
17
|
+
'The names of the file_search_stores to retrieve from. Example: `fileSearchStores/my-file-search-store-123`',
|
|
18
|
+
),
|
|
19
|
+
/** The number of file search retrieval chunks to retrieve. */
|
|
20
|
+
topK: z
|
|
21
|
+
.number()
|
|
22
|
+
.int()
|
|
23
|
+
.positive()
|
|
24
|
+
.describe('The number of file search retrieval chunks to retrieve.')
|
|
25
|
+
.optional(),
|
|
26
|
+
|
|
27
|
+
/** Metadata filter to apply to the file search retrieval documents.
|
|
28
|
+
* See https://google.aip.dev/160 for the syntax of the filter expression.
|
|
29
|
+
*/
|
|
30
|
+
metadataFilter: z
|
|
31
|
+
.string()
|
|
32
|
+
.describe(
|
|
33
|
+
'Metadata filter to apply to the file search retrieval documents. See https://google.aip.dev/160 for the syntax of the filter expression.',
|
|
34
|
+
)
|
|
35
|
+
.optional(),
|
|
36
|
+
})
|
|
37
|
+
.passthrough();
|
|
38
|
+
|
|
39
|
+
export type GoogleFileSearchToolArgs = z.infer<typeof fileSearchArgsBaseSchema>;
|
|
40
|
+
|
|
41
|
+
const fileSearchArgsSchema = lazySchema(() =>
|
|
42
|
+
zodSchema(fileSearchArgsBaseSchema),
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
export const fileSearch = createProviderToolFactory<
|
|
46
|
+
{},
|
|
47
|
+
GoogleFileSearchToolArgs
|
|
48
|
+
>({
|
|
49
|
+
id: 'google.file_search',
|
|
50
|
+
inputSchema: fileSearchArgsSchema,
|
|
51
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createProviderToolFactory,
|
|
3
|
+
lazySchema,
|
|
4
|
+
zodSchema,
|
|
5
|
+
} from '@ai-sdk/provider-utils';
|
|
6
|
+
import { z } from 'zod/v4';
|
|
7
|
+
|
|
8
|
+
// https://ai.google.dev/gemini-api/docs/maps-grounding
|
|
9
|
+
// https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-maps
|
|
10
|
+
|
|
11
|
+
export const googleMaps = createProviderToolFactory<{}, {}>({
|
|
12
|
+
id: 'google.google_maps',
|
|
13
|
+
inputSchema: lazySchema(() => zodSchema(z.object({}))),
|
|
14
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createProviderToolFactory,
|
|
3
|
+
lazySchema,
|
|
4
|
+
zodSchema,
|
|
5
|
+
} from '@ai-sdk/provider-utils';
|
|
6
|
+
import { z } from 'zod/v4';
|
|
7
|
+
|
|
8
|
+
// https://ai.google.dev/gemini-api/docs/google-search
|
|
9
|
+
// https://ai.google.dev/api/generate-content#GroundingSupport
|
|
10
|
+
// https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-search
|
|
11
|
+
|
|
12
|
+
const googleSearchToolArgsBaseSchema = z
|
|
13
|
+
.object({
|
|
14
|
+
searchTypes: z
|
|
15
|
+
.object({
|
|
16
|
+
webSearch: z.object({}).optional(),
|
|
17
|
+
imageSearch: z.object({}).optional(),
|
|
18
|
+
})
|
|
19
|
+
.optional(),
|
|
20
|
+
|
|
21
|
+
timeRangeFilter: z
|
|
22
|
+
.object({
|
|
23
|
+
startTime: z.string(),
|
|
24
|
+
endTime: z.string(),
|
|
25
|
+
})
|
|
26
|
+
.optional(),
|
|
27
|
+
})
|
|
28
|
+
.passthrough();
|
|
29
|
+
|
|
30
|
+
export type GoogleSearchToolArgs = z.infer<
|
|
31
|
+
typeof googleSearchToolArgsBaseSchema
|
|
32
|
+
>;
|
|
33
|
+
|
|
34
|
+
const googleSearchToolArgsSchema = lazySchema(() =>
|
|
35
|
+
zodSchema(googleSearchToolArgsBaseSchema),
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
export const googleSearch = createProviderToolFactory<{}, GoogleSearchToolArgs>(
|
|
39
|
+
{
|
|
40
|
+
id: 'google.google_search',
|
|
41
|
+
inputSchema: googleSearchToolArgsSchema,
|
|
42
|
+
},
|
|
43
|
+
);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createProviderToolFactory,
|
|
3
|
+
lazySchema,
|
|
4
|
+
zodSchema,
|
|
5
|
+
} from '@ai-sdk/provider-utils';
|
|
6
|
+
import { z } from 'zod/v4';
|
|
7
|
+
|
|
8
|
+
export const urlContext = createProviderToolFactory<
|
|
9
|
+
{
|
|
10
|
+
// Url context does not have any input schema, it will directly use the url from the prompt
|
|
11
|
+
},
|
|
12
|
+
{}
|
|
13
|
+
>({
|
|
14
|
+
id: 'google.url_context',
|
|
15
|
+
inputSchema: lazySchema(() => zodSchema(z.object({}))),
|
|
16
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createProviderToolFactory } from '@ai-sdk/provider-utils';
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
|
|
4
|
+
// https://cloud.google.com/vertex-ai/generative-ai/docs/rag-engine/use-vertexai-search#generate-content-using-gemini-api
|
|
5
|
+
// https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/rag-output-explained
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A tool that enables the model to perform RAG searches against a Vertex RAG Store.
|
|
9
|
+
*
|
|
10
|
+
* @note Only works with Vertex Gemini models.
|
|
11
|
+
*/
|
|
12
|
+
export const vertexRagStore = createProviderToolFactory<
|
|
13
|
+
{},
|
|
14
|
+
{
|
|
15
|
+
/**
|
|
16
|
+
* RagCorpus resource names, eg: projects/{project}/locations/{location}/ragCorpora/{rag_corpus}
|
|
17
|
+
*/
|
|
18
|
+
ragCorpus: string;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The number of top contexts to retrieve.
|
|
22
|
+
*/
|
|
23
|
+
topK?: number;
|
|
24
|
+
}
|
|
25
|
+
>({
|
|
26
|
+
id: 'google.vertex_rag_store',
|
|
27
|
+
inputSchema: z.object({
|
|
28
|
+
ragCorpus: z.string(),
|
|
29
|
+
topK: z.number().optional(),
|
|
30
|
+
}),
|
|
31
|
+
});
|