@ai-sdk/google 2.0.0-alpha.9 → 2.0.0-beta.10

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.
@@ -1,8 +1,9 @@
1
1
  import { LanguageModelV2 } from '@ai-sdk/provider';
2
+ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
2
3
  import { Resolvable, FetchFunction } from '@ai-sdk/provider-utils';
3
- import { z } from 'zod';
4
+ import { z } from 'zod/v4';
4
5
 
5
- type GoogleGenerativeAIModelId = 'gemini-1.5-flash' | 'gemini-1.5-flash-latest' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-flash-8b' | 'gemini-1.5-flash-8b-latest' | 'gemini-1.5-flash-8b-001' | 'gemini-1.5-pro' | 'gemini-1.5-pro-latest' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-live-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-thinking-exp-01-21' | 'gemini-2.0-flash-exp' | 'gemini-2.5-pro-exp-03-25' | 'gemini-2.5-flash-preview-04-17' | 'gemini-exp-1206' | 'gemma-3-27b-it' | 'learnlm-1.5-pro-experimental' | (string & {});
6
+ type GoogleGenerativeAIModelId = 'gemini-1.5-flash' | 'gemini-1.5-flash-latest' | 'gemini-1.5-flash-001' | 'gemini-1.5-flash-002' | 'gemini-1.5-flash-8b' | 'gemini-1.5-flash-8b-latest' | 'gemini-1.5-flash-8b-001' | 'gemini-1.5-pro' | 'gemini-1.5-pro-latest' | 'gemini-1.5-pro-001' | 'gemini-1.5-pro-002' | 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-live-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-pro-exp-02-05' | 'gemini-2.0-flash-thinking-exp-01-21' | 'gemini-2.0-flash-exp' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-pro-exp-03-25' | 'gemini-2.5-flash-preview-04-17' | 'gemini-exp-1206' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
6
7
 
