@ai-sdk/google 3.0.0-beta.15 → 3.0.0-beta.16

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,13 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 3.0.0-beta.16
4
+
5
+ ### Patch Changes
6
+
7
+ - ee50cc5: fix(provider/google): lazy schema loading
8
+
9
+ import time improved by 12.5% (22.3ms ➡️ 19.5ms)
10
+
3
11
  ## 3.0.0-beta.15
4
12
 
5
13
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,118 +1,138 @@
1
- import * as z from 'zod/v4';
2
- import { ProviderV3, LanguageModelV3, ImageModelV3, EmbeddingModelV3 } from '@ai-sdk/provider';
3
1
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
4
- import { FetchFunction } from '@ai-sdk/provider-utils';
2
+ import { InferValidator, FetchFunction } from '@ai-sdk/provider-utils';
3
+ import { ProviderV3, LanguageModelV3, ImageModelV3, EmbeddingModelV3 } from '@ai-sdk/provider';
5
4
 
6
- declare const googleErrorDataSchema: z.ZodObject<{
7
- error: z.ZodObject<{
8
- code: z.ZodNullable<z.ZodNumber>;
9
- message: z.ZodString;
10
- status: z.ZodString;
11
- }, z.core.$strip>;
12
- }, z.core.$strip>;
13
- type GoogleErrorData = z.infer<typeof googleErrorDataSchema>;
5
+ declare const googleErrorDataSchema: _ai_sdk_provider_utils.LazySchema<{
6
+ error: {
7
+ code: number | null;
8
+ message: string;
9
+ status: string;
10
+ };
11
+ }>;
12
+ type GoogleErrorData = InferValidator<typeof googleErrorDataSchema>;
14
13
 
15
14
  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-flash-image-preview' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-preview-04-17' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'gemini-2.5-pro-exp-03-25' | 'gemini-exp-1206' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
