@google/genai 2.9.0 → 2.11.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.
@@ -40,6 +40,82 @@ declare enum ApiSpec {
40
40
  ELASTIC_SEARCH = "ELASTIC_SEARCH"
41
41
  }
42
42
 
43
+ /** The aspect ratio for the image output. */
44
+ declare enum AspectRatio {
45
+ /**
46
+ * Default value. This value is unused.
47
+ */
48
+ ASPECT_RATIO_UNSPECIFIED = "ASPECT_RATIO_UNSPECIFIED",
49
+ /**
50
+ * 1:1 aspect ratio.
51
+ */
52
+ ASPECT_RATIO_ONE_BY_ONE = "ASPECT_RATIO_ONE_BY_ONE",
53
+ /**
54
+ * 2:3 aspect ratio.
55
+ */
56
+ ASPECT_RATIO_TWO_BY_THREE = "ASPECT_RATIO_TWO_BY_THREE",
57
+ /**
58
+ * 3:2 aspect ratio.
59
+ */
60
+ ASPECT_RATIO_THREE_BY_TWO = "ASPECT_RATIO_THREE_BY_TWO",
61
+ /**
62
+ * 3:4 aspect ratio.
63
+ */
64
+ ASPECT_RATIO_THREE_BY_FOUR = "ASPECT_RATIO_THREE_BY_FOUR",
65
+ /**
66
+ * 4:3 aspect ratio.
67
+ */
68
+ ASPECT_RATIO_FOUR_BY_THREE = "ASPECT_RATIO_FOUR_BY_THREE",
69
+ /**
70
+ * 4:5 aspect ratio.
71
+ */
72
+ ASPECT_RATIO_FOUR_BY_FIVE = "ASPECT_RATIO_FOUR_BY_FIVE",
73
+ /**
74
+ * 5:4 aspect ratio.
75
+ */
76
+ ASPECT_RATIO_FIVE_BY_FOUR = "ASPECT_RATIO_FIVE_BY_FOUR",
77
+ /**
78
+ * 9:16 aspect ratio.
79
+ */
80
+ ASPECT_RATIO_NINE_BY_SIXTEEN = "ASPECT_RATIO_NINE_BY_SIXTEEN",
81
+ /**
82
+ * 16:9 aspect ratio.
83
+ */
84
+ ASPECT_RATIO_SIXTEEN_BY_NINE = "ASPECT_RATIO_SIXTEEN_BY_NINE",
85
+ /**
86
+ * 21:9 aspect ratio.
87
+ */
88
+ ASPECT_RATIO_TWENTY_ONE_BY_NINE = "ASPECT_RATIO_TWENTY_ONE_BY_NINE",
89
+ /**
90
+ * 1:8 aspect ratio.
91
+ */
92
+ ASPECT_RATIO_ONE_BY_EIGHT = "ASPECT_RATIO_ONE_BY_EIGHT",
93
+ /**
94
+ * 8:1 aspect ratio.
95
+ */
96
+ ASPECT_RATIO_EIGHT_BY_ONE = "ASPECT_RATIO_EIGHT_BY_ONE",
97
+ /**
98
+ * 1:4 aspect ratio.
99
+ */
100
+ ASPECT_RATIO_ONE_BY_FOUR = "ASPECT_RATIO_ONE_BY_FOUR",
101
+ /**
102
+ * 4:1 aspect ratio.
103
+ */
104
+ ASPECT_RATIO_FOUR_BY_ONE = "ASPECT_RATIO_FOUR_BY_ONE"
105
+ }
106
+
107
+ /** Configuration for audio-specific output formatting. */
108
+ declare class AudioResponseFormat {
109
+ /** Optional. Bit rate in bits per second (bps). Only applicable for compressed formats (MP3, Opus). */
110
+ bitRate?: number;
111
+ /** Optional. Delivery mode for the generated content. */
112
+ delivery?: Delivery;
113
+ /** Optional. The MIME type of the audio output. */
114
+ mimeType?: string;
115
+ /** Optional. Sample rate for the generated audio in Hertz. */
116
+ sampleRate?: number;
117
+ }
118
+
43
119
  /** The authentication config to access the API. */