7
8
  type GoogleGenerativeAIConfig = {
8
9
  provider: string;
@@ -19,6 +20,7 @@ declare class GoogleGenerativeAILanguageModel implements LanguageModelV2 {
19
20
  readonly specificationVersion = "v2";
20
21
  readonly modelId: GoogleGenerativeAIModelId;
21
22
  private readonly config;
23
+ private readonly generateId;
22
24
  constructor(modelId: GoogleGenerativeAIModelId, config: GoogleGenerativeAIConfig);
23
25
  get provider(): string;
24
26
  get supportedUrls(): Record<string, RegExp[]> | PromiseLike<Record<string, RegExp[]>>;
@@ -26,168 +28,6 @@ declare class GoogleGenerativeAILanguageModel implements LanguageModelV2 {
26
28
  doGenerate(options: Parameters<LanguageModelV2['doGenerate']>[0]): Promise<Awaited<ReturnType<LanguageModelV2['doGenerate']>>>;
27
29
  doStream(options: Parameters<LanguageModelV2['doStream']>[0]): Promise<Awaited<ReturnType<LanguageModelV2['doStream']>>>;
28
30
  }
29
- declare const groundingMetadataSchema: z.ZodObject<{
30
- webSearchQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
31
- retrievalQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString, "many">>>;
32
- searchEntryPoint: z.ZodOptional<z.ZodNullable<z.ZodObject<{
33
- renderedContent: z.ZodString;
34
- }, "strip", z.ZodTypeAny, {
35
- renderedContent: string;
36
- }, {
37
- renderedContent: string;
38
- }>>>;
39
- groundingChunks: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
40
- web: z.ZodOptional<z.ZodNullable<z.ZodObject<{
41
- uri: z.ZodString;
42
- title: z.ZodString;
43
- }, "strip", z.ZodTypeAny, {
44
- uri: string;
45
- title: string;
46
- }, {
47
- uri: string;
48
- title: string;
49
- }>>>;
50
- retrievedContext: z.ZodOptional<z.ZodNullable<z.ZodObject<{
51
- uri: z.ZodString;
52
- title: z.ZodString;
53
- }, "strip", z.ZodTypeAny, {
54
- uri: string;
55
- title: string;
56
- }, {
57
- uri: string;
58
- title: string;
59
- }>>>;
60
- }, "strip", z.ZodTypeAny, {
61
- web?: {
62
- uri: string;
63
- title: string;
64
- } | null | undefined;
65
- retrievedContext?: {
66
- uri: string;
67
- title: string;
68
- } | null | undefined;
69
- }, {
70
- web?: {
71
- uri: string;
72
- title: string;
73
- } | null | undefined;
74
- retrievedContext?: {
75
- uri: string;
76
- title: string;
77
- } | null | undefined;
78
- }>, "many">>>;
79
- groundingSupports: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
80
- segment: z.ZodObject<{
81
- startIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
82
- endIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
83
- text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
84
- }, "strip", z.ZodTypeAny, {
85
- startIndex?: number | null | undefined;
86
- endIndex?: number | null | undefined;
87
- text?: string | null | undefined;
88
- }, {
89
- startIndex?: number | null | undefined;
90
- endIndex?: number | null | undefined;
91
- text?: string | null | undefined;
92
- }>;
93
- segment_text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
94
- groundingChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>>;
95
- supportChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>>;
96
- confidenceScores: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>>;
97
- confidenceScore: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber, "many">>>;
98
- }, "strip", z.ZodTypeAny, {
99
- segment: {
100
- startIndex?: number | null | undefined;
101
- endIndex?: number | null | undefined;
102
- text?: string | null | undefined;
103
- };
104
- segment_text?: string | null | undefined;
105
- groundingChunkIndices?: number[] | null | undefined;
106
- supportChunkIndices?: number[] | null | undefined;
107
- confidenceScores?: number[] | null | undefined;
108
- confidenceScore?: number[] | null | undefined;
109
- }, {
110
- segment: {
111
- startIndex?: number | null | undefined;
112
- endIndex?: number | null | undefined;
113
- text?: string | null | undefined;
114
- };
115
- segment_text?: string | null | undefined;
116
- groundingChunkIndices?: number[] | null | undefined;
117
- supportChunkIndices?: number[] | null | undefined;
118
- confidenceScores?: number[] | null | undefined;
119
- confidenceScore?: number[] | null | undefined;
120
- }>, "many">>>;
121
- retrievalMetadata: z.ZodOptional<z.ZodNullable<z.ZodUnion<[z.ZodObject<{
122
- webDynamicRetrievalScore: z.ZodNumber;
123
- }, "strip", z.ZodTypeAny, {
124
- webDynamicRetrievalScore: number;
125
- }, {
126
- webDynamicRetrievalScore: number;
127
- }>, z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>]>>>;
128
- }, "strip", z.ZodTypeAny, {
129
- webSearchQueries?: string[] | null | undefined;
130
- retrievalQueries?: string[] | null | undefined;
131
- searchEntryPoint?: {
132
- renderedContent: string;
133
- } | null | undefined;
134
- groundingChunks?: {
135
- web?: {
136
- uri: string;
137
- title: string;
138
- } | null | undefined;
139
- retrievedContext?: {
140
- uri: string;
141
- title: string;
142
- } | null | undefined;
143
- }[] | null | undefined;
144
- groundingSupports?: {
145
- segment: {
146
- startIndex?: number | null | undefined;
147
- endIndex?: number | null | undefined;
148
- text?: string | null | undefined;
149
- };
150
- segment_text?: string | null | undefined;
151
- groundingChunkIndices?: number[] | null | undefined;
152
- supportChunkIndices?: number[] | null | undefined;
153
- confidenceScores?: number[] | null | undefined;
154
- confidenceScore?: number[] | null | undefined;
155
- }[] | null | undefined;
156
- retrievalMetadata?: {
157
- webDynamicRetrievalScore: number;
158
- } | {} | null | undefined;
159
- }, {
160
- webSearchQueries?: string[] | null | undefined;
161
- retrievalQueries?: string[] | null | undefined;
162
- searchEntryPoint?: {
163
- renderedContent: string;
164
- } | null | undefined;
165
- groundingChunks?: {
166
- web?: {
167
- uri: string;
168
- title: string;
169
- } | null | undefined;
170
- retrievedContext?: {
171
- uri: string;
172
- title: string;
173
- } | null | undefined;
174
- }[] | null | undefined;
175
- groundingSupports?: {
176
- segment: {
177
- startIndex?: number | null | undefined;
178
- endIndex?: number | null | undefined;
179
- text?: string | null | undefined;
180
- };
181
- segment_text?: string | null | undefined;
182
- groundingChunkIndices?: number[] | null | undefined;
183
- supportChunkIndices?: number[] | null | undefined;
184
- confidenceScores?: number[] | null | undefined;
185
- confidenceScore?: number[] | null | undefined;
186
- }[] | null | undefined;
187
- retrievalMetadata?: {
188
- webDynamicRetrievalScore: number;
189
- } | {} | null | undefined;
190
- }>;
191
31
  declare const safetyRatingSchema: z.ZodObject<{
192
32
  category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
193
33
  probability: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -195,20 +35,22 @@ declare const safetyRatingSchema: z.ZodObject<{
195
35
  severity: z.ZodOptional<z.ZodNullable<z.ZodString>>;
196
36
  severityScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
197
37
  blocked: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
198
- }, "strip", z.ZodTypeAny, {
199
- category?: string | null | undefined;
200
- probability?: string | null | undefined;
201
- probabilityScore?: number | null | undefined;
202
- severity?: string | null | undefined;
203
- severityScore?: number | null | undefined;
204
- blocked?: boolean | null | undefined;
205
- }, {
206
- category?: string | null | undefined;
207
- probability?: string | null | undefined;
208
- probabilityScore?: number | null | undefined;
209
- severity?: string | null | undefined;
210
- severityScore?: number | null | undefined;
211
- blocked?: boolean | null | undefined;
212
- }>;
38
+ }, z.core.$strip>;
213
39
 
214
- export { GoogleGenerativeAILanguageModel, groundingMetadataSchema, safetyRatingSchema };
40
+ declare const googleTools: {
41
+ /**
42
+ * Creates a Google search tool that gives Google direct access to real-time web content.
43
+ * Must have name "google_search".
44
+ */
45
+ googleSearch: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {
46
+ mode?: "MODE_DYNAMIC" | "MODE_UNSPECIFIED";
47
+ dynamicThreshold?: number;
48
+ }>;
49
+ /**
50
+ * Creates a URL context tool that gives Google direct access to real-time web content.
51
+ * Must have name "url_context".
52
+ */
53
+ urlContext: _ai_sdk_provider_utils.ProviderDefinedToolFactory<{}, {}>;
54
+ };
55
+
56
+ export { GoogleGenerativeAILanguageModel, type GoogleGenerativeAIModelId, googleTools, safetyRatingSchema };