@ai-sdk/google 4.0.53 → 4.0.55

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 CHANGED
@@ -1,5 +1,17 @@
1
1
  # @ai-sdk/google
2
2
 
3
+ ## 4.0.55
4
+
5
+ ### Patch Changes
6
+
7
+ - 56d492f: Surface prompt-level Google safety blocks without candidates as content-filter results with prompt feedback metadata.
8
+
9
+ ## 4.0.54
10
+
11
+ ### Patch Changes
12
+
13
+ - 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
14
+
3
15
  ## 4.0.53
4
16
 
5
17
  ### 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: {
@@ -56,7 +56,8 @@ declare const googleLanguageModelOptions: _ai_sdk_provider_utils.LazySchema<{
56
56
  type GoogleLanguageModelOptions = InferSchema<typeof googleLanguageModelOptions>;
57
57
 
58
58
  declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
59
- candidates: {
59
+ responseId?: string | null | undefined;
60
+ candidates?: {
60
61
  content?: Record<string, never> | {
61
62
  parts?: ({
62
63
  functionCall: {
@@ -172,8 +173,7 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
172
173
  urlRetrievalStatus: string;
173
174
  }[] | null | undefined;
174
175
  } | null | undefined;
175
- }[];
176
- responseId?: string | null | undefined;
176
+ }[] | null | undefined;
177
177
  usageMetadata?: {
178
178
  cachedContentTokenCount?: number | null | undefined;
179
179
  thoughtsTokenCount?: number | null | undefined;
@@ -203,9 +203,10 @@ declare const responseSchema: _ai_sdk_provider_utils.LazySchema<{
203
203
  }[] | null | undefined;
204
204
  } | null | undefined;
205
205
  }>;
206
- type GroundingMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['groundingMetadata']>;
207
- type UrlContextMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['urlContextMetadata']>;
208
- type SafetyRatingSchema = NonNullable<InferSchema<typeof responseSchema>['candidates'][number]['safetyRatings']>[number];
206
+ type CandidateSchema = NonNullable<InferSchema<typeof responseSchema>['candidates']>[number];
207
+ type GroundingMetadataSchema = NonNullable<CandidateSchema['groundingMetadata']>;
208
+ type UrlContextMetadataSchema = NonNullable<CandidateSchema['urlContextMetadata']>;
209
+ type SafetyRatingSchema = NonNullable<CandidateSchema['safetyRatings']>[number];
209
210
  type PromptFeedbackSchema = NonNullable<InferSchema<typeof responseSchema>['promptFeedback']>;
210
211
  type UsageMetadataSchema = NonNullable<InferSchema<typeof responseSchema>['usageMetadata']>;
211
212
 
@@ -512,6 +513,24 @@ interface GoogleImageSettings {
512
513
  maxImagesPerCall?: number;
513
514
  }
514
515
 
516
+ type GoogleTranscriptionModelId = 'gemini-3.5-transcribe' | 'gemini-3.5-transcribe-live' | (string & {});
517
+ /**
518
+ * Speech recognition options shared by unary (`gemini-3.5-transcribe`) and
519
+ * live (`gemini-3.5-transcribe-live`) transcription. Maps onto Google's
520
+ * `AudioTranscriptionConfig`.
521
+ */
522
+ declare const googleTranscriptionModelOptions: z.ZodObject<{
523
+ languageCodes: z.ZodOptional<z.ZodArray<z.ZodString>>;
524
+ customVocabulary: z.ZodOptional<z.ZodArray<z.ZodString>>;
525
+ wordTimestamp: z.ZodOptional<z.ZodBoolean>;
526
+ diarization: z.ZodOptional<z.ZodBoolean>;
527
+ mode: z.ZodOptional<z.ZodEnum<{
528
+ SMART: "SMART";
529
+ VERBATIM: "VERBATIM";
530
+ }>>;
531
+ }, z.core.$strip>;
532
+ type GoogleTranscriptionModelOptions = z.infer<typeof googleTranscriptionModelOptions>;
533
+
515
534
  type GoogleSpeechTranslationModelId = 'gemini-3.5-live-translate-preview' | (string & {});
516
535
  declare const googleSpeechTranslationModelOptions: _ai_sdk_provider_utils.LazySchema<{
517
536
  echoTargetLanguage?: boolean | undefined;
@@ -570,6 +589,17 @@ interface GoogleProvider extends ProviderV4 {
570
589
  * Creates a model for speech generation (text-to-speech).
571
590
  */
572
591
  speechModel(modelId: GoogleSpeechModelId): SpeechModelV4;
592
+ /**
593
+ * Creates a model for transcription (speech-to-text). Unary models
594
+ * (e.g. `gemini-3.5-transcribe`) transcribe audio files; live models
595
+ * (e.g. `gemini-3.5-transcribe-live`) stream transcription over the
596
+ * Gemini Live API WebSocket via `experimental_streamTranscribe`.
597
+ */
598
+ transcription(modelId: GoogleTranscriptionModelId): TranscriptionModelV4;
599
+ /**
600
+ * Creates a model for transcription (speech-to-text).
601
+ */
602
+ transcriptionModel(modelId: GoogleTranscriptionModelId): TranscriptionModelV4;
573
603
  files(): FilesV4;
574
604
  /**
575
605
  * Creates a language model targeting the Gemini Interactions API
@@ -679,6 +709,36 @@ type GoogleRealtimeModelOptions = {
679
709
  };
680
710
  };
681
711
 
712
+ interface GoogleTranscriptionModelConfig {
713
+ provider: string;
714
+ baseURL: string;
715
+ headers?: Resolvable<Record<string, string | undefined>>;
716
+ fetch?: FetchFunction;
717
+ webSocket?: WebSocketConstructor;
718
+ _internal?: {
719
+ currentDate?: () => Date;
720
+ finishGraceMs?: number;
721
+ };
722
+ }
723
+ declare class GoogleTranscriptionModel implements TranscriptionModelV4 {
724
+ readonly modelId: GoogleTranscriptionModelId;
725
+ private readonly config;
726
+ readonly specificationVersion = "v4";
727
+ static [WORKFLOW_SERIALIZE](model: GoogleTranscriptionModel): {
728
+ modelId: string;
729
+ config: JSONObject;
730
+ };
731
+ static [WORKFLOW_DESERIALIZE](options: {
732
+ modelId: GoogleTranscriptionModelId;
733
+ config: GoogleTranscriptionModelConfig;
734
+ }): GoogleTranscriptionModel;
735
+ get provider(): string;
736
+ constructor(modelId: GoogleTranscriptionModelId, config: GoogleTranscriptionModelConfig);
737
+ private parseOptions;
738
+ doGenerate(options: Parameters<TranscriptionModelV4['doGenerate']>[0]): Promise<Awaited<ReturnType<TranscriptionModelV4['doGenerate']>>>;
739
+ doStream(options: Experimental_TranscriptionModelV4StreamOptions): Promise<Awaited<ReturnType<NonNullable<TranscriptionModelV4['doStream']>>>>;
740
+ }
741
+
682
742
  type GoogleSpeechTranslationModelConfig = {
683
743
  provider: string;
684
744
  baseURL: string;
@@ -708,4 +768,4 @@ declare class GoogleSpeechTranslationModel implements Experimental_SpeechTransla
708
768
 
709
769
  declare const VERSION: string;
710
770
 
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 };
771
+ 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 };