16
- declare const googleGenerativeAIProviderOptions: z.ZodObject<{
17
- responseModalities: z.ZodOptional<z.ZodArray<z.ZodEnum<{
18
- TEXT: "TEXT";
19
- IMAGE: "IMAGE";
20
- }>>>;
21
- thinkingConfig: z.ZodOptional<z.ZodObject<{
22
- thinkingBudget: z.ZodOptional<z.ZodNumber>;
23
- includeThoughts: z.ZodOptional<z.ZodBoolean>;
24
- }, z.core.$strip>>;
25
- cachedContent: z.ZodOptional<z.ZodString>;
26
- structuredOutputs: z.ZodOptional<z.ZodBoolean>;
27
- safetySettings: z.ZodOptional<z.ZodArray<z.ZodObject<{
28
- category: z.ZodEnum<{
29
- HARM_CATEGORY_UNSPECIFIED: "HARM_CATEGORY_UNSPECIFIED";
30
- HARM_CATEGORY_HATE_SPEECH: "HARM_CATEGORY_HATE_SPEECH";
31
- HARM_CATEGORY_DANGEROUS_CONTENT: "HARM_CATEGORY_DANGEROUS_CONTENT";
32
- HARM_CATEGORY_HARASSMENT: "HARM_CATEGORY_HARASSMENT";
33
- HARM_CATEGORY_SEXUALLY_EXPLICIT: "HARM_CATEGORY_SEXUALLY_EXPLICIT";
34
- HARM_CATEGORY_CIVIC_INTEGRITY: "HARM_CATEGORY_CIVIC_INTEGRITY";
35
- }>;
36
- threshold: z.ZodEnum<{
37
- HARM_BLOCK_THRESHOLD_UNSPECIFIED: "HARM_BLOCK_THRESHOLD_UNSPECIFIED";
38
- BLOCK_LOW_AND_ABOVE: "BLOCK_LOW_AND_ABOVE";
39
- BLOCK_MEDIUM_AND_ABOVE: "BLOCK_MEDIUM_AND_ABOVE";
40
- BLOCK_ONLY_HIGH: "BLOCK_ONLY_HIGH";
41
- BLOCK_NONE: "BLOCK_NONE";
42
- OFF: "OFF";
43
- }>;
44
- }, z.core.$strip>>>;
45
- threshold: z.ZodOptional<z.ZodEnum<{
46
- HARM_BLOCK_THRESHOLD_UNSPECIFIED: "HARM_BLOCK_THRESHOLD_UNSPECIFIED";
47
- BLOCK_LOW_AND_ABOVE: "BLOCK_LOW_AND_ABOVE";
48
- BLOCK_MEDIUM_AND_ABOVE: "BLOCK_MEDIUM_AND_ABOVE";
49
- BLOCK_ONLY_HIGH: "BLOCK_ONLY_HIGH";
50
- BLOCK_NONE: "BLOCK_NONE";
51
- OFF: "OFF";
52
- }>>;
53
- audioTimestamp: z.ZodOptional<z.ZodBoolean>;
54
- labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
55
- mediaResolution: z.ZodOptional<z.ZodEnum<{
56
- MEDIA_RESOLUTION_UNSPECIFIED: "MEDIA_RESOLUTION_UNSPECIFIED";
57
- MEDIA_RESOLUTION_LOW: "MEDIA_RESOLUTION_LOW";
58
- MEDIA_RESOLUTION_MEDIUM: "MEDIA_RESOLUTION_MEDIUM";
59
- MEDIA_RESOLUTION_HIGH: "MEDIA_RESOLUTION_HIGH";
60
- }>>;
61
- }, z.core.$strip>;
62
- type GoogleGenerativeAIProviderOptions = z.infer<typeof googleGenerativeAIProviderOptions>;
63
-
64
- declare const groundingMetadataSchema: z.ZodObject<{
65
- webSearchQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
66
- retrievalQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
67
- searchEntryPoint: z.ZodOptional<z.ZodNullable<z.ZodObject<{
68
- renderedContent: z.ZodString;
69
- }, z.core.$strip>>>;
70
- groundingChunks: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
71
- web: z.ZodOptional<z.ZodNullable<z.ZodObject<{
72
- uri: z.ZodString;
73
- title: z.ZodString;
74
- }, z.core.$strip>>>;
75
- retrievedContext: z.ZodOptional<z.ZodNullable<z.ZodObject<{
76
- uri: z.ZodString;
77
- title: z.ZodString;
78
- }, z.core.$strip>>>;
79
- }, z.core.$strip>>>>;
80
- groundingSupports: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
81
- segment: z.ZodObject<{
82
- startIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
83
- endIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
84
- text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
85
- }, z.core.$strip>;
86
- segment_text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
87
- groundingChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
88
- supportChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
89
- confidenceScores: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
90
- confidenceScore: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
91
- }, z.core.$strip>>>>;
92
- retrievalMetadata: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
93
- webDynamicRetrievalScore: z.ZodNumber;
94
- }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>]>>>;
95
- }, z.core.$strip>;
96
-
97
- declare const urlContextMetadataSchema: z.ZodObject<{
98
- urlMetadata: z.ZodArray<z.ZodObject<{
99
- retrievedUrl: z.ZodString;
100
- urlRetrievalStatus: z.ZodString;
101
- }, z.core.$strip>>;
102
- }, z.core.$strip>;
15
+ declare const googleGenerativeAIProviderOptions: _ai_sdk_provider_utils.LazySchema<{
16
+ responseModalities?: ("TEXT" | "IMAGE")[] | undefined;
17
+ thinkingConfig?: {
18
+ thinkingBudget?: number | undefined;
19
+ includeThoughts?: boolean | undefined;
20
+ } | undefined;
21
+ cachedContent?: string | undefined;
22
+ structuredOutputs?: boolean | undefined;
23
+ safetySettings?: {
24
+ category: "HARM_CATEGORY_UNSPECIFIED" | "HARM_CATEGORY_HATE_SPEECH" | "HARM_CATEGORY_DANGEROUS_CONTENT" | "HARM_CATEGORY_HARASSMENT" | "HARM_CATEGORY_SEXUALLY_EXPLICIT" | "HARM_CATEGORY_CIVIC_INTEGRITY";
25
+ threshold: "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | "OFF";
26
+ }[] | undefined;
27
+ threshold?: "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | "OFF" | undefined;
28
+ audioTimestamp?: boolean | undefined;
29
+ labels?: Record<string, string> | undefined;
30
+ mediaResolution?: "MEDIA_RESOLUTION_UNSPECIFIED" | "MEDIA_RESOLUTION_LOW" | "MEDIA_RESOLUTION_MEDIUM" | "MEDIA_RESOLUTION_HIGH" | undefined;
31
+ }>;
32
+ type GoogleGenerativeAIProviderOptions = InferValidator<typeof googleGenerativeAIProviderOptions>;
103
33
 
