@ai-sdk/google
Advanced tools
+32
-3
@@ -17,3 +17,3 @@ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils'; | ||
| type GoogleModelId = 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash-lite-001' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro-preview-tts' | 'gemini-2.5-flash-native-audio-latest' | 'gemini-2.5-flash-native-audio-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-pro-preview-customtools' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-3.6-flash' | 'gemini-3.7-flash' | 'gemini-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'deep-research-pro-preview-12-2025' | 'deep-research-max-preview-04-2026' | 'deep-research-preview-04-2026' | 'nano-banana-pro-preview' | 'aqa' | 'gemini-robotics-er-1.5-preview' | 'gemma-3-1b-it' | 'gemma-3-4b-it' | 'gemma-3n-e4b-it' | 'gemma-3n-e2b-it' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {}); | ||
| type GoogleModelId = 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash-lite-001' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro-preview-tts' | 'gemini-2.5-flash-native-audio-latest' | 'gemini-2.5-flash-native-audio-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-pro-preview-customtools' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-3.6-flash' | 'gemini-3.7-flash' | 'gemini-3.8-flash' | 'gemini-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'deep-research-pro-preview-12-2025' | 'deep-research-max-preview-04-2026' | 'deep-research-preview-04-2026' | 'nano-banana-pro-preview' | 'aqa' | 'gemini-robotics-er-1.5-preview' | 'gemma-3-1b-it' | 'gemma-3-4b-it' | 'gemma-3n-e4b-it' | 'gemma-3n-e2b-it' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {}); | ||
| declare const googleLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{ | ||
@@ -324,4 +324,23 @@ responseModalities?: ("TEXT" | "IMAGE")[] | undefined; | ||
| */ | ||
| type GoogleInteractionsModelId = 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro' | 'gemini-2.5-pro-preview-tts' | 'gemini-3-flash-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-pro-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-3.6-flash' | 'gemini-3.7-flash' | 'lyria-3-clip-preview' | 'lyria-3-pro-preview' | (string & {}); | ||
| type GoogleInteractionsModelId = 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro' | 'gemini-2.5-pro-preview-tts' | 'gemini-3-flash-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-pro-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-3.6-flash' | 'gemini-3.7-flash' | 'gemini-3.8-flash' | 'lyria-3-clip-preview' | 'lyria-3-pro-preview' | (string & {}); | ||
| /** | ||
| * Provider options for an individual video file part sent to the Gemini | ||
| * Interactions API. | ||
| */ | ||
| type GoogleInteractionsVideoOptions = { | ||
| /** | ||
| * Controls how Gemini processes this video. | ||
| * | ||
| * Agentic processing dynamically explores the video timeline. Static | ||
| * processing samples frames at a fixed rate and optionally supports clipping | ||
| * and custom frame rates. | ||
| */ | ||
| processing?: 'agentic' | 'static' | { | ||
| type: 'static'; | ||
| startOffset?: number; | ||
| endOffset?: number; | ||
| fps?: number; | ||
| }; | ||
| }; | ||
| /** | ||
| * Provider-options schema for `google.interactions(...)` calls. Read from the | ||
@@ -436,2 +455,12 @@ * shared `providerOptions.google.*` namespace (per PRD); per-call options that | ||
| signature?: string; | ||
| /** | ||
| * ID of an agentic video `processing_call` step. Present on | ||
| * `google.processing_call` custom parts. | ||
| */ | ||
| processingId?: string; | ||
| /** | ||
| * ID of the corresponding agentic video processing call. Present on | ||
| * `google.processing_result` custom parts. | ||
| */ | ||
| processingCallId?: string; | ||
| }; | ||
@@ -796,2 +825,2 @@ | ||
| export { GoogleRealtimeModel as Experimental_GoogleRealtimeModel, type GoogleRealtimeModelConfig as Experimental_GoogleRealtimeModelConfig, type GoogleRealtimeModelId as Experimental_GoogleRealtimeModelId, type GoogleRealtimeModelOptions as Experimental_GoogleRealtimeModelOptions, GoogleSpeechTranslationModel as Experimental_GoogleSpeechTranslationModel, type GoogleSpeechTranslationModelConfig as Experimental_GoogleSpeechTranslationModelConfig, type GoogleSpeechTranslationModelId as Experimental_GoogleSpeechTranslationModelId, type GoogleSpeechTranslationModelOptions as Experimental_GoogleSpeechTranslationModelOptions, GoogleSpeechTranslationModel as Experimental_GoogleTranslationModel, type GoogleSpeechTranslationModelConfig as Experimental_GoogleTranslationModelConfig, type GoogleSpeechTranslationModelId as Experimental_GoogleTranslationModelId, type GoogleSpeechTranslationModelOptions as Experimental_GoogleTranslationModelOptions, type GoogleEmbeddingModelOptions, type GoogleErrorData, type GoogleFilesUploadOptions, type GoogleEmbeddingModelOptions as GoogleGenerativeAIEmbeddingProviderOptions, type GoogleImageModelOptions as GoogleGenerativeAIImageProviderOptions, type GoogleProvider as GoogleGenerativeAIProvider, type GoogleProviderMetadata as GoogleGenerativeAIProviderMetadata, type GoogleLanguageModelOptions as GoogleGenerativeAIProviderOptions, type GoogleProviderSettings as GoogleGenerativeAIProviderSettings, type GoogleVideoModelId as GoogleGenerativeAIVideoModelId, type GoogleVideoModelOptions as GoogleGenerativeAIVideoProviderOptions, type GoogleImageModelOptions, type GoogleInteractionsAgentName, type GoogleInteractionsModelId, type GoogleInteractionsProviderMetadata, type GoogleLanguageModelInteractionsOptions, type GoogleLanguageModelOptions, type GoogleProvider, type GoogleProviderMetadata, type GoogleProviderSettings, type GoogleSpeechModelId, type GoogleSpeechModelOptions, GoogleTranscriptionModel, type GoogleTranscriptionModelId, type GoogleTranscriptionModelOptions, type GoogleVideoModelId, type GoogleVideoModelOptions, VERSION, createGoogle, createGoogle as createGoogleGenerativeAI, google }; | ||
| export { GoogleRealtimeModel as Experimental_GoogleRealtimeModel, type GoogleRealtimeModelConfig as Experimental_GoogleRealtimeModelConfig, type GoogleRealtimeModelId as Experimental_GoogleRealtimeModelId, type GoogleRealtimeModelOptions as Experimental_GoogleRealtimeModelOptions, GoogleSpeechTranslationModel as Experimental_GoogleSpeechTranslationModel, type GoogleSpeechTranslationModelConfig as Experimental_GoogleSpeechTranslationModelConfig, type GoogleSpeechTranslationModelId as Experimental_GoogleSpeechTranslationModelId, type GoogleSpeechTranslationModelOptions as Experimental_GoogleSpeechTranslationModelOptions, GoogleSpeechTranslationModel as Experimental_GoogleTranslationModel, type GoogleSpeechTranslationModelConfig as Experimental_GoogleTranslationModelConfig, type GoogleSpeechTranslationModelId as Experimental_GoogleTranslationModelId, type GoogleSpeechTranslationModelOptions as Experimental_GoogleTranslationModelOptions, type GoogleEmbeddingModelOptions, type GoogleErrorData, type GoogleFilesUploadOptions, type GoogleEmbeddingModelOptions as GoogleGenerativeAIEmbeddingProviderOptions, type GoogleImageModelOptions as GoogleGenerativeAIImageProviderOptions, type GoogleProvider as GoogleGenerativeAIProvider, type GoogleProviderMetadata as GoogleGenerativeAIProviderMetadata, type GoogleLanguageModelOptions as GoogleGenerativeAIProviderOptions, type GoogleProviderSettings as GoogleGenerativeAIProviderSettings, type GoogleVideoModelId as GoogleGenerativeAIVideoModelId, type GoogleVideoModelOptions as GoogleGenerativeAIVideoProviderOptions, type GoogleImageModelOptions, type GoogleInteractionsAgentName, type GoogleInteractionsModelId, type GoogleInteractionsProviderMetadata, type GoogleInteractionsVideoOptions, type GoogleLanguageModelInteractionsOptions, type GoogleLanguageModelOptions, type GoogleProvider, type GoogleProviderMetadata, type GoogleProviderSettings, type GoogleSpeechModelId, type GoogleSpeechModelOptions, GoogleTranscriptionModel, type GoogleTranscriptionModelId, type GoogleTranscriptionModelOptions, type GoogleVideoModelId, type GoogleVideoModelOptions, VERSION, createGoogle, createGoogle as createGoogleGenerativeAI, google }; |
@@ -70,3 +70,3 @@ import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils'; | ||
| type GoogleModelId = 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash-lite-001' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro-preview-tts' | 'gemini-2.5-flash-native-audio-latest' | 'gemini-2.5-flash-native-audio-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-pro-preview-customtools' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-3.6-flash' | 'gemini-3.7-flash' | 'gemini-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'deep-research-pro-preview-12-2025' | 'deep-research-max-preview-04-2026' | 'deep-research-preview-04-2026' | 'nano-banana-pro-preview' | 'aqa' | 'gemini-robotics-er-1.5-preview' | 'gemma-3-1b-it' | 'gemma-3-4b-it' | 'gemma-3n-e4b-it' | 'gemma-3n-e2b-it' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {}); | ||
| type GoogleModelId = 'gemini-2.0-flash' | 'gemini-2.0-flash-001' | 'gemini-2.0-flash-lite' | 'gemini-2.0-flash-lite-001' | 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro-preview-tts' | 'gemini-2.5-flash-native-audio-latest' | 'gemini-2.5-flash-native-audio-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-3-pro-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-flash-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-pro-preview-customtools' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-3.6-flash' | 'gemini-3.7-flash' | 'gemini-3.8-flash' | 'gemini-pro-latest' | 'gemini-flash-latest' | 'gemini-flash-lite-latest' | 'deep-research-pro-preview-12-2025' | 'deep-research-max-preview-04-2026' | 'deep-research-preview-04-2026' | 'nano-banana-pro-preview' | 'aqa' | 'gemini-robotics-er-1.5-preview' | 'gemma-3-1b-it' | 'gemma-3-4b-it' | 'gemma-3n-e4b-it' | 'gemma-3n-e2b-it' | 'gemma-3-12b-it' | 'gemma-3-27b-it' | (string & {}); | ||
@@ -525,3 +525,3 @@ type GoogleLanguageModelConfig = { | ||
| */ | ||
| type GoogleInteractionsModelId = 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro' | 'gemini-2.5-pro-preview-tts' | 'gemini-3-flash-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-pro-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-3.6-flash' | 'gemini-3.7-flash' | 'lyria-3-clip-preview' | 'lyria-3-pro-preview' | (string & {}); | ||
| type GoogleInteractionsModelId = 'gemini-2.5-computer-use-preview-10-2025' | 'gemini-2.5-flash' | 'gemini-2.5-flash-image' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-native-audio-preview-12-2025' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-2.5-flash-preview-tts' | 'gemini-2.5-pro' | 'gemini-2.5-pro-preview-tts' | 'gemini-3-flash-preview' | 'gemini-3-pro-image-preview' | 'gemini-3-pro-preview' | 'gemini-3.1-pro-preview' | 'gemini-3.1-flash-image-preview' | 'gemini-3.1-flash-lite-preview' | 'gemini-3.1-flash-tts-preview' | 'gemini-3.5-flash' | 'gemini-3.5-flash-lite' | 'gemini-3.6-flash' | 'gemini-3.7-flash' | 'gemini-3.8-flash' | 'lyria-3-clip-preview' | 'lyria-3-pro-preview' | (string & {}); | ||
@@ -528,0 +528,0 @@ type GoogleInteractionsConfig = { |
+1
-1
| { | ||
| "name": "@ai-sdk/google", | ||
| "version": "4.0.62", | ||
| "version": "4.0.63", | ||
| "type": "module", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0", |
+82
-70
@@ -108,2 +108,3 @@ import { | ||
| name: z.string(), | ||
| expirationTime: z.string().nullish(), | ||
| }), | ||
@@ -247,6 +248,5 @@ }), | ||
| )}:batchGenerateContent`; | ||
| let operation: GoogleBatchOperation; | ||
| if (fileParts == null) { | ||
| const { value } = await postJsonToApi({ | ||
| const { value: operation } = await postJsonToApi({ | ||
| url: createUrl, | ||
@@ -262,78 +262,82 @@ headers, | ||
| }); | ||
| operation = value; | ||
| } else { | ||
| const inputFile = new Blob(fileParts, { type: 'application/jsonl' }); | ||
| // Blob snapshots the strings, so release the potentially large input array. | ||
| fileParts.length = 0; | ||
| if (inputFile.size > googleBatchInputFileMaxBytes) { | ||
| throw new InvalidArgumentError({ | ||
| argument: 'requests', | ||
| message: 'Google batch input files must not exceed 2 GB.', | ||
| }); | ||
| } | ||
| const { value: uploadUrl } = await postJsonToApi({ | ||
| url: `${this.getBaseOrigin()}/upload/v1beta/files`, | ||
| headers: combineHeaders(headers, { | ||
| 'X-Goog-Upload-Protocol': 'resumable', | ||
| 'X-Goog-Upload-Command': 'start', | ||
| 'X-Goog-Upload-Header-Content-Length': String(inputFile.size), | ||
| 'X-Goog-Upload-Header-Content-Type': 'application/jsonl', | ||
| }), | ||
| body: { | ||
| file: { | ||
| display_name: `${displayName}-input`, | ||
| }, | ||
| }, | ||
| failedResponseHandler: googleFailedResponseHandler, | ||
| successfulResponseHandler: googleUploadUrlResponseHandler, | ||
| abortSignal: options.abortSignal, | ||
| fetch: this.batchConfig.fetch, | ||
| return { | ||
| batchId: operation.name, | ||
| ...convertGoogleBatchStatus(operation), | ||
| warnings, | ||
| }; | ||
| } | ||
| const inputFile = new Blob(fileParts, { type: 'application/jsonl' }); | ||
| // Blob snapshots the strings, so release the potentially large input array. | ||
| fileParts.length = 0; | ||
| if (inputFile.size > googleBatchInputFileMaxBytes) { | ||
| throw new InvalidArgumentError({ | ||
| argument: 'requests', | ||
| message: 'Google batch input files must not exceed 2 GB.', | ||
| }); | ||
| } | ||
| const { value: uploadedFile } = await postToApi({ | ||
| url: uploadUrl, | ||
| headers: { | ||
| 'X-Goog-Upload-Offset': '0', | ||
| 'X-Goog-Upload-Command': 'upload, finalize', | ||
| 'Content-Type': 'application/jsonl', | ||
| const { value: uploadUrl } = await postJsonToApi({ | ||
| url: `${this.getBaseOrigin()}/upload/v1beta/files`, | ||
| headers: combineHeaders(headers, { | ||
| 'X-Goog-Upload-Protocol': 'resumable', | ||
| 'X-Goog-Upload-Command': 'start', | ||
| 'X-Goog-Upload-Header-Content-Length': String(inputFile.size), | ||
| 'X-Goog-Upload-Header-Content-Type': 'application/jsonl', | ||
| }), | ||
| body: { | ||
| file: { | ||
| display_name: `${displayName}-input`, | ||
| }, | ||
| body: { | ||
| content: inputFile, | ||
| values: { | ||
| byteLength: inputFile.size, | ||
| mediaType: 'application/jsonl', | ||
| }, | ||
| }, | ||
| failedResponseHandler: googleFailedResponseHandler, | ||
| successfulResponseHandler: googleUploadUrlResponseHandler, | ||
| abortSignal: options.abortSignal, | ||
| fetch: this.batchConfig.fetch, | ||
| }); | ||
| const { value: uploadedFile } = await postToApi({ | ||
| url: uploadUrl, | ||
| headers: { | ||
| 'X-Goog-Upload-Offset': '0', | ||
| 'X-Goog-Upload-Command': 'upload, finalize', | ||
| 'Content-Type': 'application/jsonl', | ||
| }, | ||
| body: { | ||
| content: inputFile, | ||
| values: { | ||
| byteLength: inputFile.size, | ||
| mediaType: 'application/jsonl', | ||
| }, | ||
| failedResponseHandler: googleFailedResponseHandler, | ||
| successfulResponseHandler: createJsonResponseHandler( | ||
| googleFileUploadResponseSchema, | ||
| ), | ||
| abortSignal: options.abortSignal, | ||
| fetch: this.batchConfig.fetch, | ||
| }); | ||
| }, | ||
| failedResponseHandler: googleFailedResponseHandler, | ||
| successfulResponseHandler: createJsonResponseHandler( | ||
| googleFileUploadResponseSchema, | ||
| ), | ||
| abortSignal: options.abortSignal, | ||
| fetch: this.batchConfig.fetch, | ||
| }); | ||
| const { value } = await postJsonToApi({ | ||
| url: createUrl, | ||
| headers, | ||
| body: { | ||
| batch: { | ||
| displayName, | ||
| ...(options.webhookUrl != null && { | ||
| webhookConfig: { uris: [options.webhookUrl] }, | ||
| }), | ||
| inputConfig: { | ||
| fileName: uploadedFile.file.name, | ||
| }, | ||
| const { value: operation } = await postJsonToApi({ | ||
| url: createUrl, | ||
| headers, | ||
| body: { | ||
| batch: { | ||
| displayName, | ||
| ...(options.webhookUrl != null && { | ||
| webhookConfig: { uris: [options.webhookUrl] }, | ||
| }), | ||
| inputConfig: { | ||
| fileName: uploadedFile.file.name, | ||
| }, | ||
| }, | ||
| failedResponseHandler: googleFailedResponseHandler, | ||
| successfulResponseHandler: createJsonResponseHandler( | ||
| googleBatchOperationSchema, | ||
| ), | ||
| abortSignal: options.abortSignal, | ||
| fetch: this.batchConfig.fetch, | ||
| }); | ||
| operation = value; | ||
| } | ||
| }, | ||
| failedResponseHandler: googleFailedResponseHandler, | ||
| successfulResponseHandler: createJsonResponseHandler( | ||
| googleBatchOperationSchema, | ||
| ), | ||
| abortSignal: options.abortSignal, | ||
| fetch: this.batchConfig.fetch, | ||
| }); | ||
@@ -343,2 +347,10 @@ return { | ||
| ...convertGoogleBatchStatus(operation), | ||
| providerMetadata: { | ||
| google: { | ||
| inputFileId: uploadedFile.file.name, | ||
| ...(uploadedFile.file.expirationTime != null | ||
| ? { inputFileExpiresAt: uploadedFile.file.expirationTime } | ||
| : {}), | ||
| }, | ||
| }, | ||
| warnings, | ||
@@ -345,0 +357,0 @@ }; |
@@ -37,2 +37,3 @@ import { | ||
| | 'gemini-3.7-flash' | ||
| | 'gemini-3.8-flash' | ||
| // latest version | ||
@@ -39,0 +40,0 @@ // https://ai.google.dev/gemini-api/docs/models#latest |
+1
-0
@@ -40,2 +40,3 @@ export type { GoogleErrorData } from './google-error'; | ||
| GoogleInteractionsModelId, | ||
| GoogleInteractionsVideoOptions, | ||
| } from './interactions/google-interactions-language-model-options'; | ||
@@ -42,0 +43,0 @@ export type { GoogleInteractionsProviderMetadata } from './interactions/google-interactions-provider-metadata'; |
@@ -106,2 +106,8 @@ import type { | ||
| } | ||
| | { | ||
| kind: 'custom'; | ||
| id: string; | ||
| customKind: 'google.processing_call' | 'google.processing_result'; | ||
| google: Record<string, string>; | ||
| } | ||
| /** | ||
@@ -341,2 +347,20 @@ * A `model_output` step whose inner content-block kind has not yet been | ||
| } | ||
| } else if ( | ||
| stepType === 'processing_call' || | ||
| stepType === 'processing_result' | ||
| ) { | ||
| const google: Record<string, string> = {}; | ||
| if (step?.signature != null) google.signature = step.signature; | ||
| if (interactionId != null) google.interactionId = interactionId; | ||
| if (stepType === 'processing_call') { | ||
| google.processingId = step?.id || blockId; | ||
| } else { | ||
| google.processingCallId = step?.call_id || blockId; | ||
| } | ||
| openBlocks.set(index, { | ||
| kind: 'custom', | ||
| id: blockId, | ||
| customKind: `google.${stepType}`, | ||
| google, | ||
| }); | ||
| } else if (stepType === 'function_call') { | ||
@@ -549,3 +573,24 @@ const toolCallId = step?.id || blockId; | ||
| if (open.kind === 'text' && delta?.type === 'text') { | ||
| if ( | ||
| open.kind === 'custom' && | ||
| (delta?.type === 'processing_call' || | ||
| delta?.type === 'processing_result') | ||
| ) { | ||
| if (delta.signature != null) | ||
| open.google.signature = delta.signature; | ||
| if ( | ||
| delta.type === 'processing_call' && | ||
| delta.id != null && | ||
| delta.id.length > 0 | ||
| ) { | ||
| open.google.processingId = delta.id; | ||
| } | ||
| if ( | ||
| delta.type === 'processing_result' && | ||
| delta.call_id != null && | ||
| delta.call_id.length > 0 | ||
| ) { | ||
| open.google.processingCallId = delta.call_id; | ||
| } | ||
| } else if (open.kind === 'text' && delta?.type === 'text') { | ||
| const text = delta.text ?? ''; | ||
@@ -730,2 +775,8 @@ if (text.length > 0) { | ||
| }); | ||
| } else if (open.kind === 'custom') { | ||
| controller.enqueue({ | ||
| type: 'custom', | ||
| kind: open.customKind, | ||
| providerMetadata: { google: open.google }, | ||
| }); | ||
| } else if (open.kind === 'builtin_tool_call' && !open.callEmitted) { | ||
@@ -732,0 +783,0 @@ controller.enqueue({ |
@@ -23,2 +23,3 @@ import type { | ||
| GoogleInteractionsTextContent, | ||
| GoogleInteractionsVideoProcessing, | ||
| } from './google-interactions-prompt'; | ||
@@ -167,2 +168,40 @@ | ||
| } | ||
| } else if (part.type === 'custom') { | ||
| flushModelOutput(); | ||
| const google = part.providerOptions?.google as | ||
| | { | ||
| processingId?: unknown; | ||
| processingCallId?: unknown; | ||
| signature?: unknown; | ||
| } | ||
| | undefined; | ||
| const signature = | ||
| typeof google?.signature === 'string' | ||
| ? google.signature | ||
| : undefined; | ||
| if ( | ||
| part.kind === 'google.processing_call' && | ||
| typeof google?.processingId === 'string' | ||
| ) { | ||
| steps.push({ | ||
| type: 'processing_call', | ||
| id: google.processingId, | ||
| ...(signature != null ? { signature } : {}), | ||
| }); | ||
| } else if ( | ||
| part.kind === 'google.processing_result' && | ||
| typeof google?.processingCallId === 'string' | ||
| ) { | ||
| steps.push({ | ||
| type: 'processing_result', | ||
| call_id: google.processingCallId, | ||
| ...(signature != null ? { signature } : {}), | ||
| }); | ||
| } else { | ||
| warnings.push({ | ||
| type: 'other', | ||
| message: `google.interactions: unsupported or invalid custom assistant content part "${part.kind}"; part dropped.`, | ||
| }); | ||
| } | ||
| } else if (part.type === 'tool-call') { | ||
@@ -287,2 +326,4 @@ flushModelOutput(); | ||
| : {}; | ||
| const processingField = | ||
| kind === 'video' ? getVideoProcessingField({ part, warnings }) : {}; | ||
@@ -297,2 +338,3 @@ switch (part.data.type) { | ||
| ...resolutionField, | ||
| ...processingField, | ||
| }; | ||
@@ -308,2 +350,3 @@ } | ||
| ...resolutionField, | ||
| ...processingField, | ||
| }; | ||
@@ -323,2 +366,3 @@ } | ||
| ...resolutionField, | ||
| ...processingField, | ||
| }; | ||
@@ -329,2 +373,57 @@ } | ||
| function getVideoProcessingField({ | ||
| part, | ||
| warnings, | ||
| }: { | ||
| part: LanguageModelV4FilePart; | ||
| warnings: Array<SharedV4Warning>; | ||
| }): { processing?: GoogleInteractionsVideoProcessing } { | ||
| const processing = ( | ||
| part.providerOptions?.google as | ||
| | { | ||
| processing?: unknown; | ||
| } | ||
| | undefined | ||
| )?.processing; | ||
| if (processing == null) { | ||
| return {}; | ||
| } | ||
| if (processing === 'agentic' || processing === 'static') { | ||
| return { processing }; | ||
| } | ||
| if ( | ||
| typeof processing === 'object' && | ||
| !Array.isArray(processing) && | ||
| (processing as { type?: unknown }).type === 'static' | ||
| ) { | ||
| const config = processing as { | ||
| startOffset?: unknown; | ||
| endOffset?: unknown; | ||
| fps?: unknown; | ||
| }; | ||
| return { | ||
| processing: { | ||
| type: 'static', | ||
| ...(typeof config.startOffset === 'number' | ||
| ? { start_offset: config.startOffset } | ||
| : {}), | ||
| ...(typeof config.endOffset === 'number' | ||
| ? { end_offset: config.endOffset } | ||
| : {}), | ||
| ...(typeof config.fps === 'number' ? { fps: config.fps } : {}), | ||
| }, | ||
| }; | ||
| } | ||
| warnings.push({ | ||
| type: 'other', | ||
| message: | ||
| 'google.interactions: invalid providerOptions.google.processing on video file part; expected "agentic", "static", or a static processing configuration. Option dropped.', | ||
| }); | ||
| return {}; | ||
| } | ||
| /* | ||
@@ -331,0 +430,0 @@ * Drops assistant messages that were part of the linked interaction |
@@ -225,2 +225,18 @@ import { | ||
| const processingCallStep = z | ||
| .object({ | ||
| type: z.literal('processing_call'), | ||
| id: z.string(), | ||
| signature: z.string().nullish(), | ||
| }) | ||
| .loose(); | ||
| const processingResultStep = z | ||
| .object({ | ||
| type: z.literal('processing_result'), | ||
| call_id: z.string(), | ||
| signature: z.string().nullish(), | ||
| }) | ||
| .loose(); | ||
| const builtinToolCallStep = z | ||
@@ -255,2 +271,4 @@ .object({ | ||
| thoughtStep, | ||
| processingCallStep, | ||
| processingResultStep, | ||
| builtinToolCallStep, | ||
@@ -257,0 +275,0 @@ builtinToolResultStep, |
@@ -39,2 +39,3 @@ import { | ||
| | 'gemini-3.7-flash' | ||
| | 'gemini-3.8-flash' | ||
| | 'lyria-3-clip-preview' | ||
@@ -45,2 +46,25 @@ | 'lyria-3-pro-preview' | ||
| /** | ||
| * Provider options for an individual video file part sent to the Gemini | ||
| * Interactions API. | ||
| */ | ||
| export type GoogleInteractionsVideoOptions = { | ||
| /** | ||
| * Controls how Gemini processes this video. | ||
| * | ||
| * Agentic processing dynamically explores the video timeline. Static | ||
| * processing samples frames at a fixed rate and optionally supports clipping | ||
| * and custom frame rates. | ||
| */ | ||
| processing?: | ||
| | 'agentic' | ||
| | 'static' | ||
| | { | ||
| type: 'static'; | ||
| startOffset?: number; | ||
| endOffset?: number; | ||
| fps?: number; | ||
| }; | ||
| }; | ||
| /** | ||
| * Provider-options schema for `google.interactions(...)` calls. Read from the | ||
@@ -47,0 +71,0 @@ * shared `providerOptions.google.*` namespace (per PRD); per-call options that |
@@ -38,2 +38,12 @@ /** | ||
| export type GoogleInteractionsVideoProcessing = | ||
| | 'agentic' | ||
| | 'static' | ||
| | { | ||
| type: 'static'; | ||
| start_offset?: number; | ||
| end_offset?: number; | ||
| fps?: number; | ||
| }; | ||
| export type GoogleInteractionsVideoContent = { | ||
@@ -45,2 +55,3 @@ type: 'video'; | ||
| resolution?: 'low' | 'medium' | 'high' | 'ultra_high'; | ||
| processing?: GoogleInteractionsVideoProcessing; | ||
| }; | ||
@@ -132,2 +143,12 @@ | ||
| export type GoogleInteractionsProcessingCallStepPayload = { | ||
| id: string; | ||
| signature?: string; | ||
| }; | ||
| export type GoogleInteractionsProcessingResultStepPayload = { | ||
| call_id: string; | ||
| signature?: string; | ||
| }; | ||
| export type GoogleInteractionsCodeExecutionCallStepPayload = { | ||
@@ -261,2 +282,10 @@ id: string; | ||
| export type GoogleInteractionsProcessingCallStep = { | ||
| type: 'processing_call'; | ||
| } & GoogleInteractionsProcessingCallStepPayload; | ||
| export type GoogleInteractionsProcessingResultStep = { | ||
| type: 'processing_result'; | ||
| } & GoogleInteractionsProcessingResultStepPayload; | ||
| export type GoogleInteractionsBuiltinToolCallStep = | ||
@@ -301,2 +330,4 @@ | ({ | ||
| | GoogleInteractionsThoughtStep | ||
| | GoogleInteractionsProcessingCallStep | ||
| | GoogleInteractionsProcessingResultStep | ||
| | GoogleInteractionsBuiltinToolCallStep | ||
@@ -303,0 +334,0 @@ | GoogleInteractionsBuiltinToolResultStep |
@@ -31,2 +31,14 @@ /** | ||
| signature?: string; | ||
| /** | ||
| * ID of an agentic video `processing_call` step. Present on | ||
| * `google.processing_call` custom parts. | ||
| */ | ||
| processingId?: string; | ||
| /** | ||
| * ID of the corresponding agentic video processing call. Present on | ||
| * `google.processing_result` custom parts. | ||
| */ | ||
| processingCallId?: string; | ||
| }; |
@@ -26,5 +26,9 @@ import type { JSONValue, LanguageModelV4Content } from '@ai-sdk/provider'; | ||
| interactionId, | ||
| processingId, | ||
| processingCallId, | ||
| }: { | ||
| signature?: string | null; | ||
| interactionId?: string; | ||
| processingId?: string; | ||
| processingCallId?: string; | ||
| }): { providerMetadata: { google: Record<string, string> } } | object { | ||
@@ -38,2 +42,8 @@ const google: Record<string, string> = {}; | ||
| } | ||
| if (processingId != null) { | ||
| google.processingId = processingId; | ||
| } | ||
| if (processingCallId != null) { | ||
| google.processingCallId = processingCallId; | ||
| } | ||
| return Object.keys(google).length > 0 ? { providerMetadata: { google } } : {}; | ||
@@ -203,2 +213,36 @@ } | ||
| } | ||
| case 'processing_call': { | ||
| const call = step as { | ||
| id?: string; | ||
| signature?: string | null; | ||
| }; | ||
| const processingId = call.id || generateId(); | ||
| content.push({ | ||
| type: 'custom', | ||
| kind: 'google.processing_call', | ||
| ...googleProviderMetadata({ | ||
| signature: call.signature, | ||
| interactionId, | ||
| processingId, | ||
| }), | ||
| }); | ||
| break; | ||
| } | ||
| case 'processing_result': { | ||
| const result = step as { | ||
| call_id?: string; | ||
| signature?: string | null; | ||
| }; | ||
| const processingCallId = result.call_id || generateId(); | ||
| content.push({ | ||
| type: 'custom', | ||
| kind: 'google.processing_result', | ||
| ...googleProviderMetadata({ | ||
| signature: result.signature, | ||
| interactionId, | ||
| processingCallId, | ||
| }), | ||
| }); | ||
| break; | ||
| } | ||
| case 'function_call': { | ||
@@ -205,0 +249,0 @@ hasFunctionCall = true; |
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 not supported yet
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.
2375826
1.93%30642
1.93%