@ai-sdk/google 2.0.78 → 2.0.79
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.js +15 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -4
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +14 -3
- package/dist/internal/index.js.map +1 -1
- package/dist/internal/index.mjs +14 -3
- package/dist/internal/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
} from "@ai-sdk/provider-utils";
|
|
8
8
|
|
|
9
9
|
// src/version.ts
|
|
10
|
-
var VERSION = true ? "2.0.
|
|
10
|
+
var VERSION = true ? "2.0.79" : "0.0.0-test";
|
|
11
11
|
|
|
12
12
|
// src/google-generative-ai-embedding-model.ts
|
|
13
13
|
import {
|
|
@@ -962,6 +962,12 @@ function mapGoogleGenerativeAIFinishReason({
|
|
|
962
962
|
}
|
|
963
963
|
|
|
964
964
|
// src/google-generative-ai-language-model.ts
|
|
965
|
+
var configurableSafetySettingCategories = [
|
|
966
|
+
"HARM_CATEGORY_HATE_SPEECH",
|
|
967
|
+
"HARM_CATEGORY_DANGEROUS_CONTENT",
|
|
968
|
+
"HARM_CATEGORY_HARASSMENT",
|
|
969
|
+
"HARM_CATEGORY_SEXUALLY_EXPLICIT"
|
|
970
|
+
];
|
|
965
971
|
var GoogleGenerativeAILanguageModel = class {
|
|
966
972
|
constructor(modelId, config) {
|
|
967
973
|
this.specificationVersion = "v2";
|
|
@@ -992,7 +998,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
992
998
|
toolChoice,
|
|
993
999
|
providerOptions
|
|
994
1000
|
}) {
|
|
995
|
-
var _a;
|
|
1001
|
+
var _a, _b;
|
|
996
1002
|
const warnings = [];
|
|
997
1003
|
const googleOptions = await parseProviderOptions2({
|
|
998
1004
|
provider: "google",
|
|
@@ -1012,6 +1018,11 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1012
1018
|
if ((googleOptions == null ? void 0 : googleOptions.serviceTier) && isVertexProvider) {
|
|
1013
1019
|
sanitizedServiceTier = VertexServiceTierMap[googleOptions.serviceTier];
|
|
1014
1020
|
}
|
|
1021
|
+
const safetyThreshold = googleOptions == null ? void 0 : googleOptions.threshold;
|
|
1022
|
+
const safetySettings = (_a = googleOptions == null ? void 0 : googleOptions.safetySettings) != null ? _a : safetyThreshold != null ? configurableSafetySettingCategories.map((category) => ({
|
|
1023
|
+
category,
|
|
1024
|
+
threshold: safetyThreshold
|
|
1025
|
+
})) : void 0;
|
|
1015
1026
|
const isGemmaModel = this.modelId.toLowerCase().startsWith("gemma-");
|
|
1016
1027
|
const supportsFunctionResponseParts = this.modelId.startsWith("gemini-3");
|
|
1017
1028
|
const { contents, systemInstruction } = convertToGoogleGenerativeAIMessages(
|
|
@@ -1044,7 +1055,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1044
1055
|
responseSchema: (responseFormat == null ? void 0 : responseFormat.type) === "json" && responseFormat.schema != null && // Google GenAI does not support all OpenAPI Schema features,
|
|
1045
1056
|
// so this is needed as an escape hatch:
|
|
1046
1057
|
// TODO convert into provider option
|
|
1047
|
-
((
|
|
1058
|
+
((_b = googleOptions == null ? void 0 : googleOptions.structuredOutputs) != null ? _b : true) ? convertJSONSchemaToOpenAPISchema(responseFormat.schema) : void 0,
|
|
1048
1059
|
...(googleOptions == null ? void 0 : googleOptions.audioTimestamp) && {
|
|
1049
1060
|
audioTimestamp: googleOptions.audioTimestamp
|
|
1050
1061
|
},
|
|
@@ -1060,7 +1071,7 @@ var GoogleGenerativeAILanguageModel = class {
|
|
|
1060
1071
|
},
|
|
1061
1072
|
contents,
|
|
1062
1073
|
systemInstruction: isGemmaModel ? void 0 : systemInstruction,
|
|
1063
|
-
safetySettings
|
|
1074
|
+
safetySettings,
|
|
1064
1075
|
tools: googleTools2,
|
|
1065
1076
|
toolConfig: (googleOptions == null ? void 0 : googleOptions.retrievalConfig) ? {
|
|
1066
1077
|
...googleToolConfig,
|