104
- declare const safetyRatingSchema: z.ZodObject<{
105
- category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
106
- probability: z.ZodOptional<z.ZodNullable<z.ZodString>>;
107
- probabilityScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
108
- severity: z.ZodOptional<z.ZodNullable<z.ZodString>>;
109
- severityScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
110
- blocked: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
111
- }, z.core.$strip>;
34
+ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
35
+ candidates: {
36
+ content?: Record<string, never> | {
37
+ parts?: ({
38
+ functionCall: {
39
+ name: string;
40
+ args: unknown;
41
+ };
42
+ thoughtSignature?: string | null | undefined;
43
+ } | {
44
+ inlineData: {
45
+ mimeType: string;
46
+ data: string;
47
+ };
48
+ } | {
49
+ executableCode?: {
50
+ language: string;
51
+ code: string;
52
+ } | null | undefined;
53
+ codeExecutionResult?: {
54
+ outcome: string;
55
+ output: string;
56
+ } | null | undefined;
57
+ text?: string | null | undefined;
58
+ thought?: boolean | null | undefined;
59
+ thoughtSignature?: string | null | undefined;
60
+ })[] | null | undefined;
61
+ } | null | undefined;
62
+ finishReason?: string | null | undefined;
63
+ safetyRatings?: {
64
+ category?: string | null | undefined;
65
+ probability?: string | null | undefined;
66
+ probabilityScore?: number | null | undefined;
67
+ severity?: string | null | undefined;
68
+ severityScore?: number | null | undefined;
69
+ blocked?: boolean | null | undefined;
70
+ }[] | null | undefined;
71
+ groundingMetadata?: {
72
+ webSearchQueries?: string[] | null | undefined;
73
+ retrievalQueries?: string[] | null | undefined;
74
+ searchEntryPoint?: {
75
+ renderedContent: string;
76
+ } | null | undefined;
77
+ groundingChunks?: {
78
+ web?: {
79
+ uri: string;
80
+ title: string;
81
+ } | null | undefined;
82
+ retrievedContext?: {
83
+ uri: string;
84
+ title: string;
85
+ } | null | undefined;
86
+ }[] | null | undefined;
87
+ groundingSupports?: {
88
+ segment: {
89
+ startIndex?: number | null | undefined;
90
+ endIndex?: number | null | undefined;
91
+ text?: string | null | undefined;
92
+ };
93
+ segment_text?: string | null | undefined;
94
+ groundingChunkIndices?: number[] | null | undefined;
95
+ supportChunkIndices?: number[] | null | undefined;
96
+ confidenceScores?: number[] | null | undefined;
97
+ confidenceScore?: number[] | null | undefined;
98
+ }[] | null | undefined;
99
+ retrievalMetadata?: Record<string, never> | {
100
+ webDynamicRetrievalScore: number;
101
+ } | null | undefined;
102
+ } | null | undefined;
103
+ urlContextMetadata?: {
104
+ urlMetadata: {
105
+ retrievedUrl: string;
106
+ urlRetrievalStatus: string;
107
+ }[];
108
+ } | null | undefined;
109
+ }[];
110
+ usageMetadata?: {
111
+ cachedContentTokenCount?: number | null | undefined;
112
+ thoughtsTokenCount?: number | null | undefined;
113
+ promptTokenCount?: number | null | undefined;
114
+ candidatesTokenCount?: number | null | undefined;
115
+ totalTokenCount?: number | null | undefined;
116
+ } | null | undefined;
117
+ promptFeedback?: {
118
+ blockReason?: string | null | undefined;
119
+ safetyRatings?: {
120
+ category?: string | null | undefined;
121
+ probability?: string | null | undefined;
122
+ probabilityScore?: number | null | undefined;
123
+ severity?: string | null | undefined;
124
+ severityScore?: number | null | undefined;
125
+ blocked?: boolean | null | undefined;
126
+ }[] | null | undefined;
127
+ } | null | undefined;
128
+ }>;
129
+ type GroundingMetadataSchema = NonNullable<InferValidator<typeof responseSchema>['candidates'][number]['groundingMetadata']>;
130
+ type UrlContextMetadataSchema = NonNullable<InferValidator<typeof responseSchema>['candidates'][number]['urlContextMetadata']>;
131
+ type SafetyRatingSchema = NonNullable<InferValidator<typeof responseSchema>['candidates'][number]['safetyRatings']>[number];
112
132
 
