@ai-sdk/google
Advanced tools
+9
-0
| # @ai-sdk/google | ||
| ## 4.0.0-beta.11 | ||
| ### Patch Changes | ||
| - f7d4f01: feat(provider): add support for `reasoning-file` type for files that are part of reasoning | ||
| - Updated dependencies [f7d4f01] | ||
| - @ai-sdk/provider-utils@5.0.0-beta.3 | ||
| - @ai-sdk/provider@4.0.0-beta.2 | ||
| ## 4.0.0-beta.10 | ||
@@ -4,0 +13,0 @@ |
@@ -263,2 +263,17 @@ "use strict"; | ||
| } | ||
| case "reasoning-file": { | ||
| if (part.data instanceof URL) { | ||
| throw new import_provider.UnsupportedFunctionalityError({ | ||
| functionality: "File data URLs in assistant messages are not supported" | ||
| }); | ||
| } | ||
| return { | ||
| inlineData: { | ||
| mimeType: part.mediaType, | ||
| data: (0, import_provider_utils.convertToBase64)(part.data) | ||
| }, | ||
| thought: true, | ||
| thoughtSignature | ||
| }; | ||
| } | ||
| case "file": { | ||
@@ -943,9 +958,8 @@ if (part.data instanceof URL) { | ||
| content.push({ | ||
| type: "file", | ||
| type: hasThought ? "reasoning-file" : "file", | ||
| data: part.inlineData.data, | ||
| mediaType: part.inlineData.mimeType, | ||
| providerMetadata: hasThought || hasThoughtSignature ? { | ||
| providerMetadata: hasThoughtSignature ? { | ||
| [providerOptionsName]: { | ||
| ...hasThought ? { thought: true } : {}, | ||
| ...hasThoughtSignature ? { thoughtSignature: part.thoughtSignature } : {} | ||
| thoughtSignature: part.thoughtSignature | ||
| } | ||
@@ -1174,10 +1188,9 @@ } : void 0 | ||
| const hasThoughtSignature = !!part.thoughtSignature; | ||
| const fileMeta = hasThought || hasThoughtSignature ? { | ||
| const fileMeta = hasThoughtSignature ? { | ||
| [providerOptionsName]: { | ||
| ...hasThought ? { thought: true } : {}, | ||
| ...hasThoughtSignature ? { thoughtSignature: part.thoughtSignature } : {} | ||
| thoughtSignature: part.thoughtSignature | ||
| } | ||
| } : void 0; | ||
| controller.enqueue({ | ||
| type: "file", | ||
| type: hasThought ? "reasoning-file" : "file", | ||
| mediaType: part.inlineData.mimeType, | ||
@@ -1184,0 +1197,0 @@ data: part.inlineData.data, |
@@ -246,2 +246,17 @@ // src/google-generative-ai-language-model.ts | ||
| } | ||
| case "reasoning-file": { | ||
| if (part.data instanceof URL) { | ||
| throw new UnsupportedFunctionalityError({ | ||
| functionality: "File data URLs in assistant messages are not supported" | ||
| }); | ||
| } | ||
| return { | ||
| inlineData: { | ||
| mimeType: part.mediaType, | ||
| data: convertToBase64(part.data) | ||
| }, | ||
| thought: true, | ||
| thoughtSignature | ||
| }; | ||
| } | ||
| case "file": { | ||
@@ -932,9 +947,8 @@ if (part.data instanceof URL) { | ||
| content.push({ | ||
| type: "file", | ||
| type: hasThought ? "reasoning-file" : "file", | ||
| data: part.inlineData.data, | ||
| mediaType: part.inlineData.mimeType, | ||
| providerMetadata: hasThought || hasThoughtSignature ? { | ||
| providerMetadata: hasThoughtSignature ? { | ||
| [providerOptionsName]: { | ||
| ...hasThought ? { thought: true } : {}, | ||
| ...hasThoughtSignature ? { thoughtSignature: part.thoughtSignature } : {} | ||
| thoughtSignature: part.thoughtSignature | ||
| } | ||
@@ -1163,10 +1177,9 @@ } : void 0 | ||
| const hasThoughtSignature = !!part.thoughtSignature; | ||
| const fileMeta = hasThought || hasThoughtSignature ? { | ||
| const fileMeta = hasThoughtSignature ? { | ||
| [providerOptionsName]: { | ||
| ...hasThought ? { thought: true } : {}, | ||
| ...hasThoughtSignature ? { thoughtSignature: part.thoughtSignature } : {} | ||
| thoughtSignature: part.thoughtSignature | ||
| } | ||
| } : void 0; | ||
| controller.enqueue({ | ||
| type: "file", | ||
| type: hasThought ? "reasoning-file" : "file", | ||
| mediaType: part.inlineData.mimeType, | ||
@@ -1173,0 +1186,0 @@ data: part.inlineData.data, |
+3
-3
| { | ||
| "name": "@ai-sdk/google", | ||
| "version": "4.0.0-beta.10", | ||
| "version": "4.0.0-beta.11", | ||
| "license": "Apache-2.0", | ||
@@ -39,4 +39,4 @@ "sideEffects": false, | ||
| "dependencies": { | ||
| "@ai-sdk/provider": "4.0.0-beta.1", | ||
| "@ai-sdk/provider-utils": "5.0.0-beta.2" | ||
| "@ai-sdk/provider": "4.0.0-beta.2", | ||
| "@ai-sdk/provider-utils": "5.0.0-beta.3" | ||
| }, | ||
@@ -43,0 +43,0 @@ "devDependencies": { |
@@ -115,2 +115,20 @@ import { | ||
| case 'reasoning-file': { | ||
| if (part.data instanceof URL) { | ||
| throw new UnsupportedFunctionalityError({ | ||
| functionality: | ||
| 'File data URLs in assistant messages are not supported', | ||
| }); | ||
| } | ||
| return { | ||
| inlineData: { | ||
| mimeType: part.mediaType, | ||
| data: convertToBase64(part.data), | ||
| }, | ||
| thought: true, | ||
| thoughtSignature, | ||
| }; | ||
| } | ||
| case 'file': { | ||
@@ -117,0 +135,0 @@ if (part.data instanceof URL) { |
@@ -313,16 +313,12 @@ import { | ||
| content.push({ | ||
| type: 'file' as const, | ||
| type: hasThought ? 'reasoning-file' : 'file', | ||
| data: part.inlineData.data, | ||
| mediaType: part.inlineData.mimeType, | ||
| providerMetadata: | ||
| hasThought || hasThoughtSignature | ||
| ? { | ||
| [providerOptionsName]: { | ||
| ...(hasThought ? { thought: true } : {}), | ||
| ...(hasThoughtSignature | ||
| ? { thoughtSignature: part.thoughtSignature } | ||
| : {}), | ||
| }, | ||
| } | ||
| : undefined, | ||
| providerMetadata: hasThoughtSignature | ||
| ? { | ||
| [providerOptionsName]: { | ||
| thoughtSignature: part.thoughtSignature, | ||
| }, | ||
| } | ||
| : undefined, | ||
| }); | ||
@@ -606,15 +602,11 @@ } | ||
| const hasThoughtSignature = !!part.thoughtSignature; | ||
| const fileMeta = | ||
| hasThought || hasThoughtSignature | ||
| ? { | ||
| [providerOptionsName]: { | ||
| ...(hasThought ? { thought: true } : {}), | ||
| ...(hasThoughtSignature | ||
| ? { thoughtSignature: part.thoughtSignature } | ||
| : {}), | ||
| }, | ||
| } | ||
| : undefined; | ||
| const fileMeta = hasThoughtSignature | ||
| ? { | ||
| [providerOptionsName]: { | ||
| thoughtSignature: part.thoughtSignature, | ||
| }, | ||
| } | ||
| : undefined; | ||
| controller.enqueue({ | ||
| type: 'file', | ||
| type: hasThought ? 'reasoning-file' : 'file', | ||
| mediaType: part.inlineData.mimeType, | ||
@@ -621,0 +613,0 @@ data: part.inlineData.data, |
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
1120880
0.35%12379
0.49%+ Added
+ Added
- Removed
- Removed