@ai-sdk/google 4.0.53 → 4.0.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/index.d.ts +62 -3
- package/dist/index.js +555 -28
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/google-provider.ts +27 -0
- package/src/index.ts +5 -0
- package/src/transcription/google-transcription-model-options.ts +50 -0
- package/src/transcription/google-transcription-model.ts +714 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @ai-sdk/google
|
|
2
2
|
|
|
3
|
+
## 4.0.54
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 1f7835c: feat (provider/google, provider/google-vertex): Gemini 3.5 Transcribe support — unary transcription (`gemini-3.5-transcribe`) via generateContent with language detection, speaker diarization, word timestamps, and custom vocabulary, plus streaming transcription (`gemini-3.5-transcribe-live`) over the Live API WebSocket with `mode: 'VERBATIM' | 'SMART'` transcription formatting
|
|
8
|
+
|
|
3
9
|
## 4.0.53
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
2
|
-
import { InferSchema, FetchFunction, WebSocketConstructor, WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE } from '@ai-sdk/provider-utils';
|
|
2
|
+
import { InferSchema, FetchFunction, WebSocketConstructor, WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE, Resolvable } from '@ai-sdk/provider-utils';
|
|
3
3
|
import { z } from 'zod/v4';
|
|
4
4
|
import * as _ai_sdk_provider from '@ai-sdk/provider';
|
|
5
|
-
import { ProviderV4, Experimental_BatchLanguageModelV4, ImageModelV4, EmbeddingModelV4, Experimental_VideoModelV4, Experimental_SpeechTranslationModelV4, SpeechModelV4, FilesV4, LanguageModelV4, Experimental_RealtimeFactoryV4, Experimental_RealtimeModelV4, Experimental_RealtimeModelV4ClientSecretOptions, Experimental_RealtimeModelV4ClientSecretResult, Experimental_RealtimeModelV4ServerEvent, Experimental_RealtimeModelV4ClientEvent, Experimental_RealtimeModelV4SessionConfig, Experimental_SpeechTranslationModelV4StreamOptions } from '@ai-sdk/provider';
|
|
5
|
+
import { ProviderV4, Experimental_BatchLanguageModelV4, ImageModelV4, EmbeddingModelV4, Experimental_VideoModelV4, Experimental_SpeechTranslationModelV4, SpeechModelV4, TranscriptionModelV4, FilesV4, LanguageModelV4, Experimental_RealtimeFactoryV4, Experimental_RealtimeModelV4, Experimental_RealtimeModelV4ClientSecretOptions, Experimental_RealtimeModelV4ClientSecretResult, Experimental_RealtimeModelV4ServerEvent, Experimental_RealtimeModelV4ClientEvent, Experimental_RealtimeModelV4SessionConfig, JSONObject, Experimental_TranscriptionModelV4StreamOptions, Experimental_SpeechTranslationModelV4StreamOptions } from '@ai-sdk/provider';
|
|
6
6
|
|
|
7
7
|
declare const googleErrorDataSchema: _ai_sdk_provider_utils.LazySchema<{
|
|
8
8
|
error: {
|
|
@@ -512,6 +512,24 @@ interface GoogleImageSettings {
|
|
|
512
512
|
maxImagesPerCall?: number;
|
|
513
513
|
}
|
|
514
514
|
|
|
515
|
+
type GoogleTranscriptionModelId = 'gemini-3.5-transcribe' | 'gemini-3.5-transcribe-live' | (string & {});
|
|
516
|
+
/**
|
|
517
|
+
* Speech recognition options shared by unary (`gemini-3.5-transcribe`) and
|
|
518
|
+
* live (`gemini-3.5-transcribe-live`) transcription. Maps onto Google's
|
|
519
|
+
* `AudioTranscriptionConfig`.
|
|
520
|
+
*/
|
|
521
|
+
declare const googleTranscriptionModelOptions: z.ZodObject<{
|
|
522
|
+
languageCodes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
523
|
+
customVocabulary: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
524
|
+
wordTimestamp: z.ZodOptional<z.ZodBoolean>;
|
|
525
|
+
diarization: z.ZodOptional<z.ZodBoolean>;
|
|
526
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
527
|
+
SMART: "SMART";
|
|
528
|
+
VERBATIM: "VERBATIM";
|
|
529
|
+
}>>;
|
|
530
|
+
}, z.core.$strip>;
|
|
531
|
+
type GoogleTranscriptionModelOptions = z.infer<typeof googleTranscriptionModelOptions>;
|
|
532
|
+
|
|
515
533
|
type GoogleSpeechTranslationModelId = 'gemini-3.5-live-translate-preview' | (string & {});
|
|
516
534
|
declare const googleSpeechTranslationModelOptions: _ai_sdk_provider_utils.LazySchema<{
|
|
517
535
|
echoTargetLanguage?: boolean | undefined;
|
|
@@ -570,6 +588,17 @@ interface GoogleProvider extends ProviderV4 {
|
|
|
570
588
|
* Creates a model for speech generation (text-to-speech).
|
|
571
589
|
*/
|
|
572
590
|
speechModel(modelId: GoogleSpeechModelId): SpeechModelV4;
|
|
591
|
+
/**
|
|
592
|
+
* Creates a model for transcription (speech-to-text). Unary models
|
|
593
|
+
* (e.g. `gemini-3.5-transcribe`) transcribe audio files; live models
|
|
594
|
+
* (e.g. `gemini-3.5-transcribe-live`) stream transcription over the
|
|
595
|
+
* Gemini Live API WebSocket via `experimental_streamTranscribe`.
|
|
596
|
+
*/
|
|
597
|
+
transcription(modelId: GoogleTranscriptionModelId): TranscriptionModelV4;
|
|
598
|
+
/**
|
|
599
|
+
* Creates a model for transcription (speech-to-text).
|
|
600
|
+
*/
|
|
601
|
+
transcriptionModel(modelId: GoogleTranscriptionModelId): TranscriptionModelV4;
|
|
573
602
|
files(): FilesV4;
|
|
574
603
|
/**
|
|
575
604
|
* Creates a language model targeting the Gemini Interactions API
|
|
@@ -679,6 +708,36 @@ type GoogleRealtimeModelOptions = {
|
|
|
679
708
|
};
|
|
680
709
|
};
|
|
681
710
|
|
|
711
|
+
interface GoogleTranscriptionModelConfig {
|
|
712
|
+
provider: string;
|
|
713
|
+
baseURL: string;
|
|
714
|
+
headers?: Resolvable<Record<string, string | undefined>>;
|
|
715
|
+
fetch?: FetchFunction;
|
|
716
|
+
webSocket?: WebSocketConstructor;
|
|
717
|
+
_internal?: {
|
|
718
|
+
currentDate?: () => Date;
|
|
719
|
+
finishGraceMs?: number;
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
declare class GoogleTranscriptionModel implements TranscriptionModelV4 {
|
|
723
|
+
readonly modelId: GoogleTranscriptionModelId;
|
|
724
|
+
private readonly config;
|
|
725
|
+
readonly specificationVersion = "v4";
|
|
726
|
+
static [WORKFLOW_SERIALIZE](model: GoogleTranscriptionModel): {
|
|
727
|
+
modelId: string;
|
|
728
|
+
config: JSONObject;
|
|
729
|
+
};
|
|
730
|
+
static [WORKFLOW_DESERIALIZE](options: {
|
|
731
|
+
modelId: GoogleTranscriptionModelId;
|
|
732
|
+
config: GoogleTranscriptionModelConfig;
|
|
733
|
+
}): GoogleTranscriptionModel;
|
|
734
|
+
get provider(): string;
|
|
735
|
+
constructor(modelId: GoogleTranscriptionModelId, config: GoogleTranscriptionModelConfig);
|
|
736
|
+
private parseOptions;
|
|
737
|
+
doGenerate(options: Parameters<TranscriptionModelV4['doGenerate']>[0]): Promise<Awaited<ReturnType<TranscriptionModelV4['doGenerate']>>>;
|
|
738
|
+
doStream(options: Experimental_TranscriptionModelV4StreamOptions): Promise<Awaited<ReturnType<NonNullable<TranscriptionModelV4['doStream']>>>>;
|
|
739
|
+
}
|
|
740
|
+
|
|
682
741
|
type GoogleSpeechTranslationModelConfig = {
|
|
683
742
|
provider: string;
|
|
684
743
|
baseURL: string;
|
|
@@ -708,4 +767,4 @@ declare class GoogleSpeechTranslationModel implements Experimental_SpeechTransla
|
|
|
708
767
|
|
|
709
768
|
declare const VERSION: string;
|
|
710
769
|
|
|
711
|
-
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, type GoogleVideoModelId, type GoogleVideoModelOptions, VERSION, createGoogle, createGoogle as createGoogleGenerativeAI, google };
|
|
770
|
+
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 };
|