113
- type GoogleGenerativeAIGroundingMetadata = z.infer<typeof groundingMetadataSchema>;
114
- type GoogleGenerativeAIUrlContextMetadata = z.infer<typeof urlContextMetadataSchema>;
115
- type GoogleGenerativeAISafetyRating = z.infer<typeof safetyRatingSchema>;
133
+ type GoogleGenerativeAIGroundingMetadata = GroundingMetadataSchema;
134
+ type GoogleGenerativeAIUrlContextMetadata = UrlContextMetadataSchema;
135
+ type GoogleGenerativeAISafetyRating = SafetyRatingSchema;
116
136
  interface GoogleGenerativeAIProviderMetadata {
117
137
  groundingMetadata: GoogleGenerativeAIGroundingMetadata | null;
118
138
  urlContextMetadata: GoogleGenerativeAIUrlContextMetadata | null;
@@ -127,37 +147,18 @@ interface GoogleGenerativeAIImageSettings {
127
147
  maxImagesPerCall?: number;
128
148
  }
129
149
 
130
- declare const googleImageProviderOptionsSchema: z.ZodObject<{
131
- personGeneration: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
132
- dont_allow: "dont_allow";
133
- allow_adult: "allow_adult";
134
- allow_all: "allow_all";
135
- }>>>;
136
- aspectRatio: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
137
- "1:1": "1:1";
138
- "3:4": "3:4";
139
- "4:3": "4:3";
140
- "9:16": "9:16";
141
- "16:9": "16:9";
142
- }>>>;
143
- }, z.core.$strip>;
144
- type GoogleGenerativeAIImageProviderOptions = z.infer<typeof googleImageProviderOptionsSchema>;
150
+ declare const googleImageProviderOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
151
+ personGeneration?: "dont_allow" | "allow_adult" | "allow_all" | null | undefined;
152
+ aspectRatio?: "1:1" | "3:4" | "4:3" | "9:16" | "16:9" | null | undefined;
153
+ }>;
154
+ type GoogleGenerativeAIImageProviderOptions = InferValidator<typeof googleImageProviderOptionsSchema>;
145
155
 
146
156
  type GoogleGenerativeAIEmbeddingModelId = 'gemini-embedding-001' | 'text-embedding-004' | (string & {});
147
- declare const googleGenerativeAIEmbeddingProviderOptions: z.ZodObject<{
148
- outputDimensionality: z.ZodOptional<z.ZodNumber>;
149
- taskType: z.ZodOptional<z.ZodEnum<{
150
- SEMANTIC_SIMILARITY: "SEMANTIC_SIMILARITY";
151
- CLASSIFICATION: "CLASSIFICATION";
152
- CLUSTERING: "CLUSTERING";
153
- RETRIEVAL_DOCUMENT: "RETRIEVAL_DOCUMENT";
154
- RETRIEVAL_QUERY: "RETRIEVAL_QUERY";
155
- QUESTION_ANSWERING: "QUESTION_ANSWERING";
156
- FACT_VERIFICATION: "FACT_VERIFICATION";
157
- CODE_RETRIEVAL_QUERY: "CODE_RETRIEVAL_QUERY";
158
- }>>;
159
- }, z.core.$strip>;
160
- type GoogleGenerativeAIEmbeddingProviderOptions = z.infer<typeof googleGenerativeAIEmbeddingProviderOptions>;
157
+ declare const googleGenerativeAIEmbeddingProviderOptions: _ai_sdk_provider_utils.LazySchema<{
158
+ outputDimensionality?: number | undefined;
159
+ taskType?: "SEMANTIC_SIMILARITY" | "CLASSIFICATION" | "CLUSTERING" | "RETRIEVAL_DOCUMENT" | "RETRIEVAL_QUERY" | "QUESTION_ANSWERING" | "FACT_VERIFICATION" | "CODE_RETRIEVAL_QUERY" | undefined;
160
+ }>;
161
+ type GoogleGenerativeAIEmbeddingProviderOptions = InferValidator<typeof googleGenerativeAIEmbeddingProviderOptions>;
161
162
 
