@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.
package/dist/web/web.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;
@@ -3420,6 +3428,8 @@ export declare interface GoogleGenAIOptions {
3420
3428
  export declare interface GoogleMaps {
3421
3429
  /** Optional. Auth config for the Google Maps tool. */
3422
3430
  authConfig?: AuthConfig;
3431
+ /** Optional. If true, include the widget context token in the response. */
3432
+ enableWidget?: boolean;
3423
3433
  }
3424
3434
 
3425
3435
  /** 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). */
@@ -3513,6 +3523,10 @@ export declare interface GroundingChunkMapsPlaceAnswerSourcesReviewSnippet {
3513
3523
  relativePublishTimeDescription?: string;
3514
3524
  /** A reference representing this place review which may be used to look up this place review again. */
3515
3525
  review?: string;
3526
+ /** Id of the review referencing the place. */
3527
+ reviewId?: string;
3528
+ /** Title of the review. */
3529
+ title?: string;
3516
3530
  }
3517
3531
 
3518
3532
  /** Chunk from context retrieved by the retrieval tools. */
@@ -3553,10 +3567,20 @@ export declare interface GroundingMetadata {
3553
3567
  retrievalQueries?: string[];
3554
3568
  /** Optional. Google search entry for the following-up web searches. */
3555
3569
  searchEntryPoint?: SearchEntryPoint;
3570
+ /** Optional. Output only. List of source flagging uris. This is currently populated only for Google Maps grounding. */
3571
+ sourceFlaggingUris?: GroundingMetadataSourceFlaggingUri[];
3556
3572
  /** Optional. Web search queries for the following-up web search. */
3557
3573
  webSearchQueries?: string[];
3558
3574
  }
3559
3575
 
3576
+ /** Source content flagging uri for a place or review. This is currently populated only for Google Maps grounding. */
3577
+ export declare interface GroundingMetadataSourceFlaggingUri {
3578
+ /** A link where users can flag a problem with the source (place or review). */
3579
+ flagContentUri?: string;
3580
+ /** Id of the place or review. */
3581
+ sourceId?: string;
3582
+ }
3583
+
3560
3584
  /** Grounding support. */
3561
3585
  export declare interface GroundingSupport {
3562
3586
  /** 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. */
@@ -3856,6 +3880,8 @@ export declare interface InlinedRequest {
3856
3880
  /** Content of the request.
3857
3881
  */
3858
3882
  contents?: ContentListUnion;
3883
+ /** The metadata to be associated with the request. */
3884
+ metadata?: Record<string, string>;
3859
3885
  /** Configuration that contains optional model parameters.
3860
3886
  */
3861
3887
  config?: GenerateContentConfig;
@@ -3876,8 +3902,7 @@ export declare class InlinedResponse {
3876
3902
  The start time must be less than or equal to the end time.
3877
3903
  When the start equals the end time, the interval is an empty interval.
3878
3904
  (matches no time)
3879
- When both start and end are unspecified, the interval matches any time.
3880
- */
3905
+ When both start and end are unspecified, the interval matches any time. */
3881
3906
  export declare interface Interval {
3882
3907
  /** The start time of the interval. */
3883
3908
  startTime?: string;
@@ -3964,8 +3989,7 @@ export declare enum Language {
3964
3989
  This is expressed as a pair of doubles to represent degrees latitude and
3965
3990
  degrees longitude. Unless specified otherwise, this object must conform to the
3966
3991
  <a href="https://en.wikipedia.org/wiki/World_Geodetic_System#1984_version">
3967
- WGS84 standard</a>. Values must be within normalized ranges.
3968
- */
3992
+ WGS84 standard</a>. Values must be within normalized ranges. */
3969
3993
  export declare interface LatLng {
3970
3994
  /** The latitude in degrees. It must be in the range [-90.0, +90.0]. */
3971
3995
  latitude?: number;
@@ -4206,8 +4230,7 @@ export declare interface LiveCallbacks {
4206
4230
  All the content here will unconditionally be appended to the conversation
4207
4231
  history and used as part of the prompt to the model to generate content.
4208
4232
 
4209
- A message here will interrupt any current model generation.
4210
- */
4233
+ A message here will interrupt any current model generation. */
4211
4234
  export declare interface LiveClientContent {
4212
4235
  /** The content appended to the current conversation with the model.
4213
4236
 
@@ -4247,8 +4270,7 @@ export declare interface LiveClientMessage {
4247
4270
  - Even before the end of turn, the data is processed incrementally
4248
4271
  to optimize for a fast start of the response from the model.
4249
4272
  - Is always assumed to be the user's input (cannot be used to populate
4250
- conversation history).
4251
- */
4273
+ conversation history). */
4252
4274
  export declare interface LiveClientRealtimeInput {
4253
4275
  /** Inlined bytes data for media input. */
4254
4276
  mediaChunks?: Blob_2[];
@@ -4325,8 +4347,7 @@ export declare interface LiveClientSetup {
4325
4347
  Note that in the unary and server-streaming GenerateContent APIs function
4326
4348
  calling happens by exchanging the `Content` parts, while in the bidi
4327
4349
  GenerateContent APIs function calling happens over this dedicated set of
4328
- messages.
4329
- */
4350
+ messages. */
4330
4351
  export declare class LiveClientToolResponse {
4331
4352
  /** The response to the function calls. */
4332
4353
  functionResponses?: FunctionResponse[];
@@ -4606,8 +4627,7 @@ export declare enum LiveMusicPlaybackControl {
4606
4627
  /** Server update generated by the model in response to client messages.
4607
4628
 
4608
4629
  Content is generated as quickly as possible, and not in real time.
4609
- Clients may choose to buffer and play it out in real time.
4610
- */
4630
+ Clients may choose to buffer and play it out in real time. */
4611
4631
  export declare interface LiveMusicServerContent {
4612
4632
  /** The audio chunks that the model has generated. */
4613
4633
  audioChunks?: AudioChunk[];
@@ -4769,8 +4789,7 @@ export declare class LiveSendToolResponseParameters {
4769
4789
  /** Incremental server update generated by the model in response to client messages.
4770
4790
 
4771
4791
  Content is generated as quickly as possible, and not in real time. Clients
4772
- may choose to buffer and play it out in real time.
4773
- */
4792
+ may choose to buffer and play it out in real time. */
4774
4793
  export declare interface LiveServerContent {
4775
4794
  /** The content that the model has generated as part of the current conversation with the user. */
4776
4795
  modelTurn?: Content;
@@ -4851,8 +4870,7 @@ export declare class LiveServerMessage {
4851
4870
 
4852
4871
  /** Update of the session resumption state.
4853
4872
 
4854
- Only sent if `session_resumption` was set in the connection config.
4855
- */
4873
+ Only sent if `session_resumption` was set in the connection config. */
4856
4874
  export declare interface LiveServerSessionResumptionUpdate {
4857
4875
  /** New handle that represents state that can be resumed. Empty if `resumable`=false. */
4858
4876
  newHandle?: string;
@@ -4882,8 +4900,7 @@ export declare interface LiveServerToolCall {
4882
4900
 
4883
4901
  If there were side-effects to those tool calls, clients may attempt to undo
4884
4902
  the tool calls. This message occurs only in cases where the clients interrupt
4885
- server turns.
4886
- */
4903
+ server turns. */
4887
4904
  export declare interface LiveServerToolCallCancellation {
4888
4905
  /** The ids of the tool calls to be cancelled. */
4889
4906
  ids?: string[];
@@ -4934,8 +4951,7 @@ export declare interface MaskReferenceConfig {
4934
4951
 
4935
4952
  A mask image is an image whose non-zero values indicate where to edit the base
4936
4953
  image. If the user provides a mask image, the mask must be in the same
4937
- dimensions as the raw image.
4938
- */
4954
+ dimensions as the raw image. */
4939
4955
  export declare class MaskReferenceImage {
4940
4956
  /** The reference image for the editing operation. */
4941
4957
  referenceImage?: Image_2;
@@ -5699,8 +5715,7 @@ export declare class Pager<T> implements AsyncIterable<T> {
5699
5715
 
5700
5716
  Exactly one field within a Part should be set, representing the specific type
5701
5717
  of content being conveyed. Using multiple fields within the same `Part`
5702
- instance is considered invalid.
5703
- */
5718
+ instance is considered invalid. */
5704
5719
  export declare interface Part {
5705
5720
  /** Metadata for a given video. */
5706
5721
  videoMetadata?: VideoMetadata;
@@ -5875,8 +5890,7 @@ export declare interface RagRetrievalConfigRankingRankService {
5875
5890
 
5876
5891
  A raw reference image represents the base image to edit, provided by the user.
5877
5892
  It can optionally be provided in addition to a mask reference image or
5878
- a style reference image.
5879
- */
5893
+ a style reference image. */
5880
5894
  export declare class RawReferenceImage {
5881
5895
  /** The reference image for the editing operation. */
5882
5896
  referenceImage?: Image_2;
@@ -5891,8 +5905,7 @@ export declare class RawReferenceImage {
5891
5905
  /** Marks the end of user activity.
5892
5906
 
5893
5907
  This can only be sent if automatic (i.e. server-side) activity detection is
5894
- disabled.
5895
- */
5908
+ disabled. */
5896
5909
  export declare interface RealtimeInputConfig {
5897
5910
  /** If not set, automatic activity detection is enabled by default. If automatic voice detection is disabled, the client must send activity signals. */
5898
5911
  automaticActivityDetection?: AutomaticActivityDetection;
@@ -5936,6 +5949,8 @@ export declare interface RecontextImageConfig {
5936
5949
  outputCompressionQuality?: number;
5937
5950
  /** Whether to use the prompt rewriting logic. */
5938
5951
  enhancePrompt?: boolean;
5952
+ /** User specified labels to track billing usage. */
5953
+ labels?: Record<string, string>;
5939
5954
  }
5940
5955
 
5941
5956
  /** The parameters for recontextualizing an image. */
@@ -6149,8 +6164,7 @@ export declare enum Scale {
6149
6164
 
6150
6165
  Represents a select subset of an [OpenAPI 3.0 schema
6151
6166
  object](https://spec.openapis.org/oas/v3.0.3#schema-object). More fields may
6152
- be added in the future as needed.
6153
- */
6167
+ be added in the future as needed. */
6154
6168
  export declare interface Schema {
6155
6169
  /** Optional. The value should be validated against any (one or more) of the subschemas in the list. */
6156
6170
  anyOf?: Schema[];
@@ -6255,6 +6269,8 @@ export declare interface SegmentImageConfig {
6255
6269
  can be set to a decimal value between 0 and 255 non-inclusive.
6256
6270
  Set to -1 for no binary color thresholding. */
6257
6271
  binaryColorThreshold?: number;
6272
+ /** User specified labels to track billing usage. */
6273
+ labels?: Record<string, string>;
6258
6274
  }
6259
6275
 
6260
6276
  /** The parameters for segmenting an image. */
@@ -6298,8 +6314,7 @@ export declare enum SegmentMode {
6298
6314
 
6299
6315
  /** Parameters for sending a message within a chat session.
6300
6316
 
6301
- These parameters are used with the `chat.sendMessage()` method.
6302
- */
6317
+ These parameters are used with the `chat.sendMessage()` method. */
6303
6318
  export declare interface SendMessageParameters {
6304
6319
  /** The message to send to the model.
6305
6320
 
@@ -6445,8 +6460,7 @@ export declare class Session {
6445
6460
  /** Configuration of session resumption mechanism.
6446
6461
 
6447
6462
  Included in `LiveConnectConfig.session_resumption`. If included server
6448
- will send `LiveServerSessionResumptionUpdate` messages.
6449
- */
6463
+ will send `LiveServerSessionResumptionUpdate` messages. */
6450
6464
  export declare interface SessionResumptionConfig {
6451
6465
  /** Session resumption handle of previous session (session to restore).
6452
6466
 
@@ -6493,8 +6507,7 @@ export declare class SingleEmbedContentResponse {
6493
6507
  Context window will always be cut at start of USER role turn. System
6494
6508
  instructions and `BidiGenerateContentSetup.prefix_turns` will not be
6495
6509
  subject to the sliding window mechanism, they will always stay at the
6496
- beginning of context window.
6497
- */
6510
+ beginning of context window. */
6498
6511
  export declare interface SlidingWindow {
6499
6512
  /** 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. */
6500
6513
  targetTokens?: string;
@@ -6554,8 +6567,7 @@ export declare interface StyleReferenceConfig {
6554
6567
  additionally optional config parameters for the style reference image.
6555
6568
 
6556
6569
  A raw reference image can also be provided as a destination for the style to
6557
- be applied to.
6558
- */
6570
+ be applied to. */
6559
6571
  export declare class StyleReferenceImage {
6560
6572
  /** The reference image for the editing operation. */
6561
6573
  referenceImage?: Image_2;
@@ -6583,8 +6595,7 @@ export declare interface SubjectReferenceConfig {
6583
6595
  additionally optional config parameters for the subject reference image.
6584
6596
 
6585
6597
  A raw reference image can also be provided as a destination for the subject to
6586
- be applied to.
6587
- */
6598
+ be applied to. */
6588
6599
  export declare class SubjectReferenceImage {
6589
6600
  /** The reference image for the editing operation. */
6590
6601
  referenceImage?: Image_2;
@@ -6862,8 +6873,7 @@ export declare interface ToolCodeExecution {
6862
6873
 
6863
6874
  /** Tool config.
6864
6875
 
6865
- This config is shared for all tools provided in the request.
6866
- */
6876
+ This config is shared for all tools provided in the request. */
6867
6877
  export declare interface ToolConfig {
6868
6878
  /** Optional. Function calling config. */
6869
6879
  functionCallingConfig?: FunctionCallingConfig;
@@ -7196,6 +7206,8 @@ export declare enum Type {
7196
7206
 
7197
7207
  declare namespace types {
7198
7208
  export {
7209
+ createFunctionResponsePartFromBase64,
7210
+ createFunctionResponsePartFromUri,
7199
7211
  createPartFromUri,
7200
7212
  createPartFromText,
7201
7213
  createPartFromFunctionCall,
@@ -7340,6 +7352,7 @@ declare namespace types {
7340
7352
  GroundingSupport,
7341
7353
  RetrievalMetadata,
7342
7354
  SearchEntryPoint,
7355
+ GroundingMetadataSourceFlaggingUri,
7343
7356
  GroundingMetadata,
7344
7357
  LogprobsResultCandidate,
7345
7358
  LogprobsResultTopCandidates,
@@ -7695,8 +7708,7 @@ export declare interface UploadFileParameters {
7695
7708
 
7696
7709
  For more information on this configuration, refer to
7697
7710
  the `Imagen API reference documentation
7698
- <https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api>`_.
7699
- */
7711
+ <https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/imagen-api>`_. */
7700
7712
  export declare interface UpscaleImageConfig {
7701
7713
  /** Used to override HTTP request options. */
7702
7714
  httpOptions?: HttpOptions;
@@ -7726,6 +7738,8 @@ export declare interface UpscaleImageConfig {
7726
7738
  output image will have be more different from the input image, but
7727
7739
  with finer details and less noise. */
7728
7740
  imagePreservationFactor?: number;
7741
+ /** User specified labels to track billing usage. */
7742
+ labels?: Record<string, string>;
7729
7743
  }
7730
7744
 
7731
7745
  /** User-facing config UpscaleImageParameters. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google/genai",
3
- "version": "1.22.0",
3
+ "version": "1.24.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/node/index.mjs",