@ai-sdk/google
Advanced tools
+11
-0
| # @ai-sdk/google | ||
| ## 3.0.91 | ||
| ### Patch Changes | ||
| - bbac4da: Fix Google tool result conversion to send file data as inline data instead of JSON text on the legacy tool-result path. | ||
| - 3fda3bc: Expand standalone Google `threshold` provider options into safety settings. | ||
| - e1af05f: feat (video): support video (not just image) reference inputs in `inputReferences` for reference-to-video generation | ||
| - Updated dependencies [e1af05f] | ||
| - @ai-sdk/provider@3.0.14 | ||
| - @ai-sdk/provider-utils@4.0.38 | ||
| ## 3.0.90 | ||
@@ -4,0 +15,0 @@ |
+3
-3
| { | ||
| "name": "@ai-sdk/google", | ||
| "version": "3.0.90", | ||
| "version": "3.0.91", | ||
| "license": "Apache-2.0", | ||
@@ -39,4 +39,4 @@ "sideEffects": false, | ||
| "dependencies": { | ||
| "@ai-sdk/provider": "3.0.13", | ||
| "@ai-sdk/provider-utils": "4.0.37" | ||
| "@ai-sdk/provider": "3.0.14", | ||
| "@ai-sdk/provider-utils": "4.0.38" | ||
| }, | ||
@@ -43,0 +43,0 @@ "devDependencies": { |
@@ -191,2 +191,5 @@ import { | ||
| case 'image-data': | ||
| case 'file-data': { | ||
| const topLevelMediaType = String(contentPart.mediaType).split('/')[0]; | ||
| parts.push( | ||
@@ -200,6 +203,10 @@ { | ||
| { | ||
| text: 'Tool executed successfully and returned this image as a response', | ||
| text: | ||
| `Tool executed successfully and returned this ` + | ||
| `${topLevelMediaType === 'image' ? 'image' : 'file'} ` + | ||
| `as a response`, | ||
| }, | ||
| ); | ||
| break; | ||
| } | ||
| default: | ||
@@ -206,0 +213,0 @@ parts.push({ text: JSON.stringify(contentPart) }); |
@@ -53,2 +53,9 @@ import type { | ||
| const configurableSafetySettingCategories = [ | ||
| 'HARM_CATEGORY_HATE_SPEECH', | ||
| 'HARM_CATEGORY_DANGEROUS_CONTENT', | ||
| 'HARM_CATEGORY_HARASSMENT', | ||
| 'HARM_CATEGORY_SEXUALLY_EXPLICIT', | ||
| ] as const; | ||
| type GoogleGenerativeAIConfig = { | ||
@@ -227,2 +234,12 @@ provider: string; | ||
| const safetyThreshold = googleOptions?.threshold; | ||
| const safetySettings = | ||
| googleOptions?.safetySettings ?? | ||
| (safetyThreshold != null | ||
| ? configurableSafetySettingCategories.map(category => ({ | ||
| category, | ||
| threshold: safetyThreshold, | ||
| })) | ||
| : undefined); | ||
| const toolConfig = | ||
@@ -287,3 +304,3 @@ googleToolConfig || | ||
| systemInstruction: isGemmaModel ? undefined : systemInstruction, | ||
| safetySettings: googleOptions?.safetySettings, | ||
| safetySettings, | ||
| tools: googleTools, | ||
@@ -290,0 +307,0 @@ toolConfig, |
@@ -113,9 +113,7 @@ import { | ||
| // The Gemini Developer API (generativelanguage.googleapis.com) requires | ||
| // inline image bytes wrapped as `inlineData`. | ||
| // Veo's predictLongRunning endpoint uses Vertex-style image payloads, not | ||
| // Gemini generateContent inlineData. | ||
| return { | ||
| inlineData: { | ||
| mimeType: file.mediaType || 'image/png', | ||
| data: base64Data, | ||
| }, | ||
| bytesBase64Encoded: base64Data, | ||
| mimeType: file.mediaType || 'image/png', | ||
| }; | ||
@@ -129,5 +127,5 @@ } | ||
| return { | ||
| inlineData: { | ||
| image: { | ||
| bytesBase64Encoded: refImg.bytesBase64Encoded, | ||
| mimeType: 'image/png', | ||
| data: refImg.bytesBase64Encoded, | ||
| }, | ||
@@ -139,3 +137,6 @@ }; | ||
| return { | ||
| gcsUri: refImg.gcsUri, | ||
| image: { | ||
| gcsUri: refImg.gcsUri, | ||
| mimeType: 'image/png', | ||
| }, | ||
| }; | ||
@@ -152,3 +153,3 @@ } | ||
| const image = convertFileToGoogleImage(file, warnings); | ||
| return image != null ? { image, referenceType: 'asset' } : undefined; | ||
| return image != null ? { image } : undefined; | ||
| } | ||
@@ -155,0 +156,0 @@ |
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
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
3081427
0.26%33726
0.24%+ Added
+ Added
- Removed
- Removed
Updated