162
163
  declare const googleTools: {
163
164
  /**
package/dist/index.d.ts CHANGED
@@ -1,118 +1,138 @@
1
- import * as z from 'zod/v4';
2
- import { ProviderV3, LanguageModelV3, ImageModelV3, EmbeddingModelV3 } from '@ai-sdk/provider';
3
1
  import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
4
- import { FetchFunction } from '@ai-sdk/provider-utils';
2
+ import { InferValidator, FetchFunction } from '@ai-sdk/provider-utils';
3
+ import { ProviderV3, LanguageModelV3, ImageModelV3, EmbeddingModelV3 } from '@ai-sdk/provider';
5
4
 
6
- declare const googleErrorDataSchema: z.ZodObject<{
7
- error: z.ZodObject<{
8
- code: z.ZodNullable<z.ZodNumber>;
9
- message: z.ZodString;
10
- status: z.ZodString;
11
- }, z.core.$strip>;
12
- }, z.core.$strip>;
13
- type GoogleErrorData = z.infer<typeof googleErrorDataSchema>;
5
+ declare const googleErrorDataSchema: _ai_sdk_provider_utils.LazySchema<{
6
+ error: {
7
+ code: number | null;
8
+ message: string;
9
+ status: string;
10
+ };
11
+ }>;
12
+ type GoogleErrorData = InferValidator<typeof googleErrorDataSchema>;
14
13
 
15
14
  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-flash-image-preview' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-preview-04-17' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'gemini-2.5-pro-exp-03-25' | 'gemini-exp-1206' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {});
16
- declare const googleGenerativeAIProviderOptions: z.ZodObject<{
17
- responseModalities: z.ZodOptional<z.ZodArray<z.ZodEnum<{
18
- TEXT: "TEXT";
19
- IMAGE: "IMAGE";
20
- }>>>;
21
- thinkingConfig: z.ZodOptional<z.ZodObject<{
22
- thinkingBudget: z.ZodOptional<z.ZodNumber>;
23
- includeThoughts: z.ZodOptional<z.ZodBoolean>;
24
- }, z.core.$strip>>;
25
- cachedContent: z.ZodOptional<z.ZodString>;
26
- structuredOutputs: z.ZodOptional<z.ZodBoolean>;
27
- safetySettings: z.ZodOptional<z.ZodArray<z.ZodObject<{
28
- category: z.ZodEnum<{
29
- HARM_CATEGORY_UNSPECIFIED: "HARM_CATEGORY_UNSPECIFIED";
30
- HARM_CATEGORY_HATE_SPEECH: "HARM_CATEGORY_HATE_SPEECH";
31
- HARM_CATEGORY_DANGEROUS_CONTENT: "HARM_CATEGORY_DANGEROUS_CONTENT";
32
- HARM_CATEGORY_HARASSMENT: "HARM_CATEGORY_HARASSMENT";
33
- HARM_CATEGORY_SEXUALLY_EXPLICIT: "HARM_CATEGORY_SEXUALLY_EXPLICIT";
34
- HARM_CATEGORY_CIVIC_INTEGRITY: "HARM_CATEGORY_CIVIC_INTEGRITY";
35
- }>;
36
- threshold: z.ZodEnum<{
37
- HARM_BLOCK_THRESHOLD_UNSPECIFIED: "HARM_BLOCK_THRESHOLD_UNSPECIFIED";
38
- BLOCK_LOW_AND_ABOVE: "BLOCK_LOW_AND_ABOVE";
39
- BLOCK_MEDIUM_AND_ABOVE: "BLOCK_MEDIUM_AND_ABOVE";
40
- BLOCK_ONLY_HIGH: "BLOCK_ONLY_HIGH";
41
- BLOCK_NONE: "BLOCK_NONE";
42
- OFF: "OFF";
43
- }>;
44
- }, z.core.$strip>>>;
45
- threshold: z.ZodOptional<z.ZodEnum<{
46
- HARM_BLOCK_THRESHOLD_UNSPECIFIED: "HARM_BLOCK_THRESHOLD_UNSPECIFIED";
47
- BLOCK_LOW_AND_ABOVE: "BLOCK_LOW_AND_ABOVE";
48
- BLOCK_MEDIUM_AND_ABOVE: "BLOCK_MEDIUM_AND_ABOVE";
49
- BLOCK_ONLY_HIGH: "BLOCK_ONLY_HIGH";
50
- BLOCK_NONE: "BLOCK_NONE";
51
- OFF: "OFF";
52
- }>>;
53
- audioTimestamp: z.ZodOptional<z.ZodBoolean>;
54
- labels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
55
- mediaResolution: z.ZodOptional<z.ZodEnum<{
56
- MEDIA_RESOLUTION_UNSPECIFIED: "MEDIA_RESOLUTION_UNSPECIFIED";
57
- MEDIA_RESOLUTION_LOW: "MEDIA_RESOLUTION_LOW";
58
- MEDIA_RESOLUTION_MEDIUM: "MEDIA_RESOLUTION_MEDIUM";
59
- MEDIA_RESOLUTION_HIGH: "MEDIA_RESOLUTION_HIGH";
60
- }>>;
61
- }, z.core.$strip>;
62
- type GoogleGenerativeAIProviderOptions = z.infer<typeof googleGenerativeAIProviderOptions>;
63
-
64
- declare const groundingMetadataSchema: z.ZodObject<{
65
- webSearchQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
66
- retrievalQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
67
- searchEntryPoint: z.ZodOptional<z.ZodNullable<z.ZodObject<{
68
- renderedContent: z.ZodString;
69
- }, z.core.$strip>>>;
70
- groundingChunks: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
71
- web: z.ZodOptional<z.ZodNullable<z.ZodObject<{
72
- uri: z.ZodString;
73
- title: z.ZodString;
74
- }, z.core.$strip>>>;
75
- retrievedContext: z.ZodOptional<z.ZodNullable<z.ZodObject<{
76
- uri: z.ZodString;
77
- title: z.ZodString;
78
- }, z.core.$strip>>>;
79
- }, z.core.$strip>>>>;
80
- groundingSupports: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
81
- segment: z.ZodObject<{
82
- startIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
83
- endIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
84
- text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
85
- }, z.core.$strip>;
86
- segment_text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
87
- groundingChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
88
- supportChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
89
- confidenceScores: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
90
- confidenceScore: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
91
- }, z.core.$strip>>>>;
92
- retrievalMetadata: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
93
- webDynamicRetrievalScore: z.ZodNumber;
94
- }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>]>>>;
95
- }, z.core.$strip>;
96
-
97
- declare const urlContextMetadataSchema: z.ZodObject<{
98
- urlMetadata: z.ZodArray<z.ZodObject<{
99
- retrievedUrl: z.ZodString;
100
- urlRetrievalStatus: z.ZodString;
101
- }, z.core.$strip>>;
102
- }, z.core.$strip>;
15
+ declare const googleGenerativeAIProviderOptions: _ai_sdk_provider_utils.LazySchema<{
16
+ responseModalities?: ("TEXT" | "IMAGE")[] | undefined;
17
+ thinkingConfig?: {
18
+ thinkingBudget?: number | undefined;
19
+ includeThoughts?: boolean | undefined;
20
+ } | undefined;
21
+ cachedContent?: string | undefined;
22
+ structuredOutputs?: boolean | undefined;
23
+ safetySettings?: {
24
+ category: "HARM_CATEGORY_UNSPECIFIED" | "HARM_CATEGORY_HATE_SPEECH" | "HARM_CATEGORY_DANGEROUS_CONTENT" | "HARM_CATEGORY_HARASSMENT" | "HARM_CATEGORY_SEXUALLY_EXPLICIT" | "HARM_CATEGORY_CIVIC_INTEGRITY";
25
+ threshold: "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | "OFF";
26
+ }[] | undefined;
27
+ threshold?: "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | "OFF" | undefined;
28
+ audioTimestamp?: boolean | undefined;
29
+ labels?: Record<string, string> | undefined;
30
+ mediaResolution?: "MEDIA_RESOLUTION_UNSPECIFIED" | "MEDIA_RESOLUTION_LOW" | "MEDIA_RESOLUTION_MEDIUM" | "MEDIA_RESOLUTION_HIGH" | undefined;
31
+ }>;
32
+ type GoogleGenerativeAIProviderOptions = InferValidator<typeof googleGenerativeAIProviderOptions>;
103
33
 
104
- declare const safetyRatingSchema: z.ZodObject<{
105
- category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
106
- probability: z.ZodOptional<z.ZodNullable<z.ZodString>>;
107
- probabilityScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
108
- severity: z.ZodOptional<z.ZodNullable<z.ZodString>>;
109
- severityScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
110
- blocked: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
111
- }, z.core.$strip>;
34
+ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
35
+ candidates: {
36
+ content?: Record<string, never> | {
37
+ parts?: ({
38
+ functionCall: {
39
+ name: string;
40
+ args: unknown;
41
+ };
42
+ thoughtSignature?: string | null | undefined;
43
+ } | {
44
+ inlineData: {
45
+ mimeType: string;
46
+ data: string;
47
+ };
48
+ } | {
49
+ executableCode?: {
50
+ language: string;
51
+ code: string;
52
+ } | null | undefined;
53
+ codeExecutionResult?: {
54
+ outcome: string;
55
+ output: string;
56
+ } | null | undefined;
57
+ text?: string | null | undefined;
58
+ thought?: boolean | null | undefined;
59
+ thoughtSignature?: string | null | undefined;
60
+ })[] | null | undefined;
61
+ } | null | undefined;
62
+ finishReason?: string | null | undefined;
63
+ safetyRatings?: {
64
+ category?: string | null | undefined;
65
+ probability?: string | null | undefined;
66
+ probabilityScore?: number | null | undefined;
67
+ severity?: string | null | undefined;
68
+ severityScore?: number | null | undefined;
69
+ blocked?: boolean | null | undefined;
70
+ }[] | null | undefined;
71
+ groundingMetadata?: {
72
+ webSearchQueries?: string[] | null | undefined;
73
+ retrievalQueries?: string[] | null | undefined;
74
+ searchEntryPoint?: {
75
+ renderedContent: string;
76
+ } | null | undefined;
77
+ groundingChunks?: {
78
+ web?: {
79
+ uri: string;
80
+ title: string;
81
+ } | null | undefined;
82
+ retrievedContext?: {
83
+ uri: string;
84
+ title: string;
85
+ } | null | undefined;
86
+ }[] | null | undefined;
87
+ groundingSupports?: {
88
+ segment: {
89
+ startIndex?: number | null | undefined;
90
+ endIndex?: number | null | undefined;
91
+ text?: string | null | undefined;
92
+ };
93
+ segment_text?: string | null | undefined;
94
+ groundingChunkIndices?: number[] | null | undefined;
95
+ supportChunkIndices?: number[] | null | undefined;
96
+ confidenceScores?: number[] | null | undefined;
97
+ confidenceScore?: number[] | null | undefined;
98
+ }[] | null | undefined;
99
+ retrievalMetadata?: Record<string, never> | {
100
+ webDynamicRetrievalScore: number;
101
+ } | null | undefined;
102
+ } | null | undefined;
103
+ urlContextMetadata?: {
104
+ urlMetadata: {
105
+ retrievedUrl: string;
106
+ urlRetrievalStatus: string;
107
+ }[];
108
+ } | null | undefined;
109
+ }[];
110
+ usageMetadata?: {
111
+ cachedContentTokenCount?: number | null | undefined;
112
+ thoughtsTokenCount?: number | null | undefined;
113
+ promptTokenCount?: number | null | undefined;
114
+ candidatesTokenCount?: number | null | undefined;
115
+ totalTokenCount?: number | null | undefined;
116
+ } | null | undefined;
117
+ promptFeedback?: {
118
+ blockReason?: string | null | undefined;
119
+ safetyRatings?: {
120
+ category?: string | null | undefined;
121
+ probability?: string | null | undefined;
122
+ probabilityScore?: number | null | undefined;
123
+ severity?: string | null | undefined;
124
+ severityScore?: number | null | undefined;
125
+ blocked?: boolean | null | undefined;
126
+ }[] | null | undefined;
127
+ } | null | undefined;
128
+ }>;
129
+ type GroundingMetadataSchema = NonNullable<InferValidator<typeof responseSchema>['candidates'][number]['groundingMetadata']>;
130
+ type UrlContextMetadataSchema = NonNullable<InferValidator<typeof responseSchema>['candidates'][number]['urlContextMetadata']>;
131
+ type SafetyRatingSchema = NonNullable<InferValidator<typeof responseSchema>['candidates'][number]['safetyRatings']>[number];
112
132
 
113
- type GoogleGenerativeAIGroundingMetadata = z.infer<typeof groundingMetadataSchema>;
114
- type GoogleGenerativeAIUrlContextMetadata = z.infer<typeof urlContextMetadataSchema>;
115
- type GoogleGenerativeAISafetyRating = z.infer<typeof safetyRatingSchema>;
133
+ type GoogleGenerativeAIGroundingMetadata = GroundingMetadataSchema;
134
+ type GoogleGenerativeAIUrlContextMetadata = UrlContextMetadataSchema;
135
+ type GoogleGenerativeAISafetyRating = SafetyRatingSchema;
116
136
  interface GoogleGenerativeAIProviderMetadata {
117
137
  groundingMetadata: GoogleGenerativeAIGroundingMetadata | null;
118
138
  urlContextMetadata: GoogleGenerativeAIUrlContextMetadata | null;
@@ -127,37 +147,18 @@ interface GoogleGenerativeAIImageSettings {
127
147
  maxImagesPerCall?: number;
128
148
  }
129
149
 
130
- declare const googleImageProviderOptionsSchema: z.ZodObject<{
131
- personGeneration: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
132
- dont_allow: "dont_allow";
133
- allow_adult: "allow_adult";
134
- allow_all: "allow_all";
135
- }>>>;
136
- aspectRatio: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
137
- "1:1": "1:1";
138
- "3:4": "3:4";
139
- "4:3": "4:3";
140
- "9:16": "9:16";
141
- "16:9": "16:9";
142
- }>>>;
143
- }, z.core.$strip>;
144
- type GoogleGenerativeAIImageProviderOptions = z.infer<typeof googleImageProviderOptionsSchema>;
150
+ declare const googleImageProviderOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
151
+ personGeneration?: "dont_allow" | "allow_adult" | "allow_all" | null | undefined;
152
+ aspectRatio?: "1:1" | "3:4" | "4:3" | "9:16" | "16:9" | null | undefined;
153
+ }>;
154
+ type GoogleGenerativeAIImageProviderOptions = InferValidator<typeof googleImageProviderOptionsSchema>;
145
155
 
146
156
  type GoogleGenerativeAIEmbeddingModelId = 'gemini-embedding-001' | 'text-embedding-004' | (string & {});
147
- declare const googleGenerativeAIEmbeddingProviderOptions: z.ZodObject<{
148
- outputDimensionality: z.ZodOptional<z.ZodNumber>;
149
- taskType: z.ZodOptional<z.ZodEnum<{
150
- SEMANTIC_SIMILARITY: "SEMANTIC_SIMILARITY";
151
- CLASSIFICATION: "CLASSIFICATION";
152
- CLUSTERING: "CLUSTERING";
153
- RETRIEVAL_DOCUMENT: "RETRIEVAL_DOCUMENT";
154
- RETRIEVAL_QUERY: "RETRIEVAL_QUERY";
155
- QUESTION_ANSWERING: "QUESTION_ANSWERING";
156
- FACT_VERIFICATION: "FACT_VERIFICATION";
157
- CODE_RETRIEVAL_QUERY: "CODE_RETRIEVAL_QUERY";
158
- }>>;
159
- }, z.core.$strip>;
160
- type GoogleGenerativeAIEmbeddingProviderOptions = z.infer<typeof googleGenerativeAIEmbeddingProviderOptions>;
157
+ declare const googleGenerativeAIEmbeddingProviderOptions: _ai_sdk_provider_utils.LazySchema<{
158
+ outputDimensionality?: number | undefined;
159
+ taskType?: "SEMANTIC_SIMILARITY" | "CLASSIFICATION" | "CLUSTERING" | "RETRIEVAL_DOCUMENT" | "RETRIEVAL_QUERY" | "QUESTION_ANSWERING" | "FACT_VERIFICATION" | "CODE_RETRIEVAL_QUERY" | undefined;
160
+ }>;
161
+ type GoogleGenerativeAIEmbeddingProviderOptions = InferValidator<typeof googleGenerativeAIEmbeddingProviderOptions>;
161
162
 
162
163
  declare const googleTools: {
163
164
  /**