@google/genai 1.49.0 → 1.50.0

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.
@@ -462,6 +462,18 @@ declare interface AutomaticFunctionCallingConfig {
462
462
  ignoreCallHistory?: boolean;
463
463
  }
464
464
 
465
+ /** Configures the avatar to be used in the session. */
466
+ declare interface AvatarConfig {
467
+ /** Pre-built avatar id. */
468
+ avatarName?: string;
469
+ /** Customized avatar appearance with a reference image. */
470
+ customizedAvatar?: CustomizedAvatar;
471
+ /** The bitrate of compressed audio. */
472
+ audioBitrateBps?: number;
473
+ /** The bitrate of compressed video output. */
474
+ videoBitrateBps?: number;
475
+ }
476
+
465
477
  /**
466
478
  * @license
467
479
  * Copyright 2025 Google LLC
@@ -1116,6 +1128,10 @@ declare interface CreateBatchJobConfig {
1116
1128
  "gs://path/to/output/data" or "bq://projectId.bqDatasetId.bqTableId".
1117
1129
  */
1118
1130
  dest?: BatchJobDestinationUnion;
1131
+ /** Webhook configuration for receiving notifications when the batch
1132
+ operation completes.
1133
+ */
1134
+ webhookConfig?: WebhookConfig;
1119
1135
  }
1120
1136
 
1121
1137
  /** Config for batches.create parameters. */
@@ -1429,6 +1445,16 @@ declare interface CustomCodeExecutionResult {
1429
1445
  score?: number;
1430
1446
  }
1431
1447
 
1448
+ /** Configures the customized avatar to be used in the session. */
1449
+ declare interface CustomizedAvatar {
1450
+ /** The mime type of the reference image, e.g., "image/jpeg". */
1451
+ imageMimeType?: string;
1452
+ /** The data of the reference image. The dimensions of the reference
1453
+ image should be 9:16 (portrait) with a minimum resolution of 704x1280.
1454
+ * @remarks Encoded as base64 string. */
1455
+ imageData?: string;
1456
+ }
1457
+
1432
1458
  /** User provided metadata stored as key-value pairs. This data type is not supported in Vertex AI. */
1433
1459
  declare interface CustomMetadata {
1434
1460
  /** Required. The key of the metadata to store. */
@@ -1945,6 +1971,14 @@ declare interface EmbedContentConfig {
1945
1971
  will lead to an INVALID_ARGUMENT error, similar to other text APIs.
1946
1972
  */
1947
1973
  autoTruncate?: boolean;
1974
+ /** Vertex API only. Whether to enable OCR for document content.
1975
+ Only applicable to Gemini Embedding 2 models.
1976
+ */
1977
+ documentOcr?: boolean;
1978
+ /** Vertex API only. Whether to extract audio from video content.
1979
+ Only applicable to Gemini Embedding 2 models.
1980
+ */
1981
+ audioTrackExtraction?: boolean;
1948
1982
  }
1949
1983
 
1950
1984
  /** Request-level metadata for the Vertex Embed Content API. */
@@ -3101,6 +3135,9 @@ declare interface GenerateVideosConfig {
3101
3135
  compressionQuality?: VideoCompressionQuality;
3102
3136
  /** User specified labels to track billing usage. */
3103
3137
  labels?: Record<string, string>;
3138
+ /** Webhook configuration for receiving notifications when the
3139
+ video generation operation completes. */
3140
+ webhookConfig?: WebhookConfig;
3104
3141
  }
3105
3142
 
3106
3143
  /** A video generation operation. */
@@ -4553,6 +4590,12 @@ declare interface LiveClientSetup {
4553
4590
  vad_signal to indicate the start and end of speech. This allows the server
4554
4591
  to process the audio more efficiently. */
4555
4592
  explicitVadSignal?: boolean;
4593
+ /** Configures the avatar model behavior. */
4594
+ avatarConfig?: AvatarConfig;
4595
+ /** Safety settings in the request to block unsafe content in the
4596
+ response.
4597
+ */
4598
+ safetySettings?: SafetySetting[];
4556
4599
  }
4557
4600
 
4558
4601
  /** Client generated response to a `ToolCall` received from the server.
@@ -4659,6 +4702,12 @@ declare interface LiveConnectConfig {
4659
4702
  vad_signal to indicate the start and end of speech. This allows the server
4660
4703
  to process the audio more efficiently. */
4661
4704
  explicitVadSignal?: boolean;
4705
+ /** Configures the avatar model behavior. */
4706
+ avatarConfig?: AvatarConfig;
4707
+ /** Safety settings in the request to block unsafe content in the
4708
+ response.
4709
+ */
4710
+ safetySettings?: SafetySetting[];
4662
4711
  }
