@ai-sdk/google 2.0.18 → 2.0.20

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.20
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [17f9872]
8
+ - @ai-sdk/provider-utils@3.0.12
9
+
10
+ ## 2.0.19
11
+
12
+ ### Patch Changes
13
+
14
+ - a107843: fix(provider/google): lazy schema loading
15
+
16
+ import time improved by 12.5% (22.3ms ➡️ 19.5ms)
17
+
3
18
  ## 2.0.18
4
19
 
5
20
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -1,112 +1,138 @@
1
- import * as z from 'zod/v4';
2
- import { ProviderV2, LanguageModelV2, ImageModelV2, EmbeddingModelV2 } 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 { ProviderV2, LanguageModelV2, ImageModelV2, EmbeddingModelV2 } 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-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
- }, z.core.$strip>;
56
- type GoogleGenerativeAIProviderOptions = z.infer<typeof googleGenerativeAIProviderOptions>;
57
-
58
- declare const groundingMetadataSchema: z.ZodObject<{
59
- webSearchQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
60
- retrievalQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
61
- searchEntryPoint: z.ZodOptional<z.ZodNullable<z.ZodObject<{
62
- renderedContent: z.ZodString;
63
- }, z.core.$strip>>>;
64
- groundingChunks: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
65
- web: z.ZodOptional<z.ZodNullable<z.ZodObject<{
66
- uri: z.ZodString;
67
- title: z.ZodString;
68
- }, z.core.$strip>>>;
69
- retrievedContext: z.ZodOptional<z.ZodNullable<z.ZodObject<{
70
- uri: z.ZodString;
71
- title: z.ZodString;
72
- }, z.core.$strip>>>;
73
- }, z.core.$strip>>>>;
74
- groundingSupports: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
75
- segment: z.ZodObject<{
76
- startIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
77
- endIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
78
- text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
79
- }, z.core.$strip>;
80
- segment_text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
81
- groundingChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
82
- supportChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
83
- confidenceScores: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
84
- confidenceScore: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
85
- }, z.core.$strip>>>>;
86
- retrievalMetadata: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
87
- webDynamicRetrievalScore: z.ZodNumber;
88
- }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>]>>>;
89
- }, z.core.$strip>;
90
-
91
- declare const urlContextMetadataSchema: z.ZodObject<{
92
- urlMetadata: z.ZodArray<z.ZodObject<{
93
- retrievedUrl: z.ZodString;
94
- urlRetrievalStatus: z.ZodString;
95
- }, z.core.$strip>>;
96
- }, 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>;
97
33
 
98
- declare const safetyRatingSchema: z.ZodObject<{
99
- category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
100
- probability: z.ZodOptional<z.ZodNullable<z.ZodString>>;
101
- probabilityScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
102
- severity: z.ZodOptional<z.ZodNullable<z.ZodString>>;
103
- severityScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
104
- blocked: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
105
- }, 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];
106
132
 
107
- type GoogleGenerativeAIGroundingMetadata = z.infer<typeof groundingMetadataSchema>;
108
- type GoogleGenerativeAIUrlContextMetadata = z.infer<typeof urlContextMetadataSchema>;
109
- type GoogleGenerativeAISafetyRating = z.infer<typeof safetyRatingSchema>;
133
+ type GoogleGenerativeAIGroundingMetadata = GroundingMetadataSchema;
134
+ type GoogleGenerativeAIUrlContextMetadata = UrlContextMetadataSchema;
135
+ type GoogleGenerativeAISafetyRating = SafetyRatingSchema;
110
136
  interface GoogleGenerativeAIProviderMetadata {
111
137
  groundingMetadata: GoogleGenerativeAIGroundingMetadata | null;
112
138
  urlContextMetadata: GoogleGenerativeAIUrlContextMetadata | null;
@@ -121,37 +147,18 @@ interface GoogleGenerativeAIImageSettings {
121
147
  maxImagesPerCall?: number;
122
148
  }
123
149
 
124
- declare const googleImageProviderOptionsSchema: z.ZodObject<{
125
- personGeneration: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
126
- dont_allow: "dont_allow";
127
- allow_adult: "allow_adult";
128
- allow_all: "allow_all";
129
- }>>>;
130
- aspectRatio: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
131
- "1:1": "1:1";
132
- "3:4": "3:4";
133
- "4:3": "4:3";
134
- "9:16": "9:16";
135
- "16:9": "16:9";
136
- }>>>;
137
- }, z.core.$strip>;
138
- 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>;
139
155
 
140
156
  type GoogleGenerativeAIEmbeddingModelId = 'gemini-embedding-001' | 'text-embedding-004' | (string & {});
141
- declare const googleGenerativeAIEmbeddingProviderOptions: z.ZodObject<{
142
- outputDimensionality: z.ZodOptional<z.ZodNumber>;
143
- taskType: z.ZodOptional<z.ZodEnum<{
144
- SEMANTIC_SIMILARITY: "SEMANTIC_SIMILARITY";
145
- CLASSIFICATION: "CLASSIFICATION";
146
- CLUSTERING: "CLUSTERING";
147
- RETRIEVAL_DOCUMENT: "RETRIEVAL_DOCUMENT";
148
- RETRIEVAL_QUERY: "RETRIEVAL_QUERY";
149
- QUESTION_ANSWERING: "QUESTION_ANSWERING";
150
- FACT_VERIFICATION: "FACT_VERIFICATION";
151
- CODE_RETRIEVAL_QUERY: "CODE_RETRIEVAL_QUERY";
152
- }>>;
153
- }, z.core.$strip>;
154
- 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>;
155
162
 
