@google/genai 1.22.0 → 1.23.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.
package/dist/genai.d.ts CHANGED
@@ -5,8 +5,7 @@ import { GoogleAuthOptions } from 'google-auth-library';
5
5
  /** Marks the end of user activity.
6
6
 
7
7
  This can only be sent if automatic (i.e. server-side) activity detection is
8
- disabled.
9
- */
8
+ disabled. */
10
9
  export declare interface ActivityEnd {
11
10
  }
12
11
 
@@ -29,8 +28,7 @@ export declare enum ActivityHandling {
29
28
  /** Marks the start of user activity.
30
29
 
31
30
  This can only be sent if automatic (i.e. server-side) activity detection is
32
- disabled.
33
- */
31
+ disabled. */
34
32
  export declare interface ActivityStart {
35
33
  }
36
34
 
@@ -1153,8 +1151,7 @@ export declare type ContentListUnion = Content | Content[] | PartUnion | PartUni
1153
1151
 
1154
1152
  A content reference image represents a subject to reference (ex. person,
1155
1153
  product, animal) provided by the user. It can optionally be provided in
1156
- addition to a style reference image (ex. background, style reference).
1157
- */
1154
+ addition to a style reference image (ex. background, style reference). */
1158
1155
  export declare class ContentReferenceImage {
1159
1156
  /** The reference image for the editing operation. */
1160
1157
  referenceImage?: Image_2;
@@ -1194,8 +1191,7 @@ export declare interface ControlReferenceConfig {
1194
1191
  enable_control_image_computation field in the config should be set to True.
1195
1192
 
1196
1193
  A control image is an image that represents a sketch image of areas for the
1197
- model to fill in based on the prompt.
1198
- */
1194
+ model to fill in based on the prompt. */
1199
1195
  export declare class ControlReferenceImage {
1200
1196
  /** The reference image for the editing operation. */
1201
1197
  referenceImage?: Image_2;
@@ -1390,8 +1386,7 @@ export declare interface CreateCachedContentParameters {
1390
1386
  /** Parameters for initializing a new chat session.
1391
1387
 
1392
1388
  These parameters are used when creating a chat session with the
1393
- `chats.create()` method.
1394
- */
1389
+ `chats.create()` method. */
1395
1390
  export declare interface CreateChatParameters {
1396
1391
  /** The name of the model to use for the chat session.
1397
1392
 
@@ -1475,6 +1470,16 @@ export declare class CreateFileResponse {
1475
1470
  sdkHttpResponse?: HttpResponse;
1476
1471
  }
1477
1472
 
1473
+ /**
1474
+ * Creates a `FunctionResponsePart` object from a `base64` encoded `string`.
1475
+ */
1476
+ export declare function createFunctionResponsePartFromBase64(data: string, mimeType: string): FunctionResponsePart;
1477
+
1478
+ /**
1479
+ * Creates a `FunctionResponsePart` object from a `URI` string.
1480
+ */
1481
+ export declare function createFunctionResponsePartFromUri(uri: string, mimeType: string): FunctionResponsePart;
1482
+
1478
1483
  /**
1479
1484
  * Creates a `Content` object with a model role from a `PartListUnion` object or `string`.
1480
1485
  */
@@ -1503,7 +1508,7 @@ export declare function createPartFromFunctionCall(name: string, args: Record<st
1503
1508
  /**
1504
1509
  * Creates a `Part` object from a `FunctionResponse` object.
1505
1510
  */
1506
- export declare function createPartFromFunctionResponse(id: string, name: string, response: Record<string, unknown>): Part;
1511
+ export declare function createPartFromFunctionResponse(id: string, name: string, response: Record<string, unknown>, parts?: FunctionResponsePart[]): Part;
1507
1512
 
1508
1513
  /**
1509
1514
  * Creates a `Part` object from a `text` string.
@@ -1849,6 +1854,8 @@ export declare interface EditImageConfig {
1849
1854
  outputCompressionQuality?: number;
1850
1855
  /** Whether to add a watermark to the generated images. */
1851
1856
  addWatermark?: boolean;
1857
+ /** User specified labels to track billing usage. */
1858
+ labels?: Record<string, string>;
1852
1859
  /** Describes the editing mode for the request. */
1853
1860
  editMode?: EditMode;
1854
1861
  /** The number of sampling steps. A higher value has better image
@@ -2302,8 +2309,7 @@ export declare interface FileStatus {
2302
2309
 
2303
2310
  /** Output only. The reason why the model stopped generating tokens.
2304
2311
 
2305
- If empty, the model has not stopped generating the tokens.
2306
- */
2312
+ If empty, the model has not stopped generating the tokens. */
2307
2313
  export declare enum FinishReason {
2308
2314
  /**
2309
2315
  * The finish reason is unspecified.
@@ -2360,7 +2366,11 @@ export declare enum FinishReason {
2360
2366
  /**
2361
2367
  * Image generation stopped because the generated images have prohibited content.
2362
2368
  */
2363
- IMAGE_PROHIBITED_CONTENT = "IMAGE_PROHIBITED_CONTENT"
2369
+ IMAGE_PROHIBITED_CONTENT = "IMAGE_PROHIBITED_CONTENT",
2370
+ /**
2371
+ * The model was expected to generate an image, but none was generated.
2372
+ */
2373
+ NO_IMAGE = "NO_IMAGE"
2364
2374
  }
2365
2375
 
2366
2376
  /** A function call. */
@@ -2409,8 +2419,7 @@ export declare enum FunctionCallingConfigMode {
2409
2419
  /** Defines a function that the model can generate JSON inputs for.
2410
2420
 
2411
2421
  The inputs are based on `OpenAPI 3.0 specifications
2412
- <https://spec.openapis.org/oas/v3.0.3>`_.
2413
- */
2422
+ <https://spec.openapis.org/oas/v3.0.3>`_. */
2414
2423
  export declare interface FunctionDeclaration {
2415
2424
  /** Defines the function behavior. */
2416
2425
  behavior?: Behavior;
@@ -2448,8 +2457,7 @@ export declare class FunctionResponse {
2448
2457
  /** Raw media bytes for function response.
2449
2458
 
2450
2459
  Text should not be sent as raw bytes, use the FunctionResponse.response
2451
- field.
2452
- */
2460
+ field. */
2453
2461
  export declare class FunctionResponseBlob {
2454
2462
  /** Required. The IANA standard MIME type of the source data. */
2455
2463
  mimeType?: string;
@@ -2474,8 +2482,7 @@ export declare class FunctionResponseFileData {
2474
2482
 
2475
2483
  A `FunctionResponsePart` must have a fixed IANA MIME type identifying the
2476
2484
  type and subtype of the media if the `inline_data` field is filled with raw
2477
- bytes.
2478
- */
2485
+ bytes. */
2479
2486
  export declare class FunctionResponsePart {
2480
2487
  /** Optional. Inline media bytes. */
2481
2488
  inlineData?: FunctionResponseBlob;
@@ -2522,8 +2529,7 @@ export declare interface GeminiPreferenceExampleCompletion {
2522
2529
  /** Optional model configuration parameters.
2523
2530
 
2524
2531
  For more information, see `Content generation parameters
2525
- <https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/content-generation-parameters>`_.
2526
- */
2532
+ <https://cloud.google.com/vertex-ai/generative-ai/docs/multimodal/content-generation-parameters>`_. */
2527
2533
  export declare interface GenerateContentConfig {
2528
2534
  /** Used to override HTTP request options. */
2529
2535
  httpOptions?: HttpOptions;
@@ -2945,6 +2951,8 @@ export declare interface GenerateImagesConfig {
2945
2951
  outputCompressionQuality?: number;
2946
2952
  /** Whether to add a watermark to the generated images. */
2947
2953
  addWatermark?: boolean;
2954
+ /** User specified labels to track billing usage. */
2955
+ labels?: Record<string, string>;
2948
2956
  /** The size of the largest dimension of the generated image.
2949
2957
  Supported sizes are 1K and 2K (not supported for Imagen 3 models). */
2950
2958
  imageSize?: string;
@@ -3871,8 +3879,7 @@ export declare class InlinedResponse {
3871
3879
  The start time must be less than or equal to the end time.
3872
3880
  When the start equals the end time, the interval is an empty interval.
3873
3881
  (matches no time)
3874
- When both start and end are unspecified, the interval matches any time.
3875
- */
3882
+ When both start and end are unspecified, the interval matches any time. */
3876
3883
  export declare interface Interval {
3877
3884
  /** The start time of the interval. */
3878
3885
  startTime?: string;
@@ -3959,8 +3966,7 @@ export declare enum Language {
3959
3966
  This is expressed as a pair of doubles to represent degrees latitude and
3960
3967
  degrees longitude. Unless specified otherwise, this object must conform to the
3961
3968
  <a href="https://en.wikipedia.org/wiki/World_Geodetic_System#1984_version">
3962
- WGS84 standard</a>. Values must be within normalized ranges.
3963
- */
3969
+ WGS84 standard</a>. Values must be within normalized ranges. */
3964
3970
  export declare interface LatLng {
3965
3971
  /** The latitude in degrees. It must be in the range [-90.0, +90.0]. */
3966
3972
  latitude?: number;
@@ -4201,8 +4207,7 @@ export declare interface LiveCallbacks {
4201
4207
  All the content here will unconditionally be appended to the conversation
4202
4208
  history and used as part of the prompt to the model to generate content.
4203
4209
 
4204
- A message here will interrupt any current model generation.
4205
- */
4210
+ A message here will interrupt any current model generation. */
4206
4211
  export declare interface LiveClientContent {
4207
4212
  /** The content appended to the current conversation with the model.
4208
4213
 
@@ -4242,8 +4247,7 @@ export declare interface LiveClientMessage {
4242
4247
  - Even before the end of turn, the data is processed incrementally
4243
4248
  to optimize for a fast start of the response from the model.
4244
4249
  - Is always assumed to be the user's input (cannot be used to populate
4245
- conversation history).
4246
- */
4250
+ conversation history). */
4247
4251
  export declare interface LiveClientRealtimeInput {
4248
4252
  /** Inlined bytes data for media input. */
4249
4253
  mediaChunks?: Blob_2[];
@@ -4320,8 +4324,7 @@ export declare interface LiveClientSetup {
4320
4324
  Note that in the unary and server-streaming GenerateContent APIs function
4321
4325
  calling happens by exchanging the `Content` parts, while in the bidi
4322
4326
  GenerateContent APIs function calling happens over this dedicated set of
4323
- messages.
4324
- */
4327
+ messages. */
4325
4328
  export declare class LiveClientToolResponse {
4326
4329
  /** The response to the function calls. */
4327
4330
  functionResponses?: FunctionResponse[];
@@ -4601,8 +4604,7 @@ export declare enum LiveMusicPlaybackControl {
4601
4604
  /** Server update generated by the model in response to client messages.
4602
4605
 
4603
4606
  Content is generated as quickly as possible, and not in real time.
4604
- Clients may choose to buffer and play it out in real time.
4605
- */
4607
+ Clients may choose to buffer and play it out in real time. */
4606
4608
  export declare interface LiveMusicServerContent {
4607
4609
  /** The audio chunks that the model has generated. */
4608
4610
  audioChunks?: AudioChunk[];
@@ -4764,8 +4766,7 @@ export declare class LiveSendToolResponseParameters {
4764
4766
  /** Incremental server update generated by the model in response to client messages.
4765
4767
 
4766
4768
  Content is generated as quickly as possible, and not in real time. Clients
4767
- may choose to buffer and play it out in real time.
4768
- */
4769
+ may choose to buffer and play it out in real time. */
4769
4770
  export declare interface LiveServerContent {
4770
4771
  /** The content that the model has generated as part of the current conversation with the user. */
4771
4772
  modelTurn?: Content;
@@ -4846,8 +4847,7 @@ export declare class LiveServerMessage {
4846
4847
 
4847
4848
  /** Update of the session resumption state.
4848
4849
 
4849
- Only sent if `session_resumption` was set in the connection config.
4850
- */
4850
+ Only sent if `session_resumption` was set in the connection config. */
4851
4851
  export declare interface LiveServerSessionResumptionUpdate {
4852
4852
  /** New handle that represents state that can be resumed. Empty if `resumable`=false. */
4853
4853
  newHandle?: string;
@@ -4877,8 +4877,7 @@ export declare interface LiveServerToolCall {
4877
4877
 
4878
4878
  If there were side-effects to those tool calls, clients may attempt to undo
4879
4879
  the tool calls. This message occurs only in cases where the clients interrupt
4880
- server turns.
4881
- */
4880
+ server turns. */
4882
4881
  export declare interface LiveServerToolCallCancellation {
4883
4882
  /** The ids of the tool calls to be cancelled. */
4884
4883
  ids?: string[];
@@ -4929,8 +4928,7 @@ export declare interface MaskReferenceConfig {
4929
4928
 
4930
4929
  A mask image is an image whose non-zero values indicate where to edit the base
4931
4930
  image. If the user provides a mask image, the mask must be in the same
4932
- dimensions as the raw image.
4933
- */
4931
+ dimensions as the raw image. */
4934
4932
  export declare class MaskReferenceImage {
4935
4933
  /** The reference image for the editing operation. */
4936
4934
  referenceImage?: Image_2;
@@ -5694,8 +5692,7 @@ export declare class Pager<T> implements AsyncIterable<T> {
5694
5692
 
5695
5693
  Exactly one field within a Part should be set, representing the specific type
5696
5694
  of content being conveyed. Using multiple fields within the same `Part`
5697
- instance is considered invalid.
5698
- */
5695
+ instance is considered invalid. */
5699
5696
  export declare interface Part {
5700
5697
  /** Metadata for a given video. */
5701
5698
  videoMetadata?: VideoMetadata;
@@ -5870,8 +5867,7 @@ export declare interface RagRetrievalConfigRankingRankService {
5870
5867
 
5871
5868
  A raw reference image represents the base image to edit, provided by the user.
5872
5869
  It can optionally be provided in addition to a mask reference image or
5873
- a style reference image.
5874
- */
5870
+ a style reference image. */
5875
5871
  export declare class RawReferenceImage {
5876
5872
  /** The reference image for the editing operation. */
5877
5873
  referenceImage?: Image_2;
@@ -5886,8 +5882,7 @@ export declare class RawReferenceImage {
5886
5882
  /** Marks the end of user activity.
5887
5883
 
5888
5884
  This can only be sent if automatic (i.e. server-side) activity detection is
5889
- disabled.
5890
- */
5885
+ disabled. */
5891
5886
  export declare interface RealtimeInputConfig {
5892
5887
  /** If not set, automatic activity detection is enabled by default. If automatic voice detection is disabled, the client must send activity signals. */
5893
5888
  automaticActivityDetection?: AutomaticActivityDetection;
@@ -5931,6 +5926,8 @@ export declare interface RecontextImageConfig {
5931
5926
  outputCompressionQuality?: number;
5932
5927
  /** Whether to use the prompt rewriting logic. */
5933
5928
  enhancePrompt?: boolean;
5929
+ /** User specified labels to track billing usage. */
5930
+ labels?: Record<string, string>;
5934
5931
  }
5935
5932
 
5936
5933
  /** The parameters for recontextualizing an image. */
@@ -6144,8 +6141,7 @@ export declare enum Scale {
6144
6141
 
6145
6142
  Represents a select subset of an [OpenAPI 3.0 schema
6146
6143
  object](https://spec.openapis.org/oas/v3.0.3#schema-object). More fields may
6147
- be added in the future as needed.
6148
- */
6144
+ be added in the future as needed. */
6149
6145
  export declare interface Schema {
6150
6146
  /** Optional. The value should be validated against any (one or more) of the subschemas in the list. */
6151
6147
  anyOf?: Schema[];
@@ -6250,6 +6246,8 @@ export declare interface SegmentImageConfig {
6250
6246
  can be set to a decimal value between 0 and 255 non-inclusive.
6251
6247
  Set to -1 for no binary color thresholding. */
6252
6248
  binaryColorThreshold?: number;
6249
+ /** User specified labels to track billing usage. */
6250
+ labels?: Record<string, string>;
6253
6251
  }
6254
6252
 
6255
6253
  /** The parameters for segmenting an image. */
@@ -6293,8 +6291,7 @@ export declare enum SegmentMode {
6293
6291
 
6294
6292
  /** Parameters for sending a message within a chat session.
6295
6293
 
6296
- These parameters are used with the `chat.sendMessage()` method.
6297
- */
6294
+ These parameters are used with the `chat.sendMessage()` method. */
6298
6295
  export declare interface SendMessageParameters {
6299
6296
  /** The message to send to the model.
6300
6297
 
@@ -6440,8 +6437,7 @@ export declare class Session {
6440
6437
  /** Configuration of session resumption mechanism.
6441
6438
 
6442
6439
  Included in `LiveConnectConfig.session_resumption`. If included server
6443
- will send `LiveServerSessionResumptionUpdate` messages.
6444
- */
6440
+ will send `LiveServerSessionResumptionUpdate` messages. */
6445
6441
  export declare interface SessionResumptionConfig {
6446
6442
  /** Session resumption handle of previous session (session to restore).
6447
6443
 
@@ -6488,8 +6484,7 @@ export declare class SingleEmbedContentResponse {
6488
6484
  Context window will always be cut at start of USER role turn. System
6489
6485
  instructions and `BidiGenerateContentSetup.prefix_turns` will not be
6490
6486
  subject to the sliding window mechanism, they will always stay at the
6491
- beginning of context window.
6492
- */
6487
+ beginning of context window. */
6493
6488
  export declare interface SlidingWindow {
6494
6489
  /** Session reduction target -- how many tokens we should keep. Window shortening operation has some latency costs, so we should avoid running it on every turn. Should be < trigger_tokens. If not set, trigger_tokens/2 is assumed. */
6495
6490
  targetTokens?: string;
@@ -6549,8 +6544,7 @@ export declare interface StyleReferenceConfig {
6549
6544
  additionally optional config parameters for the style reference image.
6550
6545
 
6551
6546
  A raw reference image can also be provided as a destination for the style to
6552
- be applied to.
6553
- */
6547
+ be applied to. */
6554
6548
  export declare class StyleReferenceImage {
6555
6549
  /** The reference image for the editing operation. */
6556
6550
  referenceImage?: Image_2;
@@ -6578,8 +6572,7 @@ export declare interface SubjectReferenceConfig {
6578
6572
  additionally optional config parameters for the subject reference image.
6579
6573
 
6580
6574
  A raw reference image can also be provided as a destination for the subject to
6581
- be applied to.
6582
- */
6575
+ be applied to. */
6583
6576
  export declare class SubjectReferenceImage {
6584
6577
  /** The reference image for the editing operation. */
6585
6578
  referenceImage?: Image_2;
@@ -6857,8 +6850,7 @@ export declare interface ToolCodeExecution {
6857
6850
 
6858
6851
  /** Tool config.
6859
6852
 
6860
- This config is shared for all tools provided in the request.
6861
- */
6853
+ This config is shared for all tools provided in the request. */
6862
6854
  export declare interface ToolConfig {
6863
6855
  /** Optional. Function calling config. */
6864
6856
  functionCallingConfig?: FunctionCallingConfig;
@@ -7191,6 +7183,8 @@ export declare enum Type {
7191
7183
 
7192
7184
  declare namespace types {
7193
7185
  export {
7186
+ createFunctionResponsePartFromBase64,
7187
+ createFunctionResponsePartFromUri,
7194
7188
  createPartFromUri,
7195
7189
  createPartFromText,
7196
7190
  createPartFromFunctionCall,
@@ -7690,8 +7684,7 @@ export declare interface UploadFileParameters {
7690
7684
 
7691
7685
  For more information on this configuration, refer to
7692
7686
  the `Imagen API reference documentation
7693
- <https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api>`_.
7694
- */
7687
+ <https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api>`_. */
7695
7688
  export declare interface UpscaleImageConfig {
7696
7689
  /** Used to override HTTP request options. */
7697
7690
  httpOptions?: HttpOptions;
@@ -7721,6 +7714,8 @@ export declare interface UpscaleImageConfig {
7721
7714
  output image will have be more different from the input image, but
7722
7715
  with finer details and less noise. */
7723
7716
  imagePreservationFactor?: number;
7717
+ /** User specified labels to track billing usage. */
7718
+ labels?: Record<string, string>;
7724
7719
  }
7725
7720
 
7726
7721
  /** User-facing config UpscaleImageParameters. */