@ai-sdk/google 0.0.0-01d6317c-20260129172110
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 +2353 -0
- package/LICENSE +13 -0
- package/README.md +35 -0
- package/dist/index.d.mts +331 -0
- package/dist/index.d.ts +331 -0
- package/dist/index.js +1972 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2007 -0
- package/dist/index.mjs.map +1 -0
- package/dist/internal/index.d.mts +262 -0
- package/dist/internal/index.d.ts +262 -0
- package/dist/internal/index.js +1621 -0
- package/dist/internal/index.js.map +1 -0
- package/dist/internal/index.mjs +1629 -0
- package/dist/internal/index.mjs.map +1 -0
- package/docs/15-google-generative-ai.mdx +1195 -0
- package/internal.d.ts +1 -0
- package/package.json +83 -0
- package/src/convert-google-generative-ai-usage.ts +51 -0
- package/src/convert-json-schema-to-openapi-schema.ts +158 -0
- package/src/convert-to-google-generative-ai-messages.ts +232 -0
- package/src/get-model-path.ts +3 -0
- package/src/google-error.ts +26 -0
- package/src/google-generative-ai-embedding-model.ts +159 -0
- package/src/google-generative-ai-embedding-options.ts +52 -0
- package/src/google-generative-ai-image-model.ts +184 -0
- package/src/google-generative-ai-image-settings.ts +12 -0
- package/src/google-generative-ai-language-model.ts +1009 -0
- package/src/google-generative-ai-options.ts +193 -0
- package/src/google-generative-ai-prompt.ts +38 -0
- package/src/google-prepare-tools.ts +264 -0
- package/src/google-provider.ts +201 -0
- package/src/google-supported-file-url.ts +20 -0
- package/src/google-tools.ts +71 -0
- package/src/index.ts +11 -0
- package/src/internal/index.ts +3 -0
- package/src/map-google-generative-ai-finish-reason.ts +29 -0
- package/src/tool/code-execution.ts +35 -0
- package/src/tool/enterprise-web-search.ts +18 -0
- package/src/tool/file-search.ts +51 -0
- package/src/tool/google-maps.ts +14 -0
- package/src/tool/google-search.ts +40 -0
- package/src/tool/url-context.ts +16 -0
- package/src/tool/vertex-rag-store.ts +31 -0
- package/src/version.ts +6 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2023 Vercel, Inc.
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# AI SDK - Google Generative AI Provider
|
|
2
|
+
|
|
3
|
+
The **[Google Generative AI provider](https://ai-sdk.dev/providers/ai-sdk-providers/google-generative-ai)** for the [AI SDK](https://ai-sdk.dev/docs) contains language model support for the [Google Generative AI](https://ai.google/discover/generativeai/) APIs.
|
|
4
|
+
|
|
5
|
+
## Setup
|
|
6
|
+
|
|
7
|
+
The Google Generative AI provider is available in the `@ai-sdk/google` module. You can install it with
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm i @ai-sdk/google
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Provider Instance
|
|
14
|
+
|
|
15
|
+
You can import the default provider instance `google` from `@ai-sdk/google`:
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { google } from '@ai-sdk/google';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Example
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { google } from '@ai-sdk/google';
|
|
25
|
+
import { generateText } from 'ai';
|
|
26
|
+
|
|
27
|
+
const { text } = await generateText({
|
|
28
|
+
model: google('gemini-1.5-pro-latest'),
|
|
29
|
+
prompt: 'Write a vegetarian lasagna recipe for 4 people.',
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Documentation
|
|
34
|
+
|
|
35
|
+
Please check out the **[Google Generative AI provider documentation](https://ai-sdk.dev/providers/ai-sdk-providers/google-generative-ai)** for more information.
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
2
|
+
import { InferSchema, FetchFunction } from '@ai-sdk/provider-utils';
|
|
3
|
+
import { ProviderV3, LanguageModelV3, ImageModelV3, EmbeddingModelV3 } from '@ai-sdk/provider';
|
|
4
|
+
|
|
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 = InferSchema<typeof googleErrorDataSchema>;
|
|
13
|
+
|
|
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-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | '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 & {});
|
|
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
|
+
thinkingLevel?: "minimal" | "low" | "medium" | "high" | undefined;
|
|
21
|
+
} | undefined;
|
|
22
|
+
cachedContent?: string | undefined;
|
|
23
|
+
structuredOutputs?: boolean | undefined;
|
|
24
|
+
safetySettings?: {
|
|
25
|
+
category: "HARM_CATEGORY_UNSPECIFIED" | "HARM_CATEGORY_HATE_SPEECH" | "HARM_CATEGORY_DANGEROUS_CONTENT" | "HARM_CATEGORY_HARASSMENT" | "HARM_CATEGORY_SEXUALLY_EXPLICIT" | "HARM_CATEGORY_CIVIC_INTEGRITY";
|
|
26
|
+
threshold: "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | "OFF";
|
|
27
|
+
}[] | undefined;
|
|
28
|
+
threshold?: "HARM_BLOCK_THRESHOLD_UNSPECIFIED" | "BLOCK_LOW_AND_ABOVE" | "BLOCK_MEDIUM_AND_ABOVE" | "BLOCK_ONLY_HIGH" | "BLOCK_NONE" | "OFF" | undefined;
|
|
29
|
+
audioTimestamp?: boolean | undefined;
|
|
30
|
+
labels?: Record<string, string> | undefined;
|
|
31
|
+
mediaResolution?: "MEDIA_RESOLUTION_UNSPECIFIED" | "MEDIA_RESOLUTION_LOW" | "MEDIA_RESOLUTION_MEDIUM" | "MEDIA_RESOLUTION_HIGH" | undefined;
|
|
32
|
+
imageConfig?: {
|
|
33
|
+
aspectRatio?: "1:1" | "2:3" | "3:2" | "3:4" | "4:3" | "4:5" | "5:4" | "9:16" | "16:9" | "21:9" | undefined;
|
|
34
|
+
imageSize?: "1K" | "2K" | "4K" | undefined;
|
|
35
|
+
} | undefined;
|
|
36
|
+
retrievalConfig?: {
|
|
37
|
+
latLng?: {
|
|
38
|
+
latitude: number;
|
|
39
|
+
longitude: number;
|
|
40
|
+
} | undefined;
|
|
41
|
+
} | undefined;
|
|
42
|
+
}>;
|
|
43
|
+
type GoogleGenerativeAIProviderOptions = InferSchema<typeof googleGenerativeAIProviderOptions>;
|
|
44
|
+
|
|
45
|
+
declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
46
|
+
candidates: {
|
|
47
|
+
content?: Record<string, never> | {
|
|
48
|
+
parts?: ({
|
|
49
|
+
functionCall: {
|
|
50
|
+
name: string;
|
|
51
|
+
args: unknown;
|
|
52
|
+
};
|
|
53
|
+
thoughtSignature?: string | null | undefined;
|
|
54
|
+
} | {
|
|
55
|
+
inlineData: {
|
|
56
|
+
mimeType: string;
|
|
57
|
+
data: string;
|
|
58
|
+
};
|
|
59
|
+
thoughtSignature?: string | null | undefined;
|
|
60
|
+
} | {
|
|
61
|
+
executableCode?: {
|
|
62
|
+
language: string;
|
|
63
|
+
code: string;
|
|
64
|
+
} | null | undefined;
|
|
65
|
+
codeExecutionResult?: {
|
|
66
|
+
outcome: string;
|
|
67
|
+
output: string;
|
|
68
|
+
} | null | undefined;
|
|
69
|
+
text?: string | null | undefined;
|
|
70
|
+
thought?: boolean | null | undefined;
|
|
71
|
+
thoughtSignature?: string | null | undefined;
|
|
72
|
+
})[] | null | undefined;
|
|
73
|
+
} | null | undefined;
|
|
74
|
+
finishReason?: string | null | undefined;
|
|
75
|
+
safetyRatings?: {
|
|
76
|
+
category?: string | null | undefined;
|
|
77
|
+
probability?: string | null | undefined;
|
|
78
|
+
probabilityScore?: number | null | undefined;
|
|
79
|
+
severity?: string | null | undefined;
|
|
80
|
+
severityScore?: number | null | undefined;
|
|
81
|
+
blocked?: boolean | null | undefined;
|
|
82
|
+
}[] | null | undefined;
|
|
83
|
+
groundingMetadata?: {
|
|
84
|
+
webSearchQueries?: string[] | null | undefined;
|
|
85
|
+
retrievalQueries?: string[] | null | undefined;
|
|
86
|
+
searchEntryPoint?: {
|
|
87
|
+
renderedContent: string;
|
|
88
|
+
} | null | undefined;
|
|
89
|
+
groundingChunks?: {
|
|
90
|
+
web?: {
|
|
91
|
+
uri: string;
|
|
92
|
+
title?: string | null | undefined;
|
|
93
|
+
} | null | undefined;
|
|
94
|
+
retrievedContext?: {
|
|
95
|
+
uri?: string | null | undefined;
|
|
96
|
+
title?: string | null | undefined;
|
|
97
|
+
text?: string | null | undefined;
|
|
98
|
+
fileSearchStore?: string | null | undefined;
|
|
99
|
+
} | null | undefined;
|
|
100
|
+
maps?: {
|
|
101
|
+
uri?: string | null | undefined;
|
|
102
|
+
title?: string | null | undefined;
|
|
103
|
+
text?: string | null | undefined;
|
|
104
|
+
placeId?: string | null | undefined;
|
|
105
|
+
} | null | undefined;
|
|
106
|
+
}[] | null | undefined;
|
|
107
|
+
groundingSupports?: {
|
|
108
|
+
segment: {
|
|
109
|
+
startIndex?: number | null | undefined;
|
|
110
|
+
endIndex?: number | null | undefined;
|
|
111
|
+
text?: string | null | undefined;
|
|
112
|
+
};
|
|
113
|
+
segment_text?: string | null | undefined;
|
|
114
|
+
groundingChunkIndices?: number[] | null | undefined;
|
|
115
|
+
supportChunkIndices?: number[] | null | undefined;
|
|
116
|
+
confidenceScores?: number[] | null | undefined;
|
|
117
|
+
confidenceScore?: number[] | null | undefined;
|
|
118
|
+
}[] | null | undefined;
|
|
119
|
+
retrievalMetadata?: Record<string, never> | {
|
|
120
|
+
webDynamicRetrievalScore: number;
|
|
121
|
+
} | null | undefined;
|
|
122
|
+
} | null | undefined;
|
|
123
|
+
urlContextMetadata?: {
|
|
124
|
+
urlMetadata: {
|
|
125
|
+
retrievedUrl: string;
|
|
126
|
+
urlRetrievalStatus: string;
|
|
127
|
+
}[];
|
|
128
|
+
} | null | undefined;
|
|
129
|
+
}[];
|
|
130
|
+
usageMetadata?: {
|
|
131
|
+
cachedContentTokenCount?: number | null | undefined;
|
|
132
|
+
thoughtsTokenCount?: number | null | undefined;
|
|
133
|
+
promptTokenCount?: number | null | undefined;
|
|
134
|
+
candidatesTokenCount?: number | null | undefined;
|
|
135
|
+
totalTokenCount?: number | null | undefined;
|
|
136
|
+
trafficType?: string | null | undefined;
|
|
137
|
+
} | null | undefined;
|
|
138
|
+
promptFeedback?: {
|
|
139
|
+
blockReason?: string | null | undefined;
|
|
140
|
+
safetyRatings?: {
|
|
141
|
+
category?: string | null | undefined;
|
|
142
|
+
probability?: string | null | undefined;
|
|
143
|
+
probabilityScore?: number | null | undefined;
|
|
144
|
+
severity?: string | null | undefined;
|
|
145
|
+
severityScore?: number | null | undefined;
|
|
146
|
+
blocked?: boolean | null | undefined;
|
|
147
|
+
}[] | null | undefined;
|
|
148
|
+
} | null | undefined;
|
|
149
|
+
}>;
|
|
150
|
+
type GroundingMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['groundingMetadata']>;
|
|
151
|
+
type UrlContextMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['urlContextMetadata']>;
|
|
152
|
+
type SafetyRatingSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['safetyRatings']>[number];
|
|
153
|
+
|
|
154
|
+
type GoogleGenerativeAIGroundingMetadata = GroundingMetadataSchema;
|
|
155
|
+
type GoogleGenerativeAIUrlContextMetadata = UrlContextMetadataSchema;
|
|
156
|
+
type GoogleGenerativeAISafetyRating = SafetyRatingSchema;
|
|
157
|
+
interface GoogleGenerativeAIProviderMetadata {
|
|
158
|
+
groundingMetadata: GoogleGenerativeAIGroundingMetadata | null;
|
|
159
|
+
urlContextMetadata: GoogleGenerativeAIUrlContextMetadata | null;
|
|
160
|
+
safetyRatings: GoogleGenerativeAISafetyRating[] | null;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
type GoogleGenerativeAIImageModelId = 'imagen-4.0-generate-001' | 'imagen-4.0-ultra-generate-001' | 'imagen-4.0-fast-generate-001' | (string & {});
|
|
164
|
+
interface GoogleGenerativeAIImageSettings {
|
|
165
|
+
/**
|
|
166
|
+
* Override the maximum number of images per call (default 4)
|
|
167
|
+
*/
|
|
168
|
+
maxImagesPerCall?: number;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
declare const googleImageProviderOptionsSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
172
|
+
personGeneration?: "dont_allow" | "allow_adult" | "allow_all" | null | undefined;
|
|
173
|
+
aspectRatio?: "1:1" | "3:4" | "4:3" | "9:16" | "16:9" | null | undefined;
|
|
174
|
+
}>;
|
|
175
|
+
type GoogleGenerativeAIImageProviderOptions = InferSchema<typeof googleImageProviderOptionsSchema>;
|
|
176
|
+
|
|
177
|
+
type GoogleGenerativeAIEmbeddingModelId = 'gemini-embedding-001' | 'text-embedding-004' | (string & {});
|
|
178
|
+
declare const googleGenerativeAIEmbeddingProviderOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
179
|
+
outputDimensionality?: number | undefined;
|
|
180
|
+
taskType?: "SEMANTIC_SIMILARITY" | "CLASSIFICATION" | "CLUSTERING" | "RETRIEVAL_DOCUMENT" | "RETRIEVAL_QUERY" | "QUESTION_ANSWERING" | "FACT_VERIFICATION" | "CODE_RETRIEVAL_QUERY" | undefined;
|
|
181
|
+
}>;
|
|
182
|
+
type GoogleGenerativeAIEmbeddingProviderOptions = InferSchema<typeof googleGenerativeAIEmbeddingProviderOptions>;
|
|
183
|
+
|
|
184
|
+
declare const googleTools: {
|
|
185
|
+
/**
|
|
186
|
+
* Creates a Google search tool that gives Google direct access to real-time web content.
|
|
187
|
+
* Must have name "google_search".
|
|
188
|
+
*/
|
|
189
|
+
googleSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {
|
|
190
|
+
mode?: "MODE_DYNAMIC" | "MODE_UNSPECIFIED";
|
|
191
|
+
dynamicThreshold?: number;
|
|
192
|
+
}>;
|
|
193
|
+
/**
|
|
194
|
+
* Creates an Enterprise Web Search tool for grounding responses using a compliance-focused web index.
|
|
195
|
+
* Designed for highly-regulated industries (finance, healthcare, public sector).
|
|
196
|
+
* Does not log customer data and supports VPC service controls.
|
|
197
|
+
* Must have name "enterprise_web_search".
|
|
198
|
+
*
|
|
199
|
+
* @note Only available on Vertex AI. Requires Gemini 2.0 or newer.
|
|
200
|
+
*
|
|
201
|
+
* @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/web-grounding-enterprise
|
|
202
|
+
*/
|
|
203
|
+
enterpriseWebSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}>;
|
|
204
|
+
/**
|
|
205
|
+
* Creates a Google Maps grounding tool that gives the model access to Google Maps data.
|
|
206
|
+
* Must have name "google_maps".
|
|
207
|
+
*
|
|
208
|
+
* @see https://ai.google.dev/gemini-api/docs/maps-grounding
|
|
209
|
+
* @see https://cloud.google.com/vertex-ai/generative-ai/docs/grounding/grounding-with-google-maps
|
|
210
|
+
*/
|
|
211
|
+
googleMaps: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}>;
|
|
212
|
+
/**
|
|
213
|
+
* Creates a URL context tool that gives Google direct access to real-time web content.
|
|
214
|
+
* Must have name "url_context".
|
|
215
|
+
*/
|
|
216
|
+
urlContext: _ai_sdk_provider_utils.ProviderToolFactory<{}, {}>;
|
|
217
|
+
/**
|
|
218
|
+
* Enables Retrieval Augmented Generation (RAG) via the Gemini File Search tool.
|
|
219
|
+
* Must have name "file_search".
|
|
220
|
+
*
|
|
221
|
+
* @param fileSearchStoreNames - Fully-qualified File Search store resource names.
|
|
222
|
+
* @param metadataFilter - Optional filter expression to restrict the files that can be retrieved.
|
|
223
|
+
* @param topK - Optional result limit for the number of chunks returned from File Search.
|
|
224
|
+
*
|
|
225
|
+
* @see https://ai.google.dev/gemini-api/docs/file-search
|
|
226
|
+
*/
|
|
227
|
+
fileSearch: _ai_sdk_provider_utils.ProviderToolFactory<{}, {
|
|
228
|
+
[x: string]: unknown;
|
|
229
|
+
fileSearchStoreNames: string[];
|
|
230
|
+
topK?: number | undefined;
|
|
231
|
+
metadataFilter?: string | undefined;
|
|
232
|
+
}>;
|
|
233
|
+
/**
|
|
234
|
+
* A tool that enables the model to generate and run Python code.
|
|
235
|
+
* Must have name "code_execution".
|
|
236
|
+
*
|
|
237
|
+
* @note Ensure the selected model supports Code Execution.
|
|
238
|
+
* Multi-tool usage with the code execution tool is typically compatible with Gemini >=2 models.
|
|
239
|
+
*
|
|
240
|
+
* @see https://ai.google.dev/gemini-api/docs/code-execution (Google AI)
|
|
241
|
+
* @see https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/code-execution-api (Vertex AI)
|
|
242
|
+
*/
|
|
243
|
+
codeExecution: _ai_sdk_provider_utils.ProviderToolFactoryWithOutputSchema<{
|
|
244
|
+
language: string;
|
|
245
|
+
code: string;
|
|
246
|
+
}, {
|
|
247
|
+
outcome: string;
|
|
248
|
+
output: string;
|
|
249
|
+
}, {}>;
|
|
250
|
+
/**
|
|
251
|
+
* Creates a Vertex RAG Store tool that enables the model to perform RAG searches against a Vertex RAG Store.
|
|
252
|
+
* Must have name "vertex_rag_store".
|
|
253
|
+
*/
|
|
254
|
+
vertexRagStore: _ai_sdk_provider_utils.ProviderToolFactory<{}, {
|
|
255
|
+
ragCorpus: string;
|
|
256
|
+
topK?: number;
|
|
257
|
+
}>;
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
interface GoogleGenerativeAIProvider extends ProviderV3 {
|
|
261
|
+
(modelId: GoogleGenerativeAIModelId): LanguageModelV3;
|
|
262
|
+
languageModel(modelId: GoogleGenerativeAIModelId): LanguageModelV3;
|
|
263
|
+
chat(modelId: GoogleGenerativeAIModelId): LanguageModelV3;
|
|
264
|
+
/**
|
|
265
|
+
* Creates a model for image generation.
|
|
266
|
+
*/
|
|
267
|
+
image(modelId: GoogleGenerativeAIImageModelId, settings?: GoogleGenerativeAIImageSettings): ImageModelV3;
|
|
268
|
+
/**
|
|
269
|
+
* @deprecated Use `chat()` instead.
|
|
270
|
+
*/
|
|
271
|
+
generativeAI(modelId: GoogleGenerativeAIModelId): LanguageModelV3;
|
|
272
|
+
/**
|
|
273
|
+
* Creates a model for text embeddings.
|
|
274
|
+
*/
|
|
275
|
+
embedding(modelId: GoogleGenerativeAIEmbeddingModelId): EmbeddingModelV3;
|
|
276
|
+
/**
|
|
277
|
+
* Creates a model for text embeddings.
|
|
278
|
+
*/
|
|
279
|
+
embeddingModel(modelId: GoogleGenerativeAIEmbeddingModelId): EmbeddingModelV3;
|
|
280
|
+
/**
|
|
281
|
+
* @deprecated Use `embedding` instead.
|
|
282
|
+
*/
|
|
283
|
+
textEmbedding(modelId: GoogleGenerativeAIEmbeddingModelId): EmbeddingModelV3;
|
|
284
|
+
/**
|
|
285
|
+
* @deprecated Use `embeddingModel` instead.
|
|
286
|
+
*/
|
|
287
|
+
textEmbeddingModel(modelId: GoogleGenerativeAIEmbeddingModelId): EmbeddingModelV3;
|
|
288
|
+
tools: typeof googleTools;
|
|
289
|
+
}
|
|
290
|
+
interface GoogleGenerativeAIProviderSettings {
|
|
291
|
+
/**
|
|
292
|
+
* Use a different URL prefix for API calls, e.g. to use proxy servers.
|
|
293
|
+
* The default prefix is `https://generativelanguage.googleapis.com/v1beta`.
|
|
294
|
+
*/
|
|
295
|
+
baseURL?: string;
|
|
296
|
+
/**
|
|
297
|
+
* API key that is being send using the `x-goog-api-key` header.
|
|
298
|
+
* It defaults to the `GOOGLE_GENERATIVE_AI_API_KEY` environment variable.
|
|
299
|
+
*/
|
|
300
|
+
apiKey?: string;
|
|
301
|
+
/**
|
|
302
|
+
* Custom headers to include in the requests.
|
|
303
|
+
*/
|
|
304
|
+
headers?: Record<string, string | undefined>;
|
|
305
|
+
/**
|
|
306
|
+
* Custom fetch implementation. You can use it as a middleware to intercept requests,
|
|
307
|
+
* or to provide a custom fetch implementation for e.g. testing.
|
|
308
|
+
*/
|
|
309
|
+
fetch?: FetchFunction;
|
|
310
|
+
/**
|
|
311
|
+
* Optional function to generate a unique ID for each request.
|
|
312
|
+
*/
|
|
313
|
+
generateId?: () => string;
|
|
314
|
+
/**
|
|
315
|
+
* Custom provider name
|
|
316
|
+
* Defaults to 'google.generative-ai'.
|
|
317
|
+
*/
|
|
318
|
+
name?: string;
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Create a Google Generative AI provider instance.
|
|
322
|
+
*/
|
|
323
|
+
declare function createGoogleGenerativeAI(options?: GoogleGenerativeAIProviderSettings): GoogleGenerativeAIProvider;
|
|
324
|
+
/**
|
|
325
|
+
* Default Google Generative AI provider instance.
|
|
326
|
+
*/
|
|
327
|
+
declare const google: GoogleGenerativeAIProvider;
|
|
328
|
+
|
|
329
|
+
declare const VERSION: string;
|
|
330
|
+
|
|
331
|
+
export { type GoogleErrorData, type GoogleGenerativeAIEmbeddingProviderOptions, type GoogleGenerativeAIImageProviderOptions, type GoogleGenerativeAIProvider, type GoogleGenerativeAIProviderMetadata, type GoogleGenerativeAIProviderOptions, type GoogleGenerativeAIProviderSettings, VERSION, createGoogleGenerativeAI, google };
|