156
163
  declare const googleTools: {
157
164
  /**
package/dist/index.d.ts CHANGED
@@ -1,112 +1,138 @@
1
- import * as z from 'zod/v4';
2
- import { ProviderV2, LanguageModelV2, ImageModelV2, EmbeddingModelV2 } 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 { ProviderV2, LanguageModelV2, ImageModelV2, EmbeddingModelV2 } 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-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
- }, z.core.$strip>;
56
- type GoogleGenerativeAIProviderOptions = z.infer<typeof googleGenerativeAIProviderOptions>;
57
-
58
- declare const groundingMetadataSchema: z.ZodObject<{
59
- webSearchQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
60
- retrievalQueries: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
61
- searchEntryPoint: z.ZodOptional<z.ZodNullable<z.ZodObject<{
62
- renderedContent: z.ZodString;
63
- }, z.core.$strip>>>;
64
- groundingChunks: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
65
- web: z.ZodOptional<z.ZodNullable<z.ZodObject<{
66
- uri: z.ZodString;
67
- title: z.ZodString;
68
- }, z.core.$strip>>>;
69
- retrievedContext: z.ZodOptional<z.ZodNullable<z.ZodObject<{
70
- uri: z.ZodString;
71
- title: z.ZodString;
72
- }, z.core.$strip>>>;
73
- }, z.core.$strip>>>>;
74
- groundingSupports: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
75
- segment: z.ZodObject<{
76
- startIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
77
- endIndex: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
78
- text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
79
- }, z.core.$strip>;
80
- segment_text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
81
- groundingChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
82
- supportChunkIndices: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
83
- confidenceScores: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
84
- confidenceScore: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodNumber>>>;
85
- }, z.core.$strip>>>>;
86
- retrievalMetadata: z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodObject<{
87
- webDynamicRetrievalScore: z.ZodNumber;
88
- }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>]>>>;
89
- }, z.core.$strip>;
90
-
91
- declare const urlContextMetadataSchema: z.ZodObject<{
92
- urlMetadata: z.ZodArray<z.ZodObject<{
93
- retrievedUrl: z.ZodString;
94
- urlRetrievalStatus: z.ZodString;
95
- }, z.core.$strip>>;
96
- }, 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>;
97
33
 
98
- declare const safetyRatingSchema: z.ZodObject<{
99
- category: z.ZodOptional<z.ZodNullable<z.ZodString>>;
100
- probability: z.ZodOptional<z.ZodNullable<z.ZodString>>;
101
- probabilityScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
102
- severity: z.ZodOptional<z.ZodNullable<z.ZodString>>;
103
- severityScore: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
104
- blocked: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
105
- }, 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];
106
132
 
107
- type GoogleGenerativeAIGroundingMetadata = z.infer<typeof groundingMetadataSchema>;
108
- type GoogleGenerativeAIUrlContextMetadata = z.infer<typeof urlContextMetadataSchema>;
109
- type GoogleGenerativeAISafetyRating = z.infer<typeof safetyRatingSchema>;
133
+ type GoogleGenerativeAIGroundingMetadata = GroundingMetadataSchema;
134
+ type GoogleGenerativeAIUrlContextMetadata = UrlContextMetadataSchema;
135
+ type GoogleGenerativeAISafetyRating = SafetyRatingSchema;
110
136
  interface GoogleGenerativeAIProviderMetadata {
111
137
  groundingMetadata: GoogleGenerativeAIGroundingMetadata | null;
112
138
  urlContextMetadata: GoogleGenerativeAIUrlContextMetadata | null;
@@ -121,37 +147,18 @@ interface GoogleGenerativeAIImageSettings {
121
147
  maxImagesPerCall?: number;
122
148
  }
123
149
 
124
- declare const googleImageProviderOptionsSchema: z.ZodObject<{
125
- personGeneration: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
126
- dont_allow: "dont_allow";
127
- allow_adult: "allow_adult";
128
- allow_all: "allow_all";
129
- }>>>;
130
- aspectRatio: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
131
- "1:1": "1:1";
132
- "3:4": "3:4";
133
- "4:3": "4:3";
134
- "9:16": "9:16";
135
- "16:9": "16:9";
136
- }>>>;
137
- }, z.core.$strip>;
138
- 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>;
139
155
 
140
156
  type GoogleGenerativeAIEmbeddingModelId = 'gemini-embedding-001' | 'text-embedding-004' | (string & {});
141
- declare const googleGenerativeAIEmbeddingProviderOptions: z.ZodObject<{
142
- outputDimensionality: z.ZodOptional<z.ZodNumber>;
143
- taskType: z.ZodOptional<z.ZodEnum<{
144
- SEMANTIC_SIMILARITY: "SEMANTIC_SIMILARITY";
145
- CLASSIFICATION: "CLASSIFICATION";
146
- CLUSTERING: "CLUSTERING";
147
- RETRIEVAL_DOCUMENT: "RETRIEVAL_DOCUMENT";
148
- RETRIEVAL_QUERY: "RETRIEVAL_QUERY";
149
- QUESTION_ANSWERING: "QUESTION_ANSWERING";
150
- FACT_VERIFICATION: "FACT_VERIFICATION";
151
- CODE_RETRIEVAL_QUERY: "CODE_RETRIEVAL_QUERY";
152
- }>>;
153
- }, z.core.$strip>;
154
- 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>;
155
162
 
156
163
  declare const googleTools: {
157
164
  /**