@ai-sdk/google 3.0.53 → 3.0.54
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 +5 -5
- 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 ? "3.0.
|
|
33
|
+
var VERSION = true ? "3.0.54" : "0.0.0-test";
|
|
34
34
|
|
|
35
35
|
// src/google-generative-ai-embedding-model.ts
|
|
36
36
|
var import_provider = require("@ai-sdk/provider");
|
|
@@ -771,7 +771,15 @@ var googleLanguageModelOptions = (0, import_provider_utils5.lazySchema)(
|
|
|
771
771
|
latitude: import_v44.z.number(),
|
|
772
772
|
longitude: import_v44.z.number()
|
|
773
773
|
}).optional()
|
|
774
|
-
}).optional()
|
|
774
|
+
}).optional(),
|
|
775
|
+
/**
|
|
776
|
+
* Optional. The service tier to use for the request.
|
|
777
|
+
*/
|
|
778
|
+
serviceTier: import_v44.z.enum([
|
|
779
|
+
"SERVICE_TIER_STANDARD",
|
|
780
|
+
"SERVICE_TIER_FLEX",
|
|
781
|
+
"SERVICE_TIER_PRIORITY"
|
|
782
|
+
]).optional()
|
|
775
783
|
})
|
|
776
784
|
)
|
|
777
785
|
);
|
|
@@ -1125,14 +1133,15 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1125
1133
|
retrievalConfig: googleOptions.retrievalConfig
|
|
1126
1134
|
} : googleToolConfig,
|
|
1127
1135
|
cachedContent: googleOptions == null ? void 0 : googleOptions.cachedContent,
|
|
1128
|
-
labels: googleOptions == null ? void 0 : googleOptions.labels
|
|
1136
|
+
labels: googleOptions == null ? void 0 : googleOptions.labels,
|
|
1137
|
+
serviceTier: googleOptions == null ? void 0 : googleOptions.serviceTier
|
|
1129
1138
|
},
|
|
1130
1139
|
warnings: [...warnings, ...toolWarnings],
|
|
1131
1140
|
providerOptionsName
|
|
1132
1141
|
};
|
|
1133
1142
|
}
|
|
1134
1143
|
async doGenerate(options) {
|
|
1135
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
1144
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
1136
1145
|
const { args, warnings, providerOptionsName } = await this.getArgs(options);
|
|
1137
1146
|
const mergedHeaders = (0, import_provider_utils6.combineHeaders)(
|
|
1138
1147
|
await (0, import_provider_utils6.resolve)(this.config.headers),
|
|
@@ -1255,7 +1264,8 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1255
1264
|
urlContextMetadata: (_i = candidate.urlContextMetadata) != null ? _i : null,
|
|
1256
1265
|
safetyRatings: (_j = candidate.safetyRatings) != null ? _j : null,
|
|
1257
1266
|
usageMetadata: usageMetadata != null ? usageMetadata : null,
|
|
1258
|
-
finishMessage: (_k = candidate.finishMessage) != null ? _k : null
|
|
1267
|
+
finishMessage: (_k = candidate.finishMessage) != null ? _k : null,
|
|
1268
|
+
serviceTier: (_l = response.serviceTier) != null ? _l : null
|
|
1259
1269
|
}
|
|
1260
1270
|
},
|
|
1261
1271
|
request: { body: args },
|
|
@@ -1291,6 +1301,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1291
1301
|
let providerMetadata = void 0;
|
|
1292
1302
|
let lastGroundingMetadata = null;
|
|
1293
1303
|
let lastUrlContextMetadata = null;
|
|
1304
|
+
let serviceTier = null;
|
|
1294
1305
|
const generateId3 = this.config.generateId;
|
|
1295
1306
|
let hasToolCalls = false;
|
|
1296
1307
|
let currentTextBlockId = null;
|
|
@@ -1318,6 +1329,9 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1318
1329
|
if (usageMetadata != null) {
|
|
1319
1330
|
usage = usageMetadata;
|
|
1320
1331
|
}
|
|
1332
|
+
if (value.serviceTier != null) {
|
|
1333
|
+
serviceTier = value.serviceTier;
|
|
1334
|
+
}
|
|
1321
1335
|
const candidate = (_a = value.candidates) == null ? void 0 : _a[0];
|
|
1322
1336
|
if (candidate == null) {
|
|
1323
1337
|
return;
|
|
@@ -1509,7 +1523,8 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1509
1523
|
urlContextMetadata: lastUrlContextMetadata,
|
|
1510
1524
|
safetyRatings: (_f = candidate.safetyRatings) != null ? _f : null,
|
|
1511
1525
|
usageMetadata: usageMetadata != null ? usageMetadata : null,
|
|
1512
|
-
finishMessage: (_g = candidate.finishMessage) != null ? _g : null
|
|
1526
|
+
finishMessage: (_g = candidate.finishMessage) != null ? _g : null,
|
|
1527
|
+
serviceTier
|
|
1513
1528
|
}
|
|
1514
1529
|
};
|
|
1515
1530
|
}
|
|
@@ -1781,7 +1796,8 @@ var responseSchema = (0, import_provider_utils6.lazySchema)(
|
|
|
1781
1796
|
promptFeedback: import_v45.z.object({
|
|
1782
1797
|
blockReason: import_v45.z.string().nullish(),
|
|
1783
1798
|
safetyRatings: import_v45.z.array(getSafetyRatingSchema()).nullish()
|
|
1784
|
-
}).nullish()
|
|
1799
|
+
}).nullish(),
|
|
1800
|
+
serviceTier: import_v45.z.string().nullish()
|
|
1785
1801
|
})
|
|
1786
1802
|
)
|
|
1787
1803
|
);
|
|
@@ -1802,7 +1818,8 @@ var chunkSchema = (0, import_provider_utils6.lazySchema)(
|
|
|
1802
1818
|
promptFeedback: import_v45.z.object({
|
|
1803
1819
|
blockReason: import_v45.z.string().nullish(),
|
|
1804
1820
|
safetyRatings: import_v45.z.array(getSafetyRatingSchema()).nullish()
|
|
1805
|
-
}).nullish()
|
|
1821
|
+
}).nullish(),
|
|
1822
|
+
serviceTier: import_v45.z.string().nullish()
|
|
1806
1823
|
})
|
|
1807
1824
|
)
|
|
1808
1825
|
);
|