@ai-sdk/google
Advanced tools
+6
-0
| # @ai-sdk/google | ||
| ## 2.0.79 | ||
| ### Patch Changes | ||
| - af229e7: Expand standalone Google `threshold` provider options into safety settings. | ||
| ## 2.0.78 | ||
@@ -4,0 +10,0 @@ |
@@ -764,2 +764,8 @@ "use strict"; | ||
| // src/google-generative-ai-language-model.ts | ||
| var configurableSafetySettingCategories = [ | ||
| "HARM_CATEGORY_HATE_SPEECH", | ||
| "HARM_CATEGORY_DANGEROUS_CONTENT", | ||
| "HARM_CATEGORY_HARASSMENT", | ||
| "HARM_CATEGORY_SEXUALLY_EXPLICIT" | ||
| ]; | ||
| var GoogleGenerativeAILanguageModel = class { | ||
@@ -795,3 +801,3 @@ constructor(modelId, config) { | ||
| }) { | ||
| var _a; | ||
| var _a, _b; | ||
| const warnings = []; | ||
@@ -816,2 +822,7 @@ const googleOptions = await (0, import_provider_utils4.parseProviderOptions)({ | ||
| } | ||
| const safetyThreshold = googleOptions == null ? void 0 : googleOptions.threshold; | ||
| const safetySettings = (_a = googleOptions == null ? void 0 : googleOptions.safetySettings) != null ? _a : safetyThreshold != null ? configurableSafetySettingCategories.map((category) => ({ | ||
| category, | ||
| threshold: safetyThreshold | ||
| })) : void 0; | ||
| const isGemmaModel = this.modelId.toLowerCase().startsWith("gemma-"); | ||
@@ -849,3 +860,3 @@ const supportsFunctionResponseParts = this.modelId.startsWith("gemini-3"); | ||
| // TODO convert into provider option | ||
| ((_a = googleOptions == null ? void 0 : googleOptions.structuredOutputs) != null ? _a : true) ? convertJSONSchemaToOpenAPISchema(responseFormat.schema) : void 0, | ||
| ((_b = googleOptions == null ? void 0 : googleOptions.structuredOutputs) != null ? _b : true) ? convertJSONSchemaToOpenAPISchema(responseFormat.schema) : void 0, | ||
| ...(googleOptions == null ? void 0 : googleOptions.audioTimestamp) && { | ||
@@ -866,3 +877,3 @@ audioTimestamp: googleOptions.audioTimestamp | ||
| systemInstruction: isGemmaModel ? void 0 : systemInstruction, | ||
| safetySettings: googleOptions == null ? void 0 : googleOptions.safetySettings, | ||
| safetySettings, | ||
| tools: googleTools2, | ||
@@ -869,0 +880,0 @@ toolConfig: (googleOptions == null ? void 0 : googleOptions.retrievalConfig) ? { |
@@ -756,2 +756,8 @@ // src/google-generative-ai-language-model.ts | ||
| // src/google-generative-ai-language-model.ts | ||
| var configurableSafetySettingCategories = [ | ||
| "HARM_CATEGORY_HATE_SPEECH", | ||
| "HARM_CATEGORY_DANGEROUS_CONTENT", | ||
| "HARM_CATEGORY_HARASSMENT", | ||
| "HARM_CATEGORY_SEXUALLY_EXPLICIT" | ||
| ]; | ||
| var GoogleGenerativeAILanguageModel = class { | ||
@@ -787,3 +793,3 @@ constructor(modelId, config) { | ||
| }) { | ||
| var _a; | ||
| var _a, _b; | ||
| const warnings = []; | ||
@@ -808,2 +814,7 @@ const googleOptions = await parseProviderOptions({ | ||
| } | ||
| const safetyThreshold = googleOptions == null ? void 0 : googleOptions.threshold; | ||
| const safetySettings = (_a = googleOptions == null ? void 0 : googleOptions.safetySettings) != null ? _a : safetyThreshold != null ? configurableSafetySettingCategories.map((category) => ({ | ||
| category, | ||
| threshold: safetyThreshold | ||
| })) : void 0; | ||
| const isGemmaModel = this.modelId.toLowerCase().startsWith("gemma-"); | ||
@@ -841,3 +852,3 @@ const supportsFunctionResponseParts = this.modelId.startsWith("gemini-3"); | ||
| // TODO convert into provider option | ||
| ((_a = googleOptions == null ? void 0 : googleOptions.structuredOutputs) != null ? _a : true) ? convertJSONSchemaToOpenAPISchema(responseFormat.schema) : void 0, | ||
| ((_b = googleOptions == null ? void 0 : googleOptions.structuredOutputs) != null ? _b : true) ? convertJSONSchemaToOpenAPISchema(responseFormat.schema) : void 0, | ||
| ...(googleOptions == null ? void 0 : googleOptions.audioTimestamp) && { | ||
@@ -858,3 +869,3 @@ audioTimestamp: googleOptions.audioTimestamp | ||
| systemInstruction: isGemmaModel ? void 0 : systemInstruction, | ||
| safetySettings: googleOptions == null ? void 0 : googleOptions.safetySettings, | ||
| safetySettings, | ||
| tools: googleTools2, | ||
@@ -861,0 +872,0 @@ toolConfig: (googleOptions == null ? void 0 : googleOptions.retrievalConfig) ? { |
+1
-1
| { | ||
| "name": "@ai-sdk/google", | ||
| "version": "2.0.78", | ||
| "version": "2.0.79", | ||
| "license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
873113
0.54%8204
0.54%