@ai-sdk/google 4.0.0-beta.17 → 4.0.0-beta.18
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 +6 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +25 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -8
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.d.mts +1 -0
- package/dist/internal/index.d.ts +1 -0
- package/dist/internal/index.js +24 -7
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +24 -7
- package/dist/internal/index.mjs.map +1 -1
- package/docs/15-google-generative-ai.mdx +6 -0
- package/package.json +1 -1
- package/src/google-generative-ai-language-model.ts +10 -0
- package/src/google-generative-ai-options.ts +11 -0
- package/src/google-generative-ai-prompt.ts +1 -0
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -39,6 +39,7 @@ declare const googleLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
|
39
39
|
longitude: number;
|
|
40
40
|
} | undefined;
|
|
41
41
|
} | undefined;
|
|
42
|
+
serviceTier?: "SERVICE_TIER_STANDARD" | "SERVICE_TIER_FLEX" | "SERVICE_TIER_PRIORITY" | undefined;
|
|
42
43
|
}>;
|
|
43
44
|
type GoogleLanguageModelOptions = InferSchema<typeof googleLanguageModelOptions>;
|
|
44
45
|
|
|
@@ -155,6 +156,7 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
155
156
|
blocked?: boolean | null | undefined;
|
|
156
157
|
}[] | null | undefined;
|
|
157
158
|
} | null | undefined;
|
|
159
|
+
serviceTier?: string | null | undefined;
|
|
158
160
|
}>;
|
|
159
161
|
type GroundingMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['groundingMetadata']>;
|
|
160
162
|
type UrlContextMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['urlContextMetadata']>;
|
|
@@ -174,6 +176,7 @@ interface GoogleGenerativeAIProviderMetadata {
|
|
|
174
176
|
safetyRatings: GoogleGenerativeAISafetyRating[] | null;
|
|
175
177
|
usageMetadata: GoogleGenerativeAIUsageMetadata | null;
|
|
176
178
|
finishMessage: string | null;
|
|
179
|
+
serviceTier: string | null;
|
|
177
180
|
}
|
|
178
181
|
|
|
179
182
|
type GoogleGenerativeAIImageModelId = 'imagen-4.0-generate-001' | 'imagen-4.0-ultra-generate-001' | 'imagen-4.0-fast-generate-001' | 'gemini-2.5-flash-image' | 'gemini-3-pro-image-preview' | 'gemini-3.1-flash-image-preview' | (string & {});
|
package/dist/index.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ declare const googleLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
|
39
39
|
longitude: number;
|
|
40
40
|
} | undefined;
|
|
41
41
|
} | undefined;
|
|
42
|
+
serviceTier?: "SERVICE_TIER_STANDARD" | "SERVICE_TIER_FLEX" | "SERVICE_TIER_PRIORITY" | undefined;
|
|
42
43
|
}>;
|
|
43
44
|
type GoogleLanguageModelOptions = InferSchema<typeof googleLanguageModelOptions>;
|
|
44
45
|
|
|
@@ -155,6 +156,7 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
155
156
|
blocked?: boolean | null | undefined;
|
|
156
157
|
}[] | null | undefined;
|
|
157
158
|
} | null | undefined;
|
|
159
|
+
serviceTier?: string | null | undefined;
|
|
158
160
|
}>;
|
|
159
161
|
type GroundingMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['groundingMetadata']>;
|
|
160
162
|
type UrlContextMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['urlContextMetadata']>;
|
|
@@ -174,6 +176,7 @@ interface GoogleGenerativeAIProviderMetadata {
|
|
|
174
176
|
safetyRatings: GoogleGenerativeAISafetyRating[] | null;
|
|
175
177
|
usageMetadata: GoogleGenerativeAIUsageMetadata | null;
|
|
176
178
|
finishMessage: string | null;
|
|
179
|
+
serviceTier: string | null;
|
|
177
180
|
}
|
|
178
181
|
|
|
179
182
|
type GoogleGenerativeAIImageModelId = 'imagen-4.0-generate-001' | 'imagen-4.0-ultra-generate-001' | 'imagen-4.0-fast-generate-001' | 'gemini-2.5-flash-image' | 'gemini-3-pro-image-preview' | 'gemini-3.1-flash-image-preview' | (string & {});
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
30
30
|
var import_provider_utils16 = require("@ai-sdk/provider-utils");
|
|
31
31
|
|
|
32
32
|
// src/version.ts
|
|
33
|
-
var VERSION = true ? "4.0.0-beta.
|
|
33
|
+
var VERSION = true ? "4.0.0-beta.18" : "0.0.0-test";
|
|
34
34
|
|
|
35
35
|
// src/google-generative-ai-embedding-model.ts
|
|
36
36
|
var import_provider = require("@ai-sdk/provider");
|
|
@@ -786,7 +786,15 @@ var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
|
|
|
786
786
|
latitude: import_v44.z.number(),
|
|
787
787
|
longitude: import_v44.z.number()
|
|
788
788
|
}).optional()
|
|
789
|
-
}).optional()
|
|
789
|
+
}).optional(),
|
|
790
|
+
/**
|
|
791
|
+
* Optional. The service tier to use for the request.
|
|
792
|
+
*/
|
|
793
|
+
serviceTier: import_v44.z.enum([
|
|
794
|
+
"SERVICE_TIER_STANDARD",
|
|
795
|
+
"SERVICE_TIER_FLEX",
|
|
796
|
+
"SERVICE_TIER_PRIORITY"
|
|
797
|
+
]).optional()
|
|
790
798
|
})
|
|
791
799
|
)
|
|
792
800
|
);
|
|
@@ -1147,14 +1155,15 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1147
1155
|
retrievalConfig: googleOptions.retrievalConfig
|
|
1148
1156
|
} : googleToolConfig,
|
|
1149
1157
|
cachedContent: googleOptions == null ? void 0 : googleOptions.cachedContent,
|
|
1150
|
-
labels: googleOptions == null ? void 0 : googleOptions.labels
|
|
1158
|
+
labels: googleOptions == null ? void 0 : googleOptions.labels,
|
|
1159
|
+
serviceTier: googleOptions == null ? void 0 : googleOptions.serviceTier
|
|
1151
1160
|
},
|
|
1152
1161
|
warnings: [...warnings, ...toolWarnings],
|
|
1153
1162
|
providerOptionsName
|
|
1154
1163
|
};
|
|
1155
1164
|
}
|
|
1156
1165
|
async doGenerate(options) {
|
|
1157
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
1166
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
1158
1167
|
const { args, warnings, providerOptionsName } = await this.getArgs(options);
|
|
1159
1168
|
const mergedHeaders = (0, import_provider_utils6.combineHeaders)(
|
|
1160
1169
|
await (0, import_provider_utils6.resolve)(this.config.headers),
|
|
@@ -1276,7 +1285,8 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1276
1285
|
urlContextMetadata: (_i = candidate.urlContextMetadata) != null ? _i : null,
|
|
1277
1286
|
safetyRatings: (_j = candidate.safetyRatings) != null ? _j : null,
|
|
1278
1287
|
usageMetadata: usageMetadata != null ? usageMetadata : null,
|
|
1279
|
-
finishMessage: (_k = candidate.finishMessage) != null ? _k : null
|
|
1288
|
+
finishMessage: (_k = candidate.finishMessage) != null ? _k : null,
|
|
1289
|
+
serviceTier: (_l = response.serviceTier) != null ? _l : null
|
|
1280
1290
|
}
|
|
1281
1291
|
},
|
|
1282
1292
|
request: { body: args },
|
|
@@ -1312,6 +1322,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1312
1322
|
let providerMetadata = void 0;
|
|
1313
1323
|
let lastGroundingMetadata = null;
|
|
1314
1324
|
let lastUrlContextMetadata = null;
|
|
1325
|
+
let serviceTier = null;
|
|
1315
1326
|
const generateId3 = this.config.generateId;
|
|
1316
1327
|
let hasToolCalls = false;
|
|
1317
1328
|
let currentTextBlockId = null;
|
|
@@ -1339,6 +1350,9 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1339
1350
|
if (usageMetadata != null) {
|
|
1340
1351
|
usage = usageMetadata;
|
|
1341
1352
|
}
|
|
1353
|
+
if (value.serviceTier != null) {
|
|
1354
|
+
serviceTier = value.serviceTier;
|
|
1355
|
+
}
|
|
1342
1356
|
const candidate = (_a = value.candidates) == null ? void 0 : _a[0];
|
|
1343
1357
|
if (candidate == null) {
|
|
1344
1358
|
return;
|
|
@@ -1529,7 +1543,8 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1529
1543
|
urlContextMetadata: lastUrlContextMetadata,
|
|
1530
1544
|
safetyRatings: (_f = candidate.safetyRatings) != null ? _f : null,
|
|
1531
1545
|
usageMetadata: usageMetadata != null ? usageMetadata : null,
|
|
1532
|
-
finishMessage: (_g = candidate.finishMessage) != null ? _g : null
|
|
1546
|
+
finishMessage: (_g = candidate.finishMessage) != null ? _g : null,
|
|
1547
|
+
serviceTier
|
|
1533
1548
|
}
|
|
1534
1549
|
};
|
|
1535
1550
|
}
|
|
@@ -1870,7 +1885,8 @@ var responseSchema = (0, import_provider_utils6.lazySchema)(
|
|
|
1870
1885
|
promptFeedback: import_v45.z.object({
|
|
1871
1886
|
blockReason: import_v45.z.string().nullish(),
|
|
1872
1887
|
safetyRatings: import_v45.z.array(getSafetyRatingSchema()).nullish()
|
|
1873
|
-
}).nullish()
|
|
1888
|
+
}).nullish(),
|
|
1889
|
+
serviceTier: import_v45.z.string().nullish()
|
|
1874
1890
|
})
|
|
1875
1891
|
)
|
|
1876
1892
|
);
|
|
@@ -1891,7 +1907,8 @@ var chunkSchema = (0, import_provider_utils6.lazySchema)(
|
|
|
1891
1907
|
promptFeedback: import_v45.z.object({
|
|
1892
1908
|
blockReason: import_v45.z.string().nullish(),
|
|
1893
1909
|
safetyRatings: import_v45.z.array(getSafetyRatingSchema()).nullish()
|
|
1894
|
-
}).nullish()
|
|
1910
|
+
}).nullish(),
|
|
1911
|
+
serviceTier: import_v45.z.string().nullish()
|
|
1895
1912
|
})
|
|
1896
1913
|
)
|
|
1897
1914
|
);
|