@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.
Files changed (48) hide show
  1. package/CHANGELOG.md +2531 -0
  2. package/LICENSE +13 -0
  3. package/README.md +25 -0
  4. package/changes.json +5 -0
  5. package/dist/index.d.mts +367 -0
  6. package/dist/index.d.ts +367 -0
  7. package/dist/index.js +2404 -0
  8. package/dist/index.js.map +1 -0
  9. package/dist/index.mjs +2454 -0
  10. package/dist/index.mjs.map +1 -0
  11. package/dist/internal/index.d.mts +283 -0
  12. package/dist/internal/index.d.ts +283 -0
  13. package/dist/internal/index.js +1670 -0
  14. package/dist/internal/index.js.map +1 -0
  15. package/dist/internal/index.mjs +1678 -0
  16. package/dist/internal/index.mjs.map +1 -0
  17. package/docs/15-google-generative-ai.mdx +1298 -0
  18. package/internal.d.ts +1 -0
  19. package/package.json +96 -0
  20. package/src/convert-google-generative-ai-usage.ts +51 -0
  21. package/src/convert-json-schema-to-openapi-schema.ts +158 -0
  22. package/src/convert-to-google-generative-ai-messages.ts +236 -0
  23. package/src/get-model-path.ts +3 -0
  24. package/src/google-error.ts +26 -0
  25. package/src/google-generative-ai-embedding-model.ts +159 -0
  26. package/src/google-generative-ai-embedding-options.ts +51 -0
  27. package/src/google-generative-ai-image-model.ts +359 -0
  28. package/src/google-generative-ai-image-settings.ts +17 -0
  29. package/src/google-generative-ai-language-model.ts +1056 -0
  30. package/src/google-generative-ai-options.ts +198 -0
  31. package/src/google-generative-ai-prompt.ts +38 -0
  32. package/src/google-generative-ai-video-model.ts +374 -0
  33. package/src/google-generative-ai-video-settings.ts +8 -0
  34. package/src/google-prepare-tools.ts +254 -0
  35. package/src/google-provider.ts +227 -0
  36. package/src/google-supported-file-url.ts +20 -0
  37. package/src/google-tools.ts +71 -0
  38. package/src/index.ts +29 -0
  39. package/src/internal/index.ts +3 -0
  40. package/src/map-google-generative-ai-finish-reason.ts +29 -0
  41. package/src/tool/code-execution.ts +35 -0
  42. package/src/tool/enterprise-web-search.ts +18 -0
  43. package/src/tool/file-search.ts +51 -0
  44. package/src/tool/google-maps.ts +14 -0
  45. package/src/tool/google-search.ts +43 -0
  46. package/src/tool/url-context.ts +16 -0
  47. package/src/tool/vertex-rag-store.ts +31 -0
  48. 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
+ });
package/src/version.ts ADDED
@@ -0,0 +1,6 @@
1
+ // Version string of this package injected at build time.
2
+ declare const __PACKAGE_VERSION__: string | undefined;
3
+ export const VERSION: string =
4
+ typeof __PACKAGE_VERSION__ !== 'undefined'
5
+ ? __PACKAGE_VERSION__
6
+ : '0.0.0-test';