@ai-sdk/google
Advanced tools
+6
-0
| # @ai-sdk/google | ||
| ## 3.0.48 | ||
| ### Patch Changes | ||
| - 35c46d1: feat(provider/google): support multimodal content parts in embedding provider options | ||
| ## 3.0.47 | ||
@@ -4,0 +10,0 @@ |
+8
-0
@@ -189,2 +189,10 @@ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils'; | ||
| taskType?: "SEMANTIC_SIMILARITY" | "CLASSIFICATION" | "CLUSTERING" | "RETRIEVAL_DOCUMENT" | "RETRIEVAL_QUERY" | "QUESTION_ANSWERING" | "FACT_VERIFICATION" | "CODE_RETRIEVAL_QUERY" | undefined; | ||
| content?: ({ | ||
| text: string; | ||
| } | { | ||
| inlineData: { | ||
| mimeType: string; | ||
| data: string; | ||
| }; | ||
| })[] | undefined; | ||
| }>; | ||
@@ -191,0 +199,0 @@ type GoogleEmbeddingModelOptions = InferSchema<typeof googleEmbeddingModelOptions>; |
+8
-0
@@ -189,2 +189,10 @@ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils'; | ||
| taskType?: "SEMANTIC_SIMILARITY" | "CLASSIFICATION" | "CLUSTERING" | "RETRIEVAL_DOCUMENT" | "RETRIEVAL_QUERY" | "QUESTION_ANSWERING" | "FACT_VERIFICATION" | "CODE_RETRIEVAL_QUERY" | undefined; | ||
| content?: ({ | ||
| text: string; | ||
| } | { | ||
| inlineData: { | ||
| mimeType: string; | ||
| data: string; | ||
| }; | ||
| })[] | undefined; | ||
| }>; | ||
@@ -191,0 +199,0 @@ type GoogleEmbeddingModelOptions = InferSchema<typeof googleEmbeddingModelOptions>; |
+3
-3
| { | ||
| "name": "@ai-sdk/google", | ||
| "version": "3.0.47", | ||
| "version": "3.0.48", | ||
| "license": "Apache-2.0", | ||
@@ -47,4 +47,4 @@ "sideEffects": false, | ||
| "zod": "3.25.76", | ||
| "@ai-sdk/test-server": "1.0.3", | ||
| "@vercel/ai-tsconfig": "0.0.0" | ||
| "@vercel/ai-tsconfig": "0.0.0", | ||
| "@ai-sdk/test-server": "1.0.3" | ||
| }, | ||
@@ -51,0 +51,0 @@ "peerDependencies": { |
@@ -77,4 +77,12 @@ import { | ||
| // For single embeddings, use the single endpoint (ratelimits, etc.) | ||
| const multimodalContent = googleOptions?.content ?? []; | ||
| // For single embeddings, use the single endpoint | ||
| if (values.length === 1) { | ||
| const textPart = values[0] ? [{ text: values[0] }] : []; | ||
| const parts = | ||
| multimodalContent.length > 0 | ||
| ? [...textPart, ...multimodalContent] | ||
| : [{ text: values[0] }]; | ||
| const { | ||
@@ -90,3 +98,3 @@ responseHeaders, | ||
| content: { | ||
| parts: [{ text: values[0] }], | ||
| parts, | ||
| }, | ||
@@ -112,2 +120,4 @@ outputDimensionality: googleOptions?.outputDimensionality, | ||
| // For multiple values, use the batch endpoint | ||
| // If multimodal content is provided, merge it into each request's parts | ||
| const { | ||
@@ -121,8 +131,17 @@ responseHeaders, | ||
| body: { | ||
| requests: values.map(value => ({ | ||
| model: `models/${this.modelId}`, | ||
| content: { role: 'user', parts: [{ text: value }] }, | ||
| outputDimensionality: googleOptions?.outputDimensionality, | ||
| taskType: googleOptions?.taskType, | ||
| })), | ||
| requests: values.map(value => { | ||
| const textPart = value ? [{ text: value }] : []; | ||
| return { | ||
| model: `models/${this.modelId}`, | ||
| content: { | ||
| role: 'user', | ||
| parts: | ||
| multimodalContent.length > 0 | ||
| ? [...textPart, ...multimodalContent] | ||
| : [{ text: value }], | ||
| }, | ||
| outputDimensionality: googleOptions?.outputDimensionality, | ||
| taskType: googleOptions?.taskType, | ||
| }; | ||
| }), | ||
| }, | ||
@@ -129,0 +148,0 @@ failedResponseHandler: googleFailedResponseHandler, |
@@ -12,2 +12,12 @@ import { | ||
| const googleEmbeddingContentPartSchema = z.union([ | ||
| z.object({ text: z.string() }), | ||
| z.object({ | ||
| inlineData: z.object({ | ||
| mimeType: z.string(), | ||
| data: z.string(), | ||
| }), | ||
| }), | ||
| ]); | ||
| export const googleEmbeddingModelOptions = lazySchema(() => | ||
@@ -46,2 +56,9 @@ zodSchema( | ||
| .optional(), | ||
| /** | ||
| * Optional. Multimodal content parts for embedding non-text content | ||
| * (images, video, PDF, audio). When provided, these parts are used | ||
| * instead of the text values in the embedding request. | ||
| */ | ||
| content: z.array(googleEmbeddingContentPartSchema).min(1).optional(), | ||
| }), | ||
@@ -48,0 +65,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
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
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
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
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
1105914
0.65%12250
0.74%