@ai-sdk/google 2.0.0-beta.6 → 2.0.0-beta.8

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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 2.0.0-beta.8
4
+
5
+ ### Patch Changes
6
+
7
+ - 2e06f14: feat (provider/google): Change to provider defined tools
8
+
9
+ - Change the google search tool to be a provider defined tool
10
+ - Added new URL context tool as a provider defined tool
11
+
12
+ ## 2.0.0-beta.7
13
+
14
+ ### Patch Changes
15
+
16
+ - 19a4336: Expose raw usageMetadata returned from Google Generative AI in providerMetadata
17
+
3
18
  ## 2.0.0-beta.6
4
19
 
5
20
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod/v4';
2
2
  import { ProviderV2, LanguageModelV2, EmbeddingModelV2 } from '@ai-sdk/provider';
3
+ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
4
  import { FetchFunction } from '@ai-sdk/provider-utils';
4
5
 
5
6
  declare const googleErrorDataSchema: z.ZodObject<{
@@ -50,14 +51,6 @@ declare const googleGenerativeAIProviderOptions: z.ZodObject<{
50
51
  OFF: "OFF";
51
52
  }>>;
52
53
  audioTimestamp: z.ZodOptional<z.ZodBoolean>;
53
- useSearchGrounding: z.ZodOptional<z.ZodBoolean>;
54
- dynamicRetrievalConfig: z.ZodOptional<z.ZodObject<{
55
- mode: z.ZodOptional<z.ZodEnum<{
56
- MODE_UNSPECIFIED: "MODE_UNSPECIFIED";
57
- MODE_DYNAMIC: "MODE_DYNAMIC";
58
- }>>;
59
- dynamicThreshold: z.ZodOptional<z.ZodNumber>;
60
- }, z.core.$strip>>;
61
54
  }, z.core.$strip>;
62
55
  type GoogleGenerativeAIProviderOptions = z.infer<typeof googleGenerativeAIProviderOptions>;
63
56
 
@@ -93,6 +86,14 @@ declare const groundingMetadataSchema: z.ZodObject<{
93
86
  webDynamicRetrievalScore: z.ZodNumber;
94
87
  }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>]>>>;
95
88
  }, z.core.$strip>;
