@ai-sdk/google 3.0.14 → 3.0.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 +14 -0
- package/dist/index.d.mts +18 -18
- package/dist/index.d.ts +18 -18
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +4 -4
- package/dist/internal/index.d.ts +4 -4
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +1 -1
- package/dist/internal/index.mjs.map +1 -1
- package/docs/15-google-generative-ai.mdx +119 -15
- package/package.json +1 -1
- package/src/google-generative-ai-image-settings.ts +1 -1
- package/src/google-generative-ai-language-model.ts +7 -5
- package/src/google-provider.ts +15 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @ai-sdk/google
|
|
2
2
|
|
|
3
|
+
## 3.0.16
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 97b3ebb: fix (provider/google): make `segment` optional in `groundingSupports` schema
|
|
8
|
+
|
|
9
|
+
The Google Generative AI API sometimes returns grounding supports without a `segment` field. This change makes the `segment` field optional to handle these responses correctly.
|
|
10
|
+
|
|
11
|
+
## 3.0.15
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- 2c70b90: chore: update provider docs
|
|
16
|
+
|
|
3
17
|
## 3.0.14
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -105,11 +105,11 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
105
105
|
} | null | undefined;
|
|
106
106
|
}[] | null | undefined;
|
|
107
107
|
groundingSupports?: {
|
|
108
|
-
segment
|
|
108
|
+
segment?: {
|
|
109
109
|
startIndex?: number | null | undefined;
|
|
110
110
|
endIndex?: number | null | undefined;
|
|
111
111
|
text?: string | null | undefined;
|
|
112
|
-
};
|
|
112
|
+
} | null | undefined;
|
|
113
113
|
segment_text?: string | null | undefined;
|
|
114
114
|
groundingChunkIndices?: number[] | null | undefined;
|
|
115
115
|
supportChunkIndices?: number[] | null | undefined;
|
|
@@ -163,7 +163,7 @@ interface GoogleGenerativeAIProviderMetadata {
|
|
|
163
163
|
type GoogleGenerativeAIImageModelId = 'imagen-4.0-generate-001' | 'imagen-4.0-ultra-generate-001' | 'imagen-4.0-fast-generate-001' | (string & {});
|
|
164
164
|
interface GoogleGenerativeAIImageSettings {
|
|
165
165
|
/**
|
|
166
|
-
|
|
166
|
+
* Override the maximum number of images per call (default 4)
|
|
167
167
|
*/
|
|
168
168
|
maxImagesPerCall?: number;
|
|
169
169
|
}
|
|
@@ -262,8 +262,8 @@ interface GoogleGenerativeAIProvider extends ProviderV3 {
|
|
|
262
262
|
languageModel(modelId: GoogleGenerativeAIModelId): LanguageModelV3;
|
|
263
263
|
chat(modelId: GoogleGenerativeAIModelId): LanguageModelV3;
|
|
264
264
|
/**
|
|
265
|
-
|
|
266
|
-
|
|
265
|
+
* Creates a model for image generation.
|
|
266
|
+
*/
|
|
267
267
|
image(modelId: GoogleGenerativeAIImageModelId, settings?: GoogleGenerativeAIImageSettings): ImageModelV3;
|
|
268
268
|
/**
|
|
269
269
|
* @deprecated Use `chat()` instead.
|
|
@@ -289,27 +289,27 @@ interface GoogleGenerativeAIProvider extends ProviderV3 {
|
|
|
289
289
|
}
|
|
290
290
|
interface GoogleGenerativeAIProviderSettings {
|
|
291
291
|
/**
|
|
292
|
-
|
|
293
|
-
|
|
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
294
|
*/
|
|
295
295
|
baseURL?: string;
|
|
296
296
|
/**
|
|
297
|
-
|
|
298
|
-
|
|
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
299
|
*/
|
|
300
300
|
apiKey?: string;
|
|
301
301
|
/**
|
|
302
|
-
|
|
303
|
-
|
|
302
|
+
* Custom headers to include in the requests.
|
|
303
|
+
*/
|
|
304
304
|
headers?: Record<string, string | undefined>;
|
|
305
305
|
/**
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
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
309
|
fetch?: FetchFunction;
|
|
310
310
|
/**
|
|
311
|
-
|
|
312
|
-
|
|
311
|
+
* Optional function to generate a unique ID for each request.
|
|
312
|
+
*/
|
|
313
313
|
generateId?: () => string;
|
|
314
314
|
/**
|
|
315
315
|
* Custom provider name
|
|
@@ -318,11 +318,11 @@ interface GoogleGenerativeAIProviderSettings {
|
|
|
318
318
|
name?: string;
|
|
319
319
|
}
|
|
320
320
|
/**
|
|
321
|
-
Create a Google Generative AI provider instance.
|
|
321
|
+
* Create a Google Generative AI provider instance.
|
|
322
322
|
*/
|
|
323
323
|
declare function createGoogleGenerativeAI(options?: GoogleGenerativeAIProviderSettings): GoogleGenerativeAIProvider;
|
|
324
324
|
/**
|
|
325
|
-
Default Google Generative AI provider instance.
|
|
325
|
+
* Default Google Generative AI provider instance.
|
|
326
326
|
*/
|
|
327
327
|
declare const google: GoogleGenerativeAIProvider;
|
|
328
328
|
|
package/dist/index.d.ts
CHANGED
|
@@ -105,11 +105,11 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
105
105
|
} | null | undefined;
|
|
106
106
|
}[] | null | undefined;
|
|
107
107
|
groundingSupports?: {
|
|
108
|
-
segment
|
|
108
|
+
segment?: {
|
|
109
109
|
startIndex?: number | null | undefined;
|
|
110
110
|
endIndex?: number | null | undefined;
|
|
111
111
|
text?: string | null | undefined;
|
|
112
|
-
};
|
|
112
|
+
} | null | undefined;
|
|
113
113
|
segment_text?: string | null | undefined;
|
|
114
114
|
groundingChunkIndices?: number[] | null | undefined;
|
|
115
115
|
supportChunkIndices?: number[] | null | undefined;
|
|
@@ -163,7 +163,7 @@ interface GoogleGenerativeAIProviderMetadata {
|
|
|
163
163
|
type GoogleGenerativeAIImageModelId = 'imagen-4.0-generate-001' | 'imagen-4.0-ultra-generate-001' | 'imagen-4.0-fast-generate-001' | (string & {});
|
|
164
164
|
interface GoogleGenerativeAIImageSettings {
|
|
165
165
|
/**
|
|
166
|
-
|
|
166
|
+
* Override the maximum number of images per call (default 4)
|
|
167
167
|
*/
|
|
168
168
|
maxImagesPerCall?: number;
|
|
169
169
|
}
|
|
@@ -262,8 +262,8 @@ interface GoogleGenerativeAIProvider extends ProviderV3 {
|
|
|
262
262
|
languageModel(modelId: GoogleGenerativeAIModelId): LanguageModelV3;
|
|
263
263
|
chat(modelId: GoogleGenerativeAIModelId): LanguageModelV3;
|
|
264
264
|
/**
|
|
265
|
-
|
|
266
|
-
|
|
265
|
+
* Creates a model for image generation.
|
|
266
|
+
*/
|
|
267
267
|
image(modelId: GoogleGenerativeAIImageModelId, settings?: GoogleGenerativeAIImageSettings): ImageModelV3;
|
|
268
268
|
/**
|
|
269
269
|
* @deprecated Use `chat()` instead.
|
|
@@ -289,27 +289,27 @@ interface GoogleGenerativeAIProvider extends ProviderV3 {
|
|
|
289
289
|
}
|
|
290
290
|
interface GoogleGenerativeAIProviderSettings {
|
|
291
291
|
/**
|
|
292
|
-
|
|
293
|
-
|
|
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
294
|
*/
|
|
295
295
|
baseURL?: string;
|
|
296
296
|
/**
|
|
297
|
-
|
|
298
|
-
|
|
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
299
|
*/
|
|
300
300
|
apiKey?: string;
|
|
301
301
|
/**
|
|
302
|
-
|
|
303
|
-
|
|
302
|
+
* Custom headers to include in the requests.
|
|
303
|
+
*/
|
|
304
304
|
headers?: Record<string, string | undefined>;
|
|
305
305
|
/**
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
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
309
|
fetch?: FetchFunction;
|
|
310
310
|
/**
|
|
311
|
-
|
|
312
|
-
|
|
311
|
+
* Optional function to generate a unique ID for each request.
|
|
312
|
+
*/
|
|
313
313
|
generateId?: () => string;
|
|
314
314
|
/**
|
|
315
315
|
* Custom provider name
|
|
@@ -318,11 +318,11 @@ interface GoogleGenerativeAIProviderSettings {
|
|
|
318
318
|
name?: string;
|
|
319
319
|
}
|
|
320
320
|
/**
|
|
321
|
-
Create a Google Generative AI provider instance.
|
|
321
|
+
* Create a Google Generative AI provider instance.
|
|
322
322
|
*/
|
|
323
323
|
declare function createGoogleGenerativeAI(options?: GoogleGenerativeAIProviderSettings): GoogleGenerativeAIProvider;
|
|
324
324
|
/**
|
|
325
|
-
Default Google Generative AI provider instance.
|
|
325
|
+
* Default Google Generative AI provider instance.
|
|
326
326
|
*/
|
|
327
327
|
declare const google: GoogleGenerativeAIProvider;
|
|
328
328
|
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(src_exports);
|
|
|
30
30
|
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
31
31
|
|
|
32
32
|
// src/version.ts
|
|
33
|
-
var VERSION = true ? "3.0.
|
|
33
|
+
var VERSION = true ? "3.0.16" : "0.0.0-test";
|
|
34
34
|
|
|
35
35
|
// src/google-generative-ai-embedding-model.ts
|
|
36
36
|
var import_provider = require("@ai-sdk/provider");
|
|
@@ -1502,7 +1502,7 @@ var getGroundingMetadataSchema = () => import_v45.z.object({
|
|
|
1502
1502
|
startIndex: import_v45.z.number().nullish(),
|
|
1503
1503
|
endIndex: import_v45.z.number().nullish(),
|
|
1504
1504
|
text: import_v45.z.string().nullish()
|
|
1505
|
-
}),
|
|
1505
|
+
}).nullish(),
|
|
1506
1506
|
segment_text: import_v45.z.string().nullish(),
|
|
1507
1507
|
groundingChunkIndices: import_v45.z.array(import_v45.z.number()).nullish(),
|
|
1508
1508
|
supportChunkIndices: import_v45.z.array(import_v45.z.number()).nullish(),
|