4663
4712
 
4664
4713
  /** Config for LiveConnectConstraints for Auth Token creation. */
@@ -5160,7 +5209,11 @@ declare enum Modality {
5160
5209
  /**
5161
5210
  * Indicates the model should return audio.
5162
5211
  */
5163
- AUDIO = "AUDIO"
5212
+ AUDIO = "AUDIO",
5213
+ /**
5214
+ * Indicates the model should return video.
5215
+ */
5216
+ VIDEO = "VIDEO"
5164
5217
  }
5165
5218
 
5166
5219
  /** Represents token counting info for a single modality. */
@@ -7064,7 +7117,103 @@ declare enum TurnCompleteReason {
7064
7117
  /**
7065
7118
  * Needs more input from the user.
7066
7119
  */
7067
- NEED_MORE_INPUT = "NEED_MORE_INPUT"
7120
+ NEED_MORE_INPUT = "NEED_MORE_INPUT",
7121
+ /**
7122
+ * Input content is prohibited.
7123
+ */
7124
+ PROHIBITED_INPUT_CONTENT = "PROHIBITED_INPUT_CONTENT",
7125
+ /**
7126
+ * Input image contains prohibited content.
7127
+ */
7128
+ IMAGE_PROHIBITED_INPUT_CONTENT = "IMAGE_PROHIBITED_INPUT_CONTENT",
7129
+ /**
7130
+ * Input text contains prominent person reference.
7131
+ */
7132
+ INPUT_TEXT_CONTAIN_PROMINENT_PERSON_PROHIBITED = "INPUT_TEXT_CONTAIN_PROMINENT_PERSON_PROHIBITED",
7133
+ /**
7134
+ * Input image contains celebrity.
7135
+ */
7136
+ INPUT_IMAGE_CELEBRITY = "INPUT_IMAGE_CELEBRITY",
7137
+ /**
7138
+ * Input image contains photo realistic child.
7139
+ */
7140
+ INPUT_IMAGE_PHOTO_REALISTIC_CHILD_PROHIBITED = "INPUT_IMAGE_PHOTO_REALISTIC_CHILD_PROHIBITED",
7141
+ /**
7142
+ * Input text contains NCII content.
7143
+ */
7144
+ INPUT_TEXT_NCII_PROHIBITED = "INPUT_TEXT_NCII_PROHIBITED",
7145
+ /**
7146
+ * Other input safety issue.
7147
+ */
7148
+ INPUT_OTHER = "INPUT_OTHER",
7149
+ /**
7150
+ * Input contains IP violation.
7151
+ */
7152
+ INPUT_IP_PROHIBITED = "INPUT_IP_PROHIBITED",
7153
+ /**
7154
+ * Input matched blocklist.
7155
+ */
7156
+ BLOCKLIST = "BLOCKLIST",
7157
+ /**
7158
+ * Input is unsafe for image generation.
7159
+ */
7160
+ UNSAFE_PROMPT_FOR_IMAGE_GENERATION = "UNSAFE_PROMPT_FOR_IMAGE_GENERATION",
7161
+ /**
7162
+ * Generated image failed safety check.
7163
+ */
7164
+ GENERATED_IMAGE_SAFETY = "GENERATED_IMAGE_SAFETY",
7165
+ /**
7166
+ * Generated content failed safety check.
7167
+ */
7168
+ GENERATED_CONTENT_SAFETY = "GENERATED_CONTENT_SAFETY",
7169
+ /**
7170
+ * Generated audio failed safety check.
7171
+ */
7172
+ GENERATED_AUDIO_SAFETY = "GENERATED_AUDIO_SAFETY",
7173
+ /**
7174
+ * Generated video failed safety check.
7175
+ */
7176
+ GENERATED_VIDEO_SAFETY = "GENERATED_VIDEO_SAFETY",
7177
+ /**
7178
+ * Generated content is prohibited.
7179
+ */
7180
+ GENERATED_CONTENT_PROHIBITED = "GENERATED_CONTENT_PROHIBITED",
7181
+ /**
7182
+ * Generated content matched blocklist.
7183
+ */
7184
+ GENERATED_CONTENT_BLOCKLIST = "GENERATED_CONTENT_BLOCKLIST",
7185
+ /**
7186
+ * Generated image is prohibited.
7187
+ */
7188
+ GENERATED_IMAGE_PROHIBITED = "GENERATED_IMAGE_PROHIBITED",
7189
+ /**
7190
+ * Generated image contains celebrity.
7191
+ */
7192
+ GENERATED_IMAGE_CELEBRITY = "GENERATED_IMAGE_CELEBRITY",
7193
+ /**
7194
+ * Generated image contains prominent people detected by rewriter.
7195
+ */
7196
+ GENERATED_IMAGE_PROMINENT_PEOPLE_DETECTED_BY_REWRITER = "GENERATED_IMAGE_PROMINENT_PEOPLE_DETECTED_BY_REWRITER",
7197
+ /**
7198
+ * Generated image contains identifiable people.
7199
+ */
7200
+ GENERATED_IMAGE_IDENTIFIABLE_PEOPLE = "GENERATED_IMAGE_IDENTIFIABLE_PEOPLE",
7201
+ /**
7202
+ * Generated image contains minors.
7203
+ */
7204
+ GENERATED_IMAGE_MINORS = "GENERATED_IMAGE_MINORS",
7205
+ /**
7206
+ * Generated image contains IP violation.
7207
+ */
7208
+ OUTPUT_IMAGE_IP_PROHIBITED = "OUTPUT_IMAGE_IP_PROHIBITED",
7209
+ /**
7210
+ * Other generated content issue.
7211
+ */
7212
+ GENERATED_OTHER = "GENERATED_OTHER",
7213
+ /**
7214
+ * Max regeneration attempts reached.
7215
+ */
7216
+ MAX_REGENERATION_REACHED = "MAX_REGENERATION_REACHED"
7068
7217
  }
