@ai-sdk/google 2.0.63 → 2.0.65
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 +13 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +24 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -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 +23 -7
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +23 -7
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# @ai-sdk/google
|
|
2
2
|
|
|
3
|
+
## 2.0.65
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [a27a978]
|
|
8
|
+
- @ai-sdk/provider-utils@3.0.23
|
|
9
|
+
|
|
10
|
+
## 2.0.64
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- fd3f1d3: feat(provider/google): add support for service tier parameter
|
|
15
|
+
|
|
3
16
|
## 2.0.63
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -39,6 +39,7 @@ declare const googleGenerativeAIProviderOptions: _ai_sdk_provider_utils.LazySche
|
|
|
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 GoogleGenerativeAIProviderOptions = InferValidator<typeof googleGenerativeAIProviderOptions>;
|
|
44
45
|
|
|
@@ -152,6 +153,7 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
152
153
|
blocked?: boolean | null | undefined;
|
|
153
154
|
}[] | null | undefined;
|
|
154
155
|
} | null | undefined;
|
|
156
|
+
serviceTier?: string | null | undefined;
|
|
155
157
|
}>;
|
|
156
158
|
type GroundingMetadataSchema = NonNullable<InferValidator<typeof responseSchema>['candidates'][number]['groundingMetadata']>;
|
|
157
159
|
type UrlContextMetadataSchema = NonNullable<InferValidator<typeof responseSchema>['candidates'][number]['urlContextMetadata']>;
|
|
@@ -164,6 +166,7 @@ interface GoogleGenerativeAIProviderMetadata {
|
|
|
164
166
|
groundingMetadata: GoogleGenerativeAIGroundingMetadata | null;
|
|
165
167
|
urlContextMetadata: GoogleGenerativeAIUrlContextMetadata | null;
|
|
166
168
|
safetyRatings: GoogleGenerativeAISafetyRating[] | null;
|
|
169
|
+
serviceTier: string | null;
|
|
167
170
|
}
|
|
168
171
|
|
|
169
172
|
type GoogleGenerativeAIImageModelId = 'imagen-4.0-generate-001' | 'imagen-4.0-ultra-generate-001' | 'imagen-4.0-fast-generate-001' | (string & {});
|
package/dist/index.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ declare const googleGenerativeAIProviderOptions: _ai_sdk_provider_utils.LazySche
|
|
|
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 GoogleGenerativeAIProviderOptions = InferValidator<typeof googleGenerativeAIProviderOptions>;
|
|
44
45
|
|
|
@@ -152,6 +153,7 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
|
152
153
|
blocked?: boolean | null | undefined;
|
|
153
154
|
}[] | null | undefined;
|
|
154
155
|
} | null | undefined;
|
|
156
|
+
serviceTier?: string | null | undefined;
|
|
155
157
|
}>;
|
|
156
158
|
type GroundingMetadataSchema = NonNullable<InferValidator<typeof responseSchema>['candidates'][number]['groundingMetadata']>;
|
|
157
159
|
type UrlContextMetadataSchema = NonNullable<InferValidator<typeof responseSchema>['candidates'][number]['urlContextMetadata']>;
|
|
@@ -164,6 +166,7 @@ interface GoogleGenerativeAIProviderMetadata {
|
|
|
164
166
|
groundingMetadata: GoogleGenerativeAIGroundingMetadata | null;
|
|
165
167
|
urlContextMetadata: GoogleGenerativeAIUrlContextMetadata | null;
|
|
166
168
|
safetyRatings: GoogleGenerativeAISafetyRating[] | null;
|
|
169
|
+
serviceTier: string | null;
|
|
167
170
|
}
|
|
168
171
|
|
|
169
172
|
type GoogleGenerativeAIImageModelId = 'imagen-4.0-generate-001' | 'imagen-4.0-ultra-generate-001' | 'imagen-4.0-fast-generate-001' | (string & {});
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
30
30
|
var import_provider_utils15 = require("@ai-sdk/provider-utils");
|
|
31
31
|
|
|
32
32
|
// src/version.ts
|
|
33
|
-
var VERSION = true ? "2.0.
|
|
33
|
+
var VERSION = true ? "2.0.65" : "0.0.0-test";
|
|
34
34
|
|
|
35
35
|
// src/google-generative-ai-embedding-model.ts
|
|
36
36
|
var import_provider = require("@ai-sdk/provider");
|
|
@@ -695,7 +695,15 @@ var googleGenerativeAIProviderOptions = (0, import_provider_utils5.lazySchema)(
|
|
|
695
695
|
latitude: import_v44.z.number(),
|
|
696
696
|
longitude: import_v44.z.number()
|
|
697
697
|
}).optional()
|
|
698
|
-
}).optional()
|
|
698
|
+
}).optional(),
|
|
699
|
+
/**
|
|
700
|
+
* Optional. The service tier to use for the request.
|
|
701
|
+
*/
|
|
702
|
+
serviceTier: import_v44.z.enum([
|
|
703
|
+
"SERVICE_TIER_STANDARD",
|
|
704
|
+
"SERVICE_TIER_FLEX",
|
|
705
|
+
"SERVICE_TIER_PRIORITY"
|
|
706
|
+
]).optional()
|
|
699
707
|
})
|
|
700
708
|
)
|
|
701
709
|
);
|
|
@@ -1026,13 +1034,14 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1026
1034
|
retrievalConfig: googleOptions.retrievalConfig
|
|
1027
1035
|
} : googleToolConfig,
|
|
1028
1036
|
cachedContent: googleOptions == null ? void 0 : googleOptions.cachedContent,
|
|
1029
|
-
labels: googleOptions == null ? void 0 : googleOptions.labels
|
|
1037
|
+
labels: googleOptions == null ? void 0 : googleOptions.labels,
|
|
1038
|
+
serviceTier: googleOptions == null ? void 0 : googleOptions.serviceTier
|
|
1030
1039
|
},
|
|
1031
1040
|
warnings: [...warnings, ...toolWarnings]
|
|
1032
1041
|
};
|
|
1033
1042
|
}
|
|
1034
1043
|
async doGenerate(options) {
|
|
1035
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m;
|
|
1044
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
1036
1045
|
const { args, warnings } = await this.getArgs(options);
|
|
1037
1046
|
const body = JSON.stringify(args);
|
|
1038
1047
|
const mergedHeaders = (0, import_provider_utils6.combineHeaders)(
|
|
@@ -1142,7 +1151,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1142
1151
|
groundingMetadata: (_k = candidate.groundingMetadata) != null ? _k : null,
|
|
1143
1152
|
urlContextMetadata: (_l = candidate.urlContextMetadata) != null ? _l : null,
|
|
1144
1153
|
safetyRatings: (_m = candidate.safetyRatings) != null ? _m : null,
|
|
1145
|
-
|
|
1154
|
+
serviceTier: (_n = response.serviceTier) != null ? _n : null
|
|
1146
1155
|
}
|
|
1147
1156
|
},
|
|
1148
1157
|
request: { body },
|
|
@@ -1180,6 +1189,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1180
1189
|
let providerMetadata = void 0;
|
|
1181
1190
|
let lastGroundingMetadata = null;
|
|
1182
1191
|
let lastUrlContextMetadata = null;
|
|
1192
|
+
let serviceTier = null;
|
|
1183
1193
|
const generateId3 = this.config.generateId;
|
|
1184
1194
|
let hasToolCalls = false;
|
|
1185
1195
|
let currentTextBlockId = null;
|
|
@@ -1211,6 +1221,9 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1211
1221
|
usage.reasoningTokens = (_d = usageMetadata.thoughtsTokenCount) != null ? _d : void 0;
|
|
1212
1222
|
usage.cachedInputTokens = (_e = usageMetadata.cachedContentTokenCount) != null ? _e : void 0;
|
|
1213
1223
|
}
|
|
1224
|
+
if (value.serviceTier != null) {
|
|
1225
|
+
serviceTier = value.serviceTier;
|
|
1226
|
+
}
|
|
1214
1227
|
const candidate = (_f = value.candidates) == null ? void 0 : _f[0];
|
|
1215
1228
|
if (candidate == null) {
|
|
1216
1229
|
return;
|
|
@@ -1375,7 +1388,8 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1375
1388
|
promptFeedback: (_i = value.promptFeedback) != null ? _i : null,
|
|
1376
1389
|
groundingMetadata: lastGroundingMetadata,
|
|
1377
1390
|
urlContextMetadata: lastUrlContextMetadata,
|
|
1378
|
-
safetyRatings: (_j = candidate.safetyRatings) != null ? _j : null
|
|
1391
|
+
safetyRatings: (_j = candidate.safetyRatings) != null ? _j : null,
|
|
1392
|
+
serviceTier
|
|
1379
1393
|
}
|
|
1380
1394
|
};
|
|
1381
1395
|
if (usageMetadata != null) {
|
|
@@ -1642,7 +1656,8 @@ var responseSchema = (0, import_provider_utils6.lazySchema)(
|
|
|
1642
1656
|
promptFeedback: import_v45.z.object({
|
|
1643
1657
|
blockReason: import_v45.z.string().nullish(),
|
|
1644
1658
|
safetyRatings: import_v45.z.array(getSafetyRatingSchema()).nullish()
|
|
1645
|
-
}).nullish()
|
|
1659
|
+
}).nullish(),
|
|
1660
|
+
serviceTier: import_v45.z.string().nullish()
|
|
1646
1661
|
})
|
|
1647
1662
|
)
|
|
1648
1663
|
);
|
|
@@ -1662,7 +1677,8 @@ var chunkSchema = (0, import_provider_utils6.lazySchema)(
|
|
|
1662
1677
|
promptFeedback: import_v45.z.object({
|
|
1663
1678
|
blockReason: import_v45.z.string().nullish(),
|
|
1664
1679
|
safetyRatings: import_v45.z.array(getSafetyRatingSchema()).nullish()
|
|
1665
|
-
}).nullish()
|
|
1680
|
+
}).nullish(),
|
|
1681
|
+
serviceTier: import_v45.z.string().nullish()
|
|
1666
1682
|
})
|
|
1667
1683
|
)
|
|
1668
1684
|
);
|