89
+
90
+ declare const urlContextMetadataSchema: z.ZodObject<{
91
+ urlMetadata: z.ZodArray<z.ZodObject<{
92
+ retrievedUrl: z.ZodString;
93
+ urlRetrievalStatus: z.ZodString;
94
+ }, z.core.$strip>>;
95
+ }, z.core.$strip>;
96
+
96
97
  declare const safetyRatingSchema: z.ZodObject<{
97
98
  category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
98
99
  probability: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -103,14 +104,32 @@ declare const safetyRatingSchema: z.ZodObject<{
103
104
  }, z.core.$strip>;
104
105
 
105
106
  type GoogleGenerativeAIGroundingMetadata = z.infer<typeof groundingMetadataSchema>;
107
+ type GoogleGenerativeAIUrlContextMetadata = z.infer<typeof urlContextMetadataSchema>;
106
108
  type GoogleGenerativeAISafetyRating = z.infer<typeof safetyRatingSchema>;
107
109
  interface GoogleGenerativeAIProviderMetadata {
108
110
  groundingMetadata: GoogleGenerativeAIGroundingMetadata | null;
111
+ urlContextMetadata: GoogleGenerativeAIUrlContextMetadata | null;
109
112
  safetyRatings: GoogleGenerativeAISafetyRating[] | null;
110
113
  }
111
114
 
112
115
  type GoogleGenerativeAIEmbeddingModelId = 'text-embedding-004' | (string & {});
113
116
 
117
+ declare const googleTools: {
118
+ /**
119
+ * Creates a Google search tool that gives Google direct access to real-time web content.
120
+ * Must have name "google_search".
121
+ */
122
+ googleSearch: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {
123
+ mode?: "MODE_DYNAMIC" | "MODE_UNSPECIFIED";
124
+ dynamicThreshold?: number;
125
+ }>;
126
+ /**
127
+ * Creates a URL context tool that gives Google direct access to real-time web content.
128
+ * Must have name "url_context".
129
+ */
130
+ urlContext: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {}>;
131
+ };
132
+
114
133
  interface GoogleGenerativeAIProvider extends ProviderV2 {
115
134
  (modelId: GoogleGenerativeAIModelId): LanguageModelV2;
116
135
  languageModel(modelId: GoogleGenerativeAIModelId): LanguageModelV2;
@@ -128,6 +147,7 @@ interface GoogleGenerativeAIProvider extends ProviderV2 {
128
147
  */
129
148
  textEmbedding(modelId: GoogleGenerativeAIEmbeddingModelId): EmbeddingModelV2<string>;
130
149
  textEmbeddingModel(modelId: GoogleGenerativeAIEmbeddingModelId): EmbeddingModelV2<string>;
150
+ tools: typeof googleTools;
131
151
  }
132
152
  interface GoogleGenerativeAIProviderSettings {
133
153
  /**
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { z } from 'zod/v4';
2
2
  import { ProviderV2, LanguageModelV2, EmbeddingModelV2 } from '@ai-sdk/provider';
3
+ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
3
4
  import { FetchFunction } from '@ai-sdk/provider-utils';
4
5
 
5
6
  declare const googleErrorDataSchema: z.ZodObject<{
@@ -50,14 +51,6 @@ declare const googleGenerativeAIProviderOptions: z.ZodObject<{
50
51
  OFF: "OFF";
51
52
  }>>;
52
53
  audioTimestamp: z.ZodOptional<z.ZodBoolean>;
53
- useSearchGrounding: z.ZodOptional<z.ZodBoolean>;
54
- dynamicRetrievalConfig: z.ZodOptional<z.ZodObject<{
55
- mode: z.ZodOptional<z.ZodEnum<{
56
- MODE_UNSPECIFIED: "MODE_UNSPECIFIED";
57
- MODE_DYNAMIC: "MODE_DYNAMIC";
58
- }>>;
59
- dynamicThreshold: z.ZodOptional<z.ZodNumber>;
60
- }, z.core.$strip>>;
61
54
  }, z.core.$strip>;
62
55
  type GoogleGenerativeAIProviderOptions = z.infer<typeof googleGenerativeAIProviderOptions>;
63
56
 
@@ -93,6 +86,14 @@ declare const groundingMetadataSchema: z.ZodObject<{
93
86
  webDynamicRetrievalScore: z.ZodNumber;
94
87
  }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>]>>>;
95
88
  }, z.core.$strip>;
89
+
90
+ declare const urlContextMetadataSchema: z.ZodObject<{
91
+ urlMetadata: z.ZodArray<z.ZodObject<{
92
+ retrievedUrl: z.ZodString;
93
+ urlRetrievalStatus: z.ZodString;
94
+ }, z.core.$strip>>;
95
+ }, z.core.$strip>;
96
+
96
97
  declare const safetyRatingSchema: z.ZodObject<{
97
98
  category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
98
99
  probability: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -103,14 +104,32 @@ declare const safetyRatingSchema: z.ZodObject<{
103
104
  }, z.core.$strip>;
104
105
 
105
106
  type GoogleGenerativeAIGroundingMetadata = z.infer<typeof groundingMetadataSchema>;
107
+ type GoogleGenerativeAIUrlContextMetadata = z.infer<typeof urlContextMetadataSchema>;
106
108
  type GoogleGenerativeAISafetyRating = z.infer<typeof safetyRatingSchema>;
107
109
  interface GoogleGenerativeAIProviderMetadata {
108
110
  groundingMetadata: GoogleGenerativeAIGroundingMetadata | null;
111
+ urlContextMetadata: GoogleGenerativeAIUrlContextMetadata | null;
109
112
  safetyRatings: GoogleGenerativeAISafetyRating[] | null;
110
113
  }
111
114
 
112
115
  type GoogleGenerativeAIEmbeddingModelId = 'text-embedding-004' | (string & {});
113
116
 
117
+ declare const googleTools: {
118
+ /**
119
+ * Creates a Google search tool that gives Google direct access to real-time web content.
120
+ * Must have name "google_search".
121
+ */
122
+ googleSearch: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {
123
+ mode?: "MODE_DYNAMIC" | "MODE_UNSPECIFIED";
124
+ dynamicThreshold?: number;
125
+ }>;
126
+ /**
127
+ * Creates a URL context tool that gives Google direct access to real-time web content.
128
+ * Must have name "url_context".
129
+ */
130
+ urlContext: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {}>;
131
+ };
132
+
114
133
  interface GoogleGenerativeAIProvider extends ProviderV2 {
115
134
  (modelId: GoogleGenerativeAIModelId): LanguageModelV2;
116
135
  languageModel(modelId: GoogleGenerativeAIModelId): LanguageModelV2;
@@ -128,6 +147,7 @@ interface GoogleGenerativeAIProvider extends ProviderV2 {
128
147
  */
129
148
  textEmbedding(modelId: GoogleGenerativeAIEmbeddingModelId): EmbeddingModelV2<string>;
130
149
  textEmbeddingModel(modelId: GoogleGenerativeAIEmbeddingModelId): EmbeddingModelV2<string>;
150
+ tools: typeof googleTools;
131
151
  }
132
152
  interface GoogleGenerativeAIProviderSettings {
133
153
  /**