44
120
  declare interface AuthConfig {
45
121
  /** The authentication config to access the API. Only API key is supported. This field is not supported in Gemini API. */
@@ -115,7 +191,7 @@ declare enum AuthType {
115
191
  OIDC_AUTH = "OIDC_AUTH"
116
192
  }
117
193
 
118
- /** Specifies the function Behavior. Currently only non-blocking functions are supported. If not specified, the system keeps the current function call behavior. This field is currently only supported by the BidiGenerateContent method. */
194
+ /** Specifies the function Behavior. If not specified, the system keeps the current function call behavior. This field is currently only supported by the BidiGenerateContent method. */
119
195
  declare enum Behavior {
120
196
  /**
121
197
  * This value is unspecified.
@@ -156,15 +232,12 @@ declare interface CodeExecutionResult {
156
232
  declare interface ComputerUse {
157
233
  /** Required. The environment being operated. */
158
234
  environment?: Environment;
159
- /** By default, predefined functions are included in the final model call.
160
- Some of them can be explicitly excluded from being automatically included.
161
- This can serve two purposes:
162
- 1. Using a more restricted / different action space.
163
- 2. Improving the definitions / instructions of predefined functions. */
235
+ /** Optional. By default, [predefined functions](https://cloud.google.com/vertex-ai/generative-ai/docs/computer-use#supported-actions) are included in the final model call. Some of them can be explicitly excluded from being automatically included. This can serve two purposes: 1. Using a more restricted / different action space. 2. Improving the definitions / instructions of predefined functions. */
164
236
  excludedPredefinedFunctions?: string[];
165
- /** Optional. Whether enable the prompt injection detection check on computer-use request.
166
- */
237
+ /** Optional. Enables the prompt injection detection check on computer-use request. */
167
238
  enablePromptInjectionDetection?: boolean;
239
+ /** Optional. Disabled safety policies for computer use. This field is not supported in Vertex AI. */
240
+ disabledSafetyPolicies?: SafetyPolicy[];
168
241
  }
169
242
 
170
243
  /** Local tokenizer compute tokens result. */
@@ -216,6 +289,22 @@ export declare interface CountTokensResult {
216
289
  totalTokens?: number;
217
290
  }
218
291
 
292
+ /** Delivery mode for the generated content. */
293
+ declare enum Delivery {
294
+ /**
295
+ * Default value. This value is unused.
296
+ */
297
+ DELIVERY_UNSPECIFIED = "DELIVERY_UNSPECIFIED",
298
+ /**
299
+ * Generated bytes are returned inline in the response.
300
+ */
301
+ INLINE = "INLINE",
302
+ /**
303
+ * Generated content is stored and a URI is returned.
304
+ */
305
+ URI = "URI"
306
+ }
307
+
219
308
  /** Describes the options to customize dynamic retrieval. */
220
309
  declare interface DynamicRetrievalConfig {
221
310
  /** Optional. The threshold to be used in dynamic retrieval. If not set, a system default value is used. */
@@ -360,7 +449,7 @@ declare interface FunctionDeclaration {
360
449
  response?: Schema;
361
450
  /** Optional. Describes the output from this function in JSON Schema format. The value specified by the schema is the response value of the function. This field is mutually exclusive with `response`. */
362
451
  responseJsonSchema?: unknown;
363
- /** Optional. Specifies the function Behavior. Currently only non-blocking functions are supported. If not specified, the system keeps the current function call behavior. This field is currently only supported by the BidiGenerateContent method. */
452
+ /** Optional. Specifies the function Behavior. If not specified, the system keeps the current function call behavior. This field is currently only supported by the BidiGenerateContent method. */
364
453
  behavior?: Behavior;
365
454
  }
366
455
 
@@ -455,11 +544,11 @@ declare interface GenerationConfig {
455
544
  presencePenalty?: number;
456
545
  /** Optional. If set to true, the log probabilities of the output tokens are returned. Log probabilities are the logarithm of the probability of a token appearing in the output. A higher log probability means the token is more likely to be generated. This can be useful for analyzing the model's confidence in its own output and for debugging. */
457
546
  responseLogprobs?: boolean;
458
- /** Optional. The IANA standard MIME type of the response. The model will generate output that conforms to this MIME type. Supported values include 'text/plain' (default) and 'application/json'. The model needs to be prompted to output the appropriate response type, otherwise the behavior is undefined. */
547
+ /** Optional. The IANA standard MIME type of the response. The model will generate output that conforms to this MIME type. Supported values include 'text/plain' (default) and 'application/json'. The model needs to be prompted to output the appropriate response type, otherwise the behavior is undefined. Deprecated: Use `response_format` instead. */
459
548
  responseMimeType?: string;
460
549
  /** Optional. The modalities of the response. The model will generate a response that includes all the specified modalities. For example, if this is set to `[TEXT, IMAGE]`, the response will include both text and an image. */
461
550
  responseModalities?: Modality[];
462
- /** Optional. Lets you to specify a schema for the model's response, ensuring that the output conforms to a particular structure. This is useful for generating structured data such as JSON. The schema is a subset of the [OpenAPI 3.0 schema object](https://spec.openapis.org/oas/v3.0.3#schema) object. When this field is set, you must also set the `response_mime_type` to `application/json`. */
551
+ /** Optional. Lets you to specify a schema for the model's response, ensuring that the output conforms to a particular structure. This is useful for generating structured data such as JSON. The schema is a subset of the [OpenAPI 3.0 schema object](https://spec.openapis.org/oas/v3.0.3#schema) object. When this field is set, you must also set the `response_mime_type` to `application/json`. Deprecated: Use `response_format` instead. */
463
552
  responseSchema?: Schema;
464
553
  /** Optional. Routing configuration. This field is not supported in Gemini API. */
465
554
  routingConfig?: GenerationConfigRoutingConfig;
@@ -479,6 +568,10 @@ declare interface GenerationConfig {
479
568
  topP?: number;
480
569
  /** Optional. Enables enhanced civic answers. It may not be available for all models. This field is not supported in Vertex AI. */
481
570
  enableEnhancedCivicAnswers?: boolean;
571
+ /** Optional. New response format field for the model to configure output formatting and delivery. */
572
+ responseFormat?: ResponseFormat[];
573
+ /** Optional. Config for translation. This field is not supported in Vertex AI. */
574
+ translationConfig?: TranslationConfig;
482
575
  }
483
576
 
484
577
  /** The configuration for routing the request to a specific model. This can be used to control which model is used for the generation, either automatically or by specifying a model name. This data type is not supported in Gemini API. */
@@ -580,10 +673,46 @@ declare interface HttpRetryOptions {
580
673
  attempts?: number;
581
674
  }
582
675
 
676
+ /** Configuration for image-specific output formatting. */
677
+ declare class ImageResponseFormat {
678
+ /** Optional. The aspect ratio for the image output. */
679
+ aspectRatio?: AspectRatio;
680
+ /** Optional. Delivery mode for the generated content. */
681
+ delivery?: Delivery;
682
+ /** Optional. The size of the image output. */
683
+ imageSize?: ImageSize;
684
+ /** Optional. The MIME type of the image output. */
685
+ mimeType?: string;
686
+ }
687
+
583
688
  /** Image search for grounding and related configurations. */
584
689
  declare interface ImageSearch {
585
690
  }
586
691
 
692
+ /** The size of the image output. */
693
+ declare enum ImageSize {
694
+ /**
695
+ * Default value. This value is unused.
696
+ */
697
+ IMAGE_SIZE_UNSPECIFIED = "IMAGE_SIZE_UNSPECIFIED",
698
+ /**
699
+ * 512px image size.
700
+ */
701
+ IMAGE_SIZE_FIVE_TWELVE = "IMAGE_SIZE_FIVE_TWELVE",
702
+ /**
703
+ * 1K image size.
704
+ */
705
+ IMAGE_SIZE_ONE_K = "IMAGE_SIZE_ONE_K",
706
+ /**
707
+ * 2K image size.
708
+ */
709
+ IMAGE_SIZE_TWO_K = "IMAGE_SIZE_TWO_K",
710
+ /**
711
+ * 4K image size.
712
+ */
713
+ IMAGE_SIZE_FOUR_K = "IMAGE_SIZE_FOUR_K"
714
+ }
715
+
587
716
  /** Represents a time interval, encoded as a Timestamp start (inclusive) and a Timestamp end (exclusive). The start must be less than or equal to the end. When the start equals the end, the interval is empty (matches no time). When both start and end are unspecified, the interval matches any time. */
588
717
  declare interface Interval {
589
718
  /** Optional. Exclusive end of the interval. If specified, a Timestamp matching this interval will have to be before the end. */
@@ -917,6 +1046,17 @@ declare interface ReplicatedVoiceConfig {
917
1046
 
918
1047
  * @remarks Encoded as base64 string. */
919
1048
  voiceSampleAudio?: string;
1049
+ /** Recorded consent verifying ownership of the voice. This
1050
+ represents 16-bit signed little-endian wav data, with a 24kHz sampling
1051
+ rate.
1052
+ * @remarks Encoded as base64 string. */
1053
+ consentAudio?: string;
1054
+ /** Signature of a previously verified consent audio. This should be
1055
+ populated with a signature generated by the server for a previous
1056
+ request containing the consent_audio field. When provided, the
1057
+ signature is verified instead of the consent_audio field to reduce
1058
+ latency. Requests will fail if the signature is invalid or expired. */
1059
+ voiceConsentSignature?: VoiceConsentSignature;
920
1060
  }
921
1061
 
922
1062
  /** Resource scope. */
@@ -931,6 +1071,18 @@ declare enum ResourceScope {
931
1071
  COLLECTION = "COLLECTION"
932
1072
  }
933
1073
 
1074
+ /** Configuration for the model to configure output formatting and delivery. This data type is not supported in Gemini API. */
1075
+ declare class ResponseFormat {
1076
+ /** Audio output format. */
1077
+ audio?: AudioResponseFormat;
1078
+ /** Image output format. */
1079
+ image?: ImageResponseFormat;
1080
+ /** Text output format. */
1081
+ text?: TextResponseFormat;
1082
+ /** Video output format. */
1083
+ video?: VideoResponseFormat;
1084
+ }
1085
+
934
1086
  /** Defines a retrieval tool that model can call to access external knowledge. This data type is not supported in Gemini API. */
935
1087
  declare interface Retrieval {
936
1088
  /** Optional. Deprecated. This option is no longer supported. */
@@ -943,6 +1095,42 @@ declare interface Retrieval {
943
1095
  vertexRagStore?: VertexRagStore;
944
1096
  }
945
1097
 
1098
+ /** SafetyPolicy */
1099
+ declare enum SafetyPolicy {
1100
+ /**
1101
+ * Unspecified safety policy.
1102
+ */
1103
+ SAFETY_POLICY_UNSPECIFIED = "SAFETY_POLICY_UNSPECIFIED",
1104
+ /**
1105
+ * Safety policy for financial transactions.
1106
+ */
1107
+ FINANCIAL_TRANSACTIONS = "FINANCIAL_TRANSACTIONS",
1108
+ /**
1109
+ * Safety policy for sensitive data modification.
1110
+ */
1111
+ SENSITIVE_DATA_MODIFICATION = "SENSITIVE_DATA_MODIFICATION",
1112
+ /**
1113
+ * Safety policy for communication tools (e.g. Gmail, Chat, Meet).
1114
+ */
1115
+ COMMUNICATION_TOOL = "COMMUNICATION_TOOL",
1116
+ /**
1117
+ * Safety policy for account creation.
1118
+ */
1119
+ ACCOUNT_CREATION = "ACCOUNT_CREATION",
1120
+ /**
1121
+ * Safety policy for data modification.
1122
+ */
1123
+ DATA_MODIFICATION = "DATA_MODIFICATION",
1124
+ /**
1125
+ * Safety policy for user consent management.
1126
+ */
1127
+ USER_CONSENT_MANAGEMENT = "USER_CONSENT_MANAGEMENT",
1128
+ /**
1129
+ * Safety policy for legal terms and agreements.
1130
+ */
1131
+ LEGAL_TERMS_AND_AGREEMENTS = "LEGAL_TERMS_AND_AGREEMENTS"
1132
+ }
1133
+
946
1134
  /** Schema is used to define the format of input/output data.
947
1135
 
948
1136
  Represents a select subset of an [OpenAPI 3.0 schema
@@ -1035,6 +1223,14 @@ declare interface StreamableHttpTransport {
1035
1223
  url?: string;
1036
1224
  }
1037
1225
 
1226
+ /** Configuration for text-specific output formatting. */
1227
+ declare class TextResponseFormat {
1228
+ /** Optional. The IANA standard MIME type of the response. */
1229
+ mimeType?: string;
1230
+ /** Optional. The JSON schema that the output should conform to. Only applicable when mime_type is APPLICATION_JSON. */
1231
+ schema?: unknown;
1232
+ }
1233
+
1038
1234
  /** The thinking features configuration. */
1039
1235
  declare interface ThinkingConfig {
1040
1236
  /** Indicates whether to include thoughts in the response. If true, thoughts are returned only if the model supports thought and thoughts are available.
@@ -1086,9 +1282,7 @@ export declare interface TokensInfo {
1086
1282
  declare interface Tool {
1087
1283
  /** Optional. Retrieval tool type. System will always execute the provided retrieval tool(s) to get external knowledge to answer the prompt. Retrieval results are presented to the model for generation. This field is not supported in Gemini API. */
1088
1284
  retrieval?: Retrieval;
1089
- /** Optional. Tool to support the model interacting directly with the
1090
- computer. If enabled, it automatically populates computer-use specific
1091
- Function Declarations. */
1285
+ /** Optional. Tool to support the model interacting directly with the computer. If enabled, it automatically populates computer-use specific Function Declarations. */
1092
1286
  computerUse?: ComputerUse;
1093
1287
  /** Optional. FileSearch tool type. Tool to retrieve knowledge from Semantic Retrieval corpora. This field is not supported in Vertex AI. */
1094
1288
  fileSearch?: FileSearch;
@@ -1111,6 +1305,8 @@ declare interface Tool {
1111
1305
  urlContext?: UrlContext;
1112
1306
  /** Optional. MCP Servers to connect to. This field is not supported in Vertex AI. */
1113
1307
  mcpServers?: McpServer[];
1308
+ /** Optional. Uses Exa.ai to search for information to answer user queries. The search results will be grounded on Exa.ai and presented to the model for response generation. This field is not supported in Gemini API. */
1309
+ exaAiSearch?: ToolExaAiSearch;
1114
1310
  }
1115
1311
 
1116
1312
  /** A predicted server-side `ToolCall` returned from the model.
@@ -1132,6 +1328,14 @@ declare interface ToolCall {
1132
1328
  declare interface ToolCodeExecution {
1133
1329
  }
1134
1330
 
1331
+ /** ExaAiSearch tool type. A tool that uses the Exa.ai search engine for grounding. This data type is not supported in Gemini API. */
1332
+ declare interface ToolExaAiSearch {
1333
+ /** Required. The API key for ExaAiSearch. */
1334
+ apiKey?: string;
1335
+ /** Optional. This field can be used to pass any parameter from the Exa.ai Search API. */
1336
+ customConfigs?: Record<string, unknown>;
1337
+ }
1338
+
1135
1339
  /** ParallelAiSearch tool type. A tool that uses the Parallel.ai search engine for grounding. This data type is not supported in Gemini API. */
1136
1340
  declare interface ToolParallelAiSearch {
1137
1341
  /** Optional. The API key for ParallelAiSearch. If an API key is not provided, the system will attempt to verify access by checking for an active Parallel.ai subscription through the Google Cloud Marketplace. See https://docs.parallel.ai/search/search-quickstart for more details. */
@@ -1183,6 +1387,14 @@ declare enum ToolType {
1183
1387
  FILE_SEARCH = "FILE_SEARCH"
1184
1388
  }
1185
1389
 
1390
+ /** Config for stream translation. */
1391
+ declare interface TranslationConfig {
1392
+ /** Optional. If true, the model will generate audio when the target language is spoken, essentially it will parrot the input. If false, we will not produce audio for the target language. */
1393
+ echoTargetLanguage?: boolean;
1394
+ /** Required. The target language for translation. Supported values are BCP-47 language codes (e.g. "en", "es", "fr"). */
1395
+ targetLanguageCode?: string;
1396
+ }
1397
+
1186
1398
  /** Data type of the schema field. */
1187
1399
  declare enum Type {
1188
1400
  /**
@@ -1279,6 +1491,18 @@ declare interface VideoMetadata {
1279
1491
  startOffset?: string;
1280
1492
  }
1281
1493
 
1494
+ /** Configuration for video-specific output formatting. This data type is not supported in Gemini API. */
1495
+ declare class VideoResponseFormat {
1496
+ /** The aspect ratio for the video output. */
1497
+ aspectRatio?: AspectRatio;
1498
+ /** Optional. Delivery mode for the generated content. */
1499
+ delivery?: Delivery;
1500
+ /** Optional. The duration for the video output. */
1501
+ duration?: string;
1502
+ /** Optional. The Google Cloud Storage URI to store the video output. Required for Vertex if delivery is URI. */
1503
+ gcsUri?: string;
1504
+ }
1505
+
1282
1506
  /** The configuration for the voice to use. */
1283
1507
  declare interface VoiceConfig {
1284
1508
  /** The configuration for a replicated voice, which is a clone of a
@@ -1289,6 +1513,13 @@ declare interface VoiceConfig {
1289
1513
  prebuiltVoiceConfig?: PrebuiltVoiceConfig;
1290
1514
  }
1291
1515
 
1516
+ /** The signature of the voice consent check. */
1517
+ declare interface VoiceConsentSignature {
1518
+ /** The signature string.
1519
+ */
1520
+ signature?: string;
1521
+ }
1522
+
1292
1523
  /** Standard web search for grounding and related configurations. Only text results are returned. */
1293
1524
  declare interface WebSearch {
1294
1525
  }