@google/genai 1.22.0 → 1.24.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.
@@ -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;
@@ -3427,6 +3435,8 @@ export declare interface GoogleGenAIOptions {
3427
3435
  export declare interface GoogleMaps {
3428
3436
  /** Optional. Auth config for the Google Maps tool. */
3429
3437
  authConfig?: AuthConfig;
3438
+ /** Optional. If true, include the widget context token in the response. */
3439
+ enableWidget?: boolean;
3430
3440
  }
3431
3441
 
3432
3442
  /** The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors). */
@@ -3520,6 +3530,10 @@ export declare interface GroundingChunkMapsPlaceAnswerSourcesReviewSnippet {
3520
3530
  relativePublishTimeDescription?: string;
3521
3531
  /** A reference representing this place review which may be used to look up this place review again. */
3522
3532
  review?: string;
3533
+ /** Id of the review referencing the place. */
3534
+ reviewId?: string;
3535
+ /** Title of the review. */
3536
+ title?: string;
3523
3537
  }
3524
3538
 
3525
3539
  /** Chunk from context retrieved by the retrieval tools. */
@@ -3560,10 +3574,20 @@ export declare interface GroundingMetadata {
3560
3574
  retrievalQueries?: string[];
3561
3575
  /** Optional. Google search entry for the following-up web searches. */
3562
3576
  searchEntryPoint?: SearchEntryPoint;
3577
+ /** Optional. Output only. List of source flagging uris. This is currently populated only for Google Maps grounding. */
3578
+ sourceFlaggingUris?: GroundingMetadataSourceFlaggingUri[];
3563
3579
  /** Optional. Web search queries for the following-up web search. */
3564
3580
  webSearchQueries?: string[];
3565
3581
  }
3566
3582
 
3583
+ /** Source content flagging uri for a place or review. This is currently populated only for Google Maps grounding. */
3584
+ export declare interface GroundingMetadataSourceFlaggingUri {
3585
+ /** A link where users can flag a problem with the source (place or review). */
3586
+ flagContentUri?: string;
3587
+ /** Id of the place or review. */
3588
+ sourceId?: string;
3589
+ }
3590
+
3567
3591
  /** Grounding support. */
3568
3592
  export declare interface GroundingSupport {
3569
3593
  /** Confidence score of the support references. Ranges from 0 to 1. 1 is the most confident. For Gemini 2.0 and before, this list must have the same size as the grounding_chunk_indices. For Gemini 2.5 and after, this list will be empty and should be ignored. */
@@ -3863,6 +3887,8 @@ export declare interface InlinedRequest {
3863
3887
  /** Content of the request.
3864
3888
  */
3865
3889
  contents?: ContentListUnion;
3890
+ /** The metadata to be associated with the request. */
3891
+ metadata?: Record<string, string>;
3866
3892
  /** Configuration that contains optional model parameters.
3867
3893
  */
3868
3894
  config?: GenerateContentConfig;
@@ -3883,8 +3909,7 @@ export declare class InlinedResponse {
3883
3909
  The start time must be less than or equal to the end time.
3884
3910
  When the start equals the end time, the interval is an empty interval.
3885
3911
  (matches no time)
3886
- When both start and end are unspecified, the interval matches any time.
3887
- */
3912
+ When both start and end are unspecified, the interval matches any time. */
3888
3913
  export declare interface Interval {
3889
3914
  /** The start time of the interval. */
3890
3915
  startTime?: string;
@@ -3971,8 +3996,7 @@ export declare enum Language {
3971
3996
  This is expressed as a pair of doubles to represent degrees latitude and
3972
3997
  degrees longitude. Unless specified otherwise, this object must conform to the
3973
3998
  <a href="https://en.wikipedia.org/wiki/World_Geodetic_System#1984_version">
3974
- WGS84 standard</a>. Values must be within normalized ranges.
3975
- */
3999
+ WGS84 standard</a>. Values must be within normalized ranges. */
3976
4000
  export declare interface LatLng {
3977
4001
  /** The latitude in degrees. It must be in the range [-90.0, +90.0]. */
3978
4002
  latitude?: number;
@@ -4213,8 +4237,7 @@ export declare interface LiveCallbacks {
4213
4237
  All the content here will unconditionally be appended to the conversation
4214
4238
  history and used as part of the prompt to the model to generate content.
4215
4239
 
4216
- A message here will interrupt any current model generation.
4217
- */
4240
+ A message here will interrupt any current model generation. */
4218
4241
  export declare interface LiveClientContent {
4219
4242
  /** The content appended to the current conversation with the model.
4220
4243
 
@@ -4254,8 +4277,7 @@ export declare interface LiveClientMessage {
4254
4277
  - Even before the end of turn, the data is processed incrementally
4255
4278
  to optimize for a fast start of the response from the model.
4256
4279
  - Is always assumed to be the user's input (cannot be used to populate
4257
- conversation history).
4258
- */
4280
+ conversation history). */
4259
4281
  export declare interface LiveClientRealtimeInput {
4260
4282
  /** Inlined bytes data for media input. */
4261
4283
  mediaChunks?: Blob_2[];
@@ -4332,8 +4354,7 @@ export declare interface LiveClientSetup {
4332
4354
  Note that in the unary and server-streaming GenerateContent APIs function
4333
4355
  calling happens by exchanging the `Content` parts, while in the bidi
4334
4356
  GenerateContent APIs function calling happens over this dedicated set of
4335
- messages.
4336
- */
4357
+ messages. */
4337
4358
  export declare class LiveClientToolResponse {
4338
4359
  /** The response to the function calls. */
4339
4360
  functionResponses?: FunctionResponse[];
@@ -4613,8 +4634,7 @@ export declare enum LiveMusicPlaybackControl {
4613
4634
  /** Server update generated by the model in response to client messages.
4614
4635
 
4615
4636
  Content is generated as quickly as possible, and not in real time.
4616
- Clients may choose to buffer and play it out in real time.
4617
- */
4637
+ Clients may choose to buffer and play it out in real time. */
4618
4638
  export declare interface LiveMusicServerContent {
4619
4639
  /** The audio chunks that the model has generated. */
4620
4640
  audioChunks?: AudioChunk[];
@@ -4776,8 +4796,7 @@ export declare class LiveSendToolResponseParameters {
4776
4796
  /** Incremental server update generated by the model in response to client messages.
4777
4797
 
4778
4798
  Content is generated as quickly as possible, and not in real time. Clients
4779
- may choose to buffer and play it out in real time.
4780
- */
4799
+ may choose to buffer and play it out in real time. */
4781
4800
  export declare interface LiveServerContent {
4782
4801
  /** The content that the model has generated as part of the current conversation with the user. */
4783
4802
  modelTurn?: Content;
@@ -4858,8 +4877,7 @@ export declare class LiveServerMessage {
4858
4877
 
4859
4878
  /** Update of the session resumption state.
4860
4879
 
4861
- Only sent if `session_resumption` was set in the connection config.
4862
- */
4880
+ Only sent if `session_resumption` was set in the connection config. */
4863
4881
  export declare interface LiveServerSessionResumptionUpdate {
4864
4882
  /** New handle that represents state that can be resumed. Empty if `resumable`=false. */
4865
4883
  newHandle?: string;
@@ -4889,8 +4907,7 @@ export declare interface LiveServerToolCall {
4889
4907
 
4890
4908
  If there were side-effects to those tool calls, clients may attempt to undo
4891
4909
  the tool calls. This message occurs only in cases where the clients interrupt
4892
- server turns.
4893
- */
4910
+ server turns. */
4894
4911
  export declare interface LiveServerToolCallCancellation {
4895
4912
  /** The ids of the tool calls to be cancelled. */
4896
4913
  ids?: string[];
@@ -4941,8 +4958,7 @@ export declare interface MaskReferenceConfig {
4941
4958
 
4942
4959
  A mask image is an image whose non-zero values indicate where to edit the base
4943
4960
  image. If the user provides a mask image, the mask must be in the same
4944
- dimensions as the raw image.
4945
- */
4961
+ dimensions as the raw image. */
4946
4962
  export declare class MaskReferenceImage {
4947
4963
  /** The reference image for the editing operation. */
4948
4964
  referenceImage?: Image_2;
@@ -5706,8 +5722,7 @@ export declare class Pager<T> implements AsyncIterable<T> {
5706
5722
 
5707
5723
  Exactly one field within a Part should be set, representing the specific type
5708
5724
  of content being conveyed. Using multiple fields within the same `Part`
5709
- instance is considered invalid.
5710
- */
5725
+ instance is considered invalid. */
5711
5726
  export declare interface Part {
5712
5727
  /** Metadata for a given video. */
5713
5728
  videoMetadata?: VideoMetadata;
@@ -5882,8 +5897,7 @@ export declare interface RagRetrievalConfigRankingRankService {
5882
5897
 
5883
5898
  A raw reference image represents the base image to edit, provided by the user.
5884
5899
  It can optionally be provided in addition to a mask reference image or
5885
- a style reference image.
5886
- */
5900
+ a style reference image. */
5887
5901
  export declare class RawReferenceImage {
5888
5902
  /** The reference image for the editing operation. */
5889
5903
  referenceImage?: Image_2;
@@ -5898,8 +5912,7 @@ export declare class RawReferenceImage {
5898
5912
  /** Marks the end of user activity.
5899
5913
 
5900
5914
  This can only be sent if automatic (i.e. server-side) activity detection is
5901
- disabled.
5902
- */
5915
+ disabled. */
5903
5916
  export declare interface RealtimeInputConfig {
5904
5917
  /** If not set, automatic activity detection is enabled by default. If automatic voice detection is disabled, the client must send activity signals. */
5905
5918
  automaticActivityDetection?: AutomaticActivityDetection;
@@ -5943,6 +5956,8 @@ export declare interface RecontextImageConfig {
5943
5956
  outputCompressionQuality?: number;
5944
5957
  /** Whether to use the prompt rewriting logic. */
5945
5958
  enhancePrompt?: boolean;
5959
+ /** User specified labels to track billing usage. */
5960
+ labels?: Record<string, string>;
5946
5961
  }
5947
5962
 
5948
5963
  /** The parameters for recontextualizing an image. */
@@ -6156,8 +6171,7 @@ export declare enum Scale {
6156
6171
 
6157
6172
  Represents a select subset of an [OpenAPI 3.0 schema
6158
6173
  object](https://spec.openapis.org/oas/v3.0.3#schema-object). More fields may
6159
- be added in the future as needed.
6160
- */
6174
+ be added in the future as needed. */
6161
6175
  export declare interface Schema {
6162
6176
  /** Optional. The value should be validated against any (one or more) of the subschemas in the list. */
6163
6177
  anyOf?: Schema[];
@@ -6262,6 +6276,8 @@ export declare interface SegmentImageConfig {
6262
6276
  can be set to a decimal value between 0 and 255 non-inclusive.
6263
6277
  Set to -1 for no binary color thresholding. */
6264
6278
  binaryColorThreshold?: number;
6279
+ /** User specified labels to track billing usage. */
6280
+ labels?: Record<string, string>;
6265
6281
  }
6266
6282
 
6267
6283
  /** The parameters for segmenting an image. */
@@ -6305,8 +6321,7 @@ export declare enum SegmentMode {
6305
6321
 
6306
6322
  /** Parameters for sending a message within a chat session.
6307
6323
 
6308
- These parameters are used with the `chat.sendMessage()` method.
6309
- */
6324
+ These parameters are used with the `chat.sendMessage()` method. */
6310
6325
  export declare interface SendMessageParameters {
6311
6326
  /** The message to send to the model.
6312
6327
 
@@ -6452,8 +6467,7 @@ export declare class Session {
6452
6467
  /** Configuration of session resumption mechanism.
6453
6468
 
6454
6469
  Included in `LiveConnectConfig.session_resumption`. If included server
6455
- will send `LiveServerSessionResumptionUpdate` messages.
6456
- */
6470
+ will send `LiveServerSessionResumptionUpdate` messages. */
6457
6471
  export declare interface SessionResumptionConfig {
6458
6472
  /** Session resumption handle of previous session (session to restore).
6459
6473
 
@@ -6500,8 +6514,7 @@ export declare class SingleEmbedContentResponse {
6500
6514
  Context window will always be cut at start of USER role turn. System
6501
6515
  instructions and `BidiGenerateContentSetup.prefix_turns` will not be
6502
6516
  subject to the sliding window mechanism, they will always stay at the
6503
- beginning of context window.
6504
- */
6517
+ beginning of context window. */
6505
6518
  export declare interface SlidingWindow {
6506
6519
  /** 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. */
6507
6520
  targetTokens?: string;
@@ -6561,8 +6574,7 @@ export declare interface StyleReferenceConfig {
6561
6574
  additionally optional config parameters for the style reference image.
6562
6575
 
6563
6576
  A raw reference image can also be provided as a destination for the style to
6564
- be applied to.
6565
- */
6577
+ be applied to. */
6566
6578
  export declare class StyleReferenceImage {
6567
6579
  /** The reference image for the editing operation. */
6568
6580
  referenceImage?: Image_2;
@@ -6590,8 +6602,7 @@ export declare interface SubjectReferenceConfig {
6590
6602
  additionally optional config parameters for the subject reference image.
6591
6603
 
6592
6604
  A raw reference image can also be provided as a destination for the subject to
6593
- be applied to.
6594
- */
6605
+ be applied to. */
6595
6606
  export declare class SubjectReferenceImage {
6596
6607
  /** The reference image for the editing operation. */
6597
6608
  referenceImage?: Image_2;
@@ -6869,8 +6880,7 @@ export declare interface ToolCodeExecution {
6869
6880
 
6870
6881
  /** Tool config.
6871
6882
 
6872
- This config is shared for all tools provided in the request.
6873
- */
6883
+ This config is shared for all tools provided in the request. */
6874
6884
  export declare interface ToolConfig {
6875
6885
  /** Optional. Function calling config. */
6876
6886
  functionCallingConfig?: FunctionCallingConfig;
@@ -7203,6 +7213,8 @@ export declare enum Type {
7203
7213
 
7204
7214
  declare namespace types {
7205
7215
  export {
7216
+ createFunctionResponsePartFromBase64,
7217
+ createFunctionResponsePartFromUri,
7206
7218
  createPartFromUri,
7207
7219
  createPartFromText,
7208
7220
  createPartFromFunctionCall,
@@ -7347,6 +7359,7 @@ declare namespace types {
7347
7359
  GroundingSupport,
7348
7360
  RetrievalMetadata,
7349
7361
  SearchEntryPoint,
7362
+ GroundingMetadataSourceFlaggingUri,
7350
7363
  GroundingMetadata,
7351
7364
  LogprobsResultCandidate,
7352
7365
  LogprobsResultTopCandidates,
@@ -7702,8 +7715,7 @@ export declare interface UploadFileParameters {
7702
7715
 
7703
7716
  For more information on this configuration, refer to
7704
7717
  the `Imagen API reference documentation
7705
- <https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api>`_.
7706
- */
7718
+ <https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api>`_. */
7707
7719
  export declare interface UpscaleImageConfig {
7708
7720
  /** Used to override HTTP request options. */
7709
7721
  httpOptions?: HttpOptions;
@@ -7733,6 +7745,8 @@ export declare interface UpscaleImageConfig {
7733
7745
  output image will have be more different from the input image, but
7734
7746
  with finer details and less noise. */
7735
7747
  imagePreservationFactor?: number;
7748
+ /** User specified labels to track billing usage. */
7749
+ labels?: Record<string, string>;
7736
7750
  }
7737
7751
 
7738
7752
  /** User-facing config UpscaleImageParameters. */