7069
7218
 
7070
7219
  /** Options about which input is included in the user's turn. */
@@ -7377,6 +7526,7 @@ declare namespace types {
7377
7526
  GenerateVideosSource,
7378
7527
  VideoGenerationReferenceImage,
7379
7528
  VideoGenerationMask,
7529
+ WebhookConfig,
7380
7530
  GenerateVideosConfig,
7381
7531
  GenerateVideosParameters,
7382
7532
  GeneratedVideo,
@@ -7568,19 +7718,21 @@ declare namespace types {
7568
7718
  ContextWindowCompressionConfig,
7569
7719
  AudioTranscriptionConfig,
7570
7720
  ProactivityConfig,
7721
+ CustomizedAvatar,
7722
+ AvatarConfig,
7571
7723
  LiveClientSetup,
7572
7724
  LiveClientContent,
7573
7725
  ActivityStart,
7574
7726
  ActivityEnd,
7575
7727
  LiveClientRealtimeInput,
7576
7728
  LiveClientToolResponse,
7577
- LiveSendRealtimeInputParameters,
7578
7729
  LiveClientMessage,
7579
7730
  LiveConnectConfig,
7580
7731
  LiveConnectParameters,
7581
7732
  CreateChatParameters,
7582
7733
  SendMessageParameters,
7583
7734
  LiveSendClientContentParameters,
7735
+ LiveSendRealtimeInputParameters,
7584
7736
  LiveSendToolResponseParameters,
7585
7737
  LiveMusicClientSetup,
7586
7738
  WeightedPrompt,
@@ -8158,6 +8310,20 @@ declare interface VoiceConfig {
8158
8310
  prebuiltVoiceConfig?: PrebuiltVoiceConfig;
8159
8311
  }
8160
8312
 
8313
+ /** Configuration for webhook notifications.
8314
+
8315
+ Used to configure webhook endpoints that will receive notifications
8316
+ when long-running operations (e.g., batch jobs, video generation) complete. */
8317
+ declare interface WebhookConfig {
8318
+ /** The webhook URIs to receive notifications. If set, these
8319
+ webhook URIs will be used instead of the registered webhooks. */
8320
+ uris?: string[];
8321
+ /** User metadata that will be included in each webhook event
8322
+ notification. Use this to attach custom key-value data to correlate
8323
+ webhook events with your internal systems. */
8324
+ userMetadata?: Record<string, unknown>;
8325
+ }
8326
+
8161
8327
  /** Standard web search for grounding and related configurations. Only text results are returned. */
8162
8328
  declare interface WebSearch {
8163
8329
  }
@@ -1009,6 +1009,10 @@ var Modality;
1009
1009
  * Indicates the model should return audio.
1010
1010
  */
1011
1011
  Modality["AUDIO"] = "AUDIO";
1012
+ /**
1013
+ * Indicates the model should return video.
1014
+ */
1015
+ Modality["VIDEO"] = "VIDEO";
1012
1016
  })(Modality || (Modality = {}));
1013
1017
  /** The stage of the underlying model. This enum is not supported in Vertex AI. */
1014
1018
  var ModelStage;
@@ -1603,6 +1607,102 @@ var TurnCompleteReason;
1603
1607
  * Needs more input from the user.
1604
1608
  */
1605
1609
  TurnCompleteReason["NEED_MORE_INPUT"] = "NEED_MORE_INPUT";
1610
+ /**
1611
+ * Input content is prohibited.
1612
+ */
1613
+ TurnCompleteReason["PROHIBITED_INPUT_CONTENT"] = "PROHIBITED_INPUT_CONTENT";
1614
+ /**
1615
+ * Input image contains prohibited content.
1616
+ */
1617
+ TurnCompleteReason["IMAGE_PROHIBITED_INPUT_CONTENT"] = "IMAGE_PROHIBITED_INPUT_CONTENT";
1618
+ /**
1619
+ * Input text contains prominent person reference.
1620
+ */
1621
+ TurnCompleteReason["INPUT_TEXT_CONTAIN_PROMINENT_PERSON_PROHIBITED"] = "INPUT_TEXT_CONTAIN_PROMINENT_PERSON_PROHIBITED";
1622
+ /**
1623
+ * Input image contains celebrity.
1624
+ */
1625
+ TurnCompleteReason["INPUT_IMAGE_CELEBRITY"] = "INPUT_IMAGE_CELEBRITY";
1626
+ /**
1627
+ * Input image contains photo realistic child.
1628
+ */
1629
+ TurnCompleteReason["INPUT_IMAGE_PHOTO_REALISTIC_CHILD_PROHIBITED"] = "INPUT_IMAGE_PHOTO_REALISTIC_CHILD_PROHIBITED";
1630
+ /**
1631
+ * Input text contains NCII content.
1632
+ */
1633
+ TurnCompleteReason["INPUT_TEXT_NCII_PROHIBITED"] = "INPUT_TEXT_NCII_PROHIBITED";
1634
+ /**
1635
+ * Other input safety issue.
1636
+ */
1637
+ TurnCompleteReason["INPUT_OTHER"] = "INPUT_OTHER";
1638
+ /**
1639
+ * Input contains IP violation.
1640
+ */
1641
+ TurnCompleteReason["INPUT_IP_PROHIBITED"] = "INPUT_IP_PROHIBITED";
1642
+ /**
1643
+ * Input matched blocklist.
1644
+ */
1645
+ TurnCompleteReason["BLOCKLIST"] = "BLOCKLIST";
1646
+ /**
1647
+ * Input is unsafe for image generation.
1648
+ */
1649
+ TurnCompleteReason["UNSAFE_PROMPT_FOR_IMAGE_GENERATION"] = "UNSAFE_PROMPT_FOR_IMAGE_GENERATION";
1650
+ /**
1651
+ * Generated image failed safety check.
1652
+ */
1653
+ TurnCompleteReason["GENERATED_IMAGE_SAFETY"] = "GENERATED_IMAGE_SAFETY";
1654
+ /**
1655
+ * Generated content failed safety check.
1656
+ */
1657
+ TurnCompleteReason["GENERATED_CONTENT_SAFETY"] = "GENERATED_CONTENT_SAFETY";
1658
+ /**
1659
+ * Generated audio failed safety check.
1660
+ */
1661
+ TurnCompleteReason["GENERATED_AUDIO_SAFETY"] = "GENERATED_AUDIO_SAFETY";
1662
+ /**
1663
+ * Generated video failed safety check.
1664
+ */
1665
+ TurnCompleteReason["GENERATED_VIDEO_SAFETY"] = "GENERATED_VIDEO_SAFETY";
1666
+ /**
1667
+ * Generated content is prohibited.
1668
+ */
1669
+ TurnCompleteReason["GENERATED_CONTENT_PROHIBITED"] = "GENERATED_CONTENT_PROHIBITED";
1670
+ /**
1671
+ * Generated content matched blocklist.
1672
+ */
1673
+ TurnCompleteReason["GENERATED_CONTENT_BLOCKLIST"] = "GENERATED_CONTENT_BLOCKLIST";
1674
+ /**
1675
+ * Generated image is prohibited.
1676
+ */
1677
+ TurnCompleteReason["GENERATED_IMAGE_PROHIBITED"] = "GENERATED_IMAGE_PROHIBITED";
1678
+ /**
1679
+ * Generated image contains celebrity.
1680
+ */
1681
+ TurnCompleteReason["GENERATED_IMAGE_CELEBRITY"] = "GENERATED_IMAGE_CELEBRITY";
1682
+ /**
1683
+ * Generated image contains prominent people detected by rewriter.
1684
+ */
1685
+ TurnCompleteReason["GENERATED_IMAGE_PROMINENT_PEOPLE_DETECTED_BY_REWRITER"] = "GENERATED_IMAGE_PROMINENT_PEOPLE_DETECTED_BY_REWRITER";
1686
+ /**
1687
+ * Generated image contains identifiable people.
1688
+ */
1689
+ TurnCompleteReason["GENERATED_IMAGE_IDENTIFIABLE_PEOPLE"] = "GENERATED_IMAGE_IDENTIFIABLE_PEOPLE";
1690
+ /**
1691
+ * Generated image contains minors.
1692
+ */
1693
+ TurnCompleteReason["GENERATED_IMAGE_MINORS"] = "GENERATED_IMAGE_MINORS";
1694
+ /**
1695
+ * Generated image contains IP violation.
1696
+ */
1697
+ TurnCompleteReason["OUTPUT_IMAGE_IP_PROHIBITED"] = "OUTPUT_IMAGE_IP_PROHIBITED";
1698
+ /**
1699
+ * Other generated content issue.
1700
+ */
1701
+ TurnCompleteReason["GENERATED_OTHER"] = "GENERATED_OTHER";
1702
+ /**
1703
+ * Max regeneration attempts reached.
1704
+ */
1705
+ TurnCompleteReason["MAX_REGENERATION_REACHED"] = "MAX_REGENERATION_REACHED";
1606
1706
  })(TurnCompleteReason || (TurnCompleteReason = {}));
1607
1707
  /** Server content modalities. */
1608
1708
  var MediaModality;
@@ -1876,10 +1976,11 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
1876
1976
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
1877
1977
  const USER_AGENT_HEADER = 'User-Agent';
1878
1978
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
1879
- const SDK_VERSION = '1.49.0'; // x-release-please-version
1979
+ const SDK_VERSION = '1.50.0'; // x-release-please-version
1880
1980
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
1881
1981
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
1882
1982
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
1983
+ const MULTI_REGIONAL_LOCATIONS = new Set(['us', 'eu']);
1883
1984
  // Default retry options.
1884
1985
  // The config is based on https://cloud.google.com/storage/docs/retry-strategy.
1885
1986
  const DEFAULT_RETRY_ATTEMPTS = 5; // Including the initial call
@@ -1938,7 +2039,7 @@ class ApiClient {
1938
2039
  }
1939
2040
  else if (this.clientOptions.project &&
1940
2041
  this.clientOptions.location &&
1941
- this.clientOptions.location === 'us') {
2042
+ MULTI_REGIONAL_LOCATIONS.has(this.clientOptions.location)) {
1942
2043
  initHttpOptions.baseUrl = `https://aiplatform.${this.clientOptions.location}.rep.googleapis.com/`;
1943
2044
  }
1944
2045
  else if (this.clientOptions.project && this.clientOptions.location) {