@google/genai 1.0.1 → 1.2.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
@@ -1282,15 +1282,15 @@ export declare interface DistillationHyperParameters {
1282
1282
 
1283
1283
  /** Tuning Spec for Distillation. */
1284
1284
  export declare interface DistillationSpec {
1285
- /** The base teacher model that is being distilled, e.g., "gemini-1.0-pro-002". */
1285
+ /** The base teacher model that is being distilled. See [Supported models](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/tuning#supported_models). */
1286
1286
  baseTeacherModel?: string;
1287
1287
  /** Optional. Hyperparameters for Distillation. */
1288
1288
  hyperParameters?: DistillationHyperParameters;
1289
- /** Required. A path in a Cloud Storage bucket, which will be treated as the root output directory of the distillation pipeline. It is used by the system to generate the paths of output artifacts. */
1289
+ /** Deprecated. A path in a Cloud Storage bucket, which will be treated as the root output directory of the distillation pipeline. It is used by the system to generate the paths of output artifacts. */
1290
1290
  pipelineRootDirectory?: string;
1291
- /** The student model that is being tuned, e.g., "google/gemma-2b-1.1-it". */
1291
+ /** The student model that is being tuned, e.g., "google/gemma-2b-1.1-it". Deprecated. Use base_model instead. */
1292
1292
  studentModel?: string;
1293
- /** Required. Cloud Storage path to file containing training dataset for tuning. The dataset must be formatted as a JSONL file. */
1293
+ /** Deprecated. Cloud Storage path to file containing training dataset for tuning. The dataset must be formatted as a JSONL file. */
1294
1294
  trainingDatasetUri?: string;
1295
1295
  /** The resource name of the Tuned teacher model. Format: `projects/{project}/locations/{location}/models/{model}`. */
1296
1296
  tunedTeacherModelSource?: string;
@@ -1619,6 +1619,8 @@ export { File_2 as File }
1619
1619
 
1620
1620
  /** URI based data. */
1621
1621
  export declare interface FileData {
1622
+ /** Optional. Display name of the file data. Used to provide a label or filename to distinguish file datas. It is not currently used in the Gemini GenerateContent calls. */
1623
+ displayName?: string;
1622
1624
  /** Required. URI. */
1623
1625
  fileUri?: string;
1624
1626
  /** Required. The IANA standard MIME type of the source data. */
@@ -1843,7 +1845,7 @@ export declare interface FunctionCall {
1843
1845
  /** The unique id of the function call. If populated, the client to execute the
1844
1846
  `function_call` and return the response with the matching `id`. */
1845
1847
  id?: string;
1846
- /** Optional. Required. The function parameters and values in JSON object format. See [FunctionDeclaration.parameters] for parameter details. */
1848
+ /** Optional. The function parameters and values in JSON object format. See [FunctionDeclaration.parameters] for parameter details. */
1847
1849
  args?: Record<string, unknown>;
1848
1850
  /** Required. The name of the function to call. Matches [FunctionDeclaration.name]. */
1849
1851
  name?: string;
@@ -2406,6 +2408,8 @@ export declare interface GenerateVideosConfig {
2406
2408
  negativePrompt?: string;
2407
2409
  /** Whether to use the prompt rewriting logic. */
2408
2410
  enhancePrompt?: boolean;
2411
+ /** Whether to generate audio along with the video. */
2412
+ generateAudio?: boolean;
2409
2413
  }
2410
2414
 
2411
2415
  /** A video generation operation. */
@@ -2448,6 +2452,8 @@ export declare class GenerateVideosResponse {
2448
2452
 
2449
2453
  /** Generation config. */
2450
2454
  export declare interface GenerationConfig {
2455
+ /** Optional. Config for model selection. */
2456
+ modelSelectionConfig?: ModelSelectionConfig;
2451
2457
  /** Optional. If enabled, audio timestamp will be included in the request to the model. */
2452
2458
  audioTimestamp?: boolean;
2453
2459
  /** Optional. Number of candidates to generate. */
@@ -2466,16 +2472,22 @@ export declare interface GenerationConfig {
2466
2472
  responseLogprobs?: boolean;
2467
2473
  /** Optional. Output response mimetype of the generated candidate text. Supported mimetype: - `text/plain`: (default) Text output. - `application/json`: JSON response in the candidates. The model needs to be prompted to output the appropriate response type, otherwise the behavior is undefined. This is a preview feature. */
2468
2474
  responseMimeType?: string;
2475
+ /** Optional. The modalities of the response. */
2476
+ responseModalities?: Modality[];
2469
2477
  /** Optional. The `Schema` object allows the definition of input and output data types. These types can be objects, but also primitives and arrays. Represents a select subset of an [OpenAPI 3.0 schema object](https://spec.openapis.org/oas/v3.0.3#schema). If set, a compatible response_mime_type must also be set. Compatible mimetypes: `application/json`: Schema for JSON response. */
2470
2478
  responseSchema?: Schema;
2471
2479
  /** Optional. Routing configuration. */
2472
2480
  routingConfig?: GenerationConfigRoutingConfig;
2473
2481
  /** Optional. Seed. */
2474
2482
  seed?: number;
2483
+ /** Optional. The speech generation config. */
2484
+ speechConfig?: SpeechConfig;
2475
2485
  /** Optional. Stop sequences. */
2476
2486
  stopSequences?: string[];
2477
2487
  /** Optional. Controls the randomness of predictions. */
2478
2488
  temperature?: number;
2489
+ /** Optional. Config for thinking features. An error will be returned if this field is set for models that don't support thinking. */
2490
+ thinkingConfig?: GenerationConfigThinkingConfig;
2479
2491
  /** Optional. If specified, top-k sampling will be used. */
2480
2492
  topK?: number;
2481
2493
  /** Optional. If specified, nucleus sampling will be used. */
@@ -2498,10 +2510,18 @@ export declare interface GenerationConfigRoutingConfigAutoRoutingMode {
2498
2510
 
2499
2511
  /** When manual routing is set, the specified model will be used directly. */
2500
2512
  export declare interface GenerationConfigRoutingConfigManualRoutingMode {
2501
- /** The model name to use. Only the public LLM models are accepted. e.g. 'gemini-1.5-pro-001'. */
2513
+ /** The model name to use. Only the public LLM models are accepted. See [Supported models](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#supported-models). */
2502
2514
  modelName?: string;
2503
2515
  }
2504
2516
 
2517
+ /** Config for thinking features. */
2518
+ export declare interface GenerationConfigThinkingConfig {
2519
+ /** Optional. Indicates whether to include thoughts in the response. If true, thoughts are returned only when available. */
2520
+ includeThoughts?: boolean;
2521
+ /** Optional. Indicates the thinking budget in tokens. This is only applied when enable_thinking is true. */
2522
+ thinkingBudget?: number;
2523
+ }
2524
+
2505
2525
  /** Optional parameters for caches.get method. */
2506
2526
  export declare interface GetCachedContentConfig {
2507
2527
  /** Used to override HTTP request options. */
@@ -2769,6 +2789,8 @@ export declare interface GroundingChunk {
2769
2789
 
2770
2790
  /** Chunk from context retrieved by the retrieval tools. */
2771
2791
  export declare interface GroundingChunkRetrievedContext {
2792
+ /** Additional context for the RAG retrieval result. This is only populated when using the RAG retrieval tool. */
2793
+ ragChunk?: RagChunk;
2772
2794
  /** Text of the attribution. */
2773
2795
  text?: string;
2774
2796
  /** Title of the attribution. */
@@ -2880,7 +2902,7 @@ export declare enum HarmCategory {
2880
2902
  */
2881
2903
  HARM_CATEGORY_SEXUALLY_EXPLICIT = "HARM_CATEGORY_SEXUALLY_EXPLICIT",
2882
2904
  /**
2883
- * The harm category is civic integrity.
2905
+ * Deprecated: Election filter is not longer supported. The harm category is civic integrity.
2884
2906
  */
2885
2907
  HARM_CATEGORY_CIVIC_INTEGRITY = "HARM_CATEGORY_CIVIC_INTEGRITY"
2886
2908
  }
@@ -3680,8 +3702,6 @@ export declare interface LiveMusicGenerationConfig {
3680
3702
  muteDrums?: boolean;
3681
3703
  /** Whether the audio output should contain only bass and drums. */
3682
3704
  onlyBassAndDrums?: boolean;
3683
- /** The mode of music generation. Default mode is QUALITY. */
3684
- musicGenerationMode?: MusicGenerationMode;
3685
3705
  }
3686
3706
 
3687
3707
  /** The playback control signal to apply to the music generation. */
@@ -4131,7 +4151,7 @@ export declare enum Modality {
4131
4151
  */
4132
4152
  IMAGE = "IMAGE",
4133
4153
  /**
4134
- * Indicates the model should return images.
4154
+ * Indicates the model should return audio.
4135
4155
  */
4136
4156
  AUDIO = "AUDIO"
4137
4157
  }
@@ -4505,24 +4525,6 @@ export declare interface MultiSpeakerVoiceConfig {
4505
4525
  speakerVoiceConfigs?: SpeakerVoiceConfig[];
4506
4526
  }
4507
4527
 
4508
- /** The mode of music generation. */
4509
- export declare enum MusicGenerationMode {
4510
- /**
4511
- * This value is unused.
4512
- */
4513
- MUSIC_GENERATION_MODE_UNSPECIFIED = "MUSIC_GENERATION_MODE_UNSPECIFIED",
4514
- /**
4515
- * Steer text prompts to regions of latent space with higher quality
4516
- music.
4517
- */
4518
- QUALITY = "QUALITY",
4519
- /**
4520
- * Steer text prompts to regions of latent space with a larger diversity
4521
- of music.
4522
- */
4523
- DIVERSITY = "DIVERSITY"
4524
- }
4525
-
4526
4528
  /** A long-running operation. */
4527
4529
  export declare interface Operation {
4528
4530
  /** The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`. */
@@ -4722,12 +4724,12 @@ export declare interface Part {
4722
4724
  thought?: boolean;
4723
4725
  /** Optional. Inlined bytes data. */
4724
4726
  inlineData?: Blob_2;
4727
+ /** Optional. URI based data. */
4728
+ fileData?: FileData;
4725
4729
  /** Optional. Result of executing the [ExecutableCode]. */
4726
4730
  codeExecutionResult?: CodeExecutionResult;
4727
4731
  /** Optional. Code generated by the model that is meant to be executed. */
4728
4732
  executableCode?: ExecutableCode;
4729
- /** Optional. URI based data. */
4730
- fileData?: FileData;
4731
4733
  /** Optional. A predicted [FunctionCall] returned from the model that contains a string representing the [FunctionDeclaration.name] with the parameters and their values. */
4732
4734
  functionCall?: FunctionCall;
4733
4735
  /** Optional. The result output of a [FunctionCall] that contains a string representing the [FunctionDeclaration.name] and a structured JSON object containing any output from the function call. It is used as context to the model. */
@@ -4771,6 +4773,22 @@ export declare interface ProactivityConfig {
4771
4773
  proactiveAudio?: boolean;
4772
4774
  }
4773
4775
 
4776
+ /** A RagChunk includes the content of a chunk of a RagFile, and associated metadata. */
4777
+ export declare interface RagChunk {
4778
+ /** If populated, represents where the chunk starts and ends in the document. */
4779
+ pageSpan?: RagChunkPageSpan;
4780
+ /** The content of the chunk. */
4781
+ text?: string;
4782
+ }
4783
+
4784
+ /** Represents where the chunk starts and ends in the document. */
4785
+ export declare interface RagChunkPageSpan {
4786
+ /** Page where chunk starts in the document. Inclusive. 1-indexed. */
4787
+ firstPage?: number;
4788
+ /** Page where chunk ends in the document. Inclusive. 1-indexed. */
4789
+ lastPage?: number;
4790
+ }
4791
+
4774
4792
  /** Specifies the context retrieval config. */
4775
4793
  export declare interface RagRetrievalConfig {
4776
4794
  /** Optional. Config for filters. */
@@ -4809,7 +4827,7 @@ export declare interface RagRetrievalConfigRanking {
4809
4827
 
4810
4828
  /** Config for LlmRanker. */
4811
4829
  export declare interface RagRetrievalConfigRankingLlmRanker {
4812
- /** Optional. The model name used for ranking. Format: `gemini-1.5-pro` */
4830
+ /** Optional. The model name used for ranking. See [Supported models](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#supported-models). */
4813
4831
  modelName?: string;
4814
4832
  }
4815
4833
 
@@ -4895,6 +4913,8 @@ export declare interface Retrieval {
4895
4913
  export declare interface RetrievalConfig {
4896
4914
  /** Optional. The location of the user. */
4897
4915
  latLng?: LatLng;
4916
+ /** The language code of the user. */
4917
+ languageCode?: string;
4898
4918
  }
4899
4919
 
4900
4920
  /** Metadata related to retrieval in the grounding flow. */
@@ -5007,7 +5027,12 @@ export declare enum Scale {
5007
5027
  B_MAJOR_A_FLAT_MINOR = "B_MAJOR_A_FLAT_MINOR"
5008
5028
  }
5009
5029
 
5010
- /** Schema is used to define the format of input/output data. Represents a select subset of an [OpenAPI 3.0 schema object](https://spec.openapis.org/oas/v3.0.3#schema-object). More fields may be added in the future as needed. */
5030
+ /** Schema is used to define the format of input/output data.
5031
+
5032
+ Represents a select subset of an [OpenAPI 3.0 schema
5033
+ object](https://spec.openapis.org/oas/v3.0.3#schema-object). More fields may
5034
+ be added in the future as needed.
5035
+ */
5011
5036
  export declare interface Schema {
5012
5037
  /** Optional. The value should be validated against any (one or more) of the subschemas in the list. */
5013
5038
  anyOf?: Schema[];
@@ -5420,15 +5445,17 @@ export declare interface SupervisedTuningDatasetDistributionDatasetBucket {
5420
5445
 
5421
5446
  /** Tuning data statistics for Supervised Tuning. */
5422
5447
  export declare interface SupervisedTuningDataStats {
5448
+ /** Output only. For each index in `truncated_example_indices`, the user-facing reason why the example was dropped. */
5449
+ droppedExampleReasons?: string[];
5423
5450
  /** Output only. Number of billable characters in the tuning dataset. */
5424
5451
  totalBillableCharacterCount?: string;
5425
5452
  /** Output only. Number of billable tokens in the tuning dataset. */
5426
5453
  totalBillableTokenCount?: string;
5427
- /** The number of examples in the dataset that have been truncated by any amount. */
5454
+ /** Output only. The number of examples in the dataset that have been dropped. An example can be dropped for reasons including: too many tokens, contains an invalid image, contains too many images, etc. */
5428
5455
  totalTruncatedExampleCount?: string;
5429
5456
  /** Output only. Number of tuning characters in the tuning dataset. */
5430
5457
  totalTuningCharacterCount?: string;
5431
- /** A partial sample of the indices (starting from 1) of the truncated examples. */
5458
+ /** Output only. A partial sample of the indices (starting from 1) of the dropped examples. */
5432
5459
  truncatedExampleIndices?: string[];
5433
5460
  /** Output only. Number of examples in the tuning dataset. */
5434
5461
  tuningDatasetExampleCount?: string;
@@ -5446,14 +5473,14 @@ export declare interface SupervisedTuningDataStats {
5446
5473
 
5447
5474
  /** Tuning Spec for Supervised Tuning for first party models. */
5448
5475
  export declare interface SupervisedTuningSpec {
5476
+ /** Optional. If set to true, disable intermediate checkpoints for SFT and only the last checkpoint will be exported. Otherwise, enable intermediate checkpoints for SFT. Default is false. */
5477
+ exportLastCheckpointOnly?: boolean;
5449
5478
  /** Optional. Hyperparameters for SFT. */
5450
5479
  hyperParameters?: SupervisedHyperParameters;
5451
5480
  /** Required. Cloud Storage path to file containing training dataset for tuning. The dataset must be formatted as a JSONL file. */
5452
5481
  trainingDatasetUri?: string;
5453
5482
  /** Optional. Cloud Storage path to file containing validation dataset for tuning. The dataset must be formatted as a JSONL file. */
5454
5483
  validationDatasetUri?: string;
5455
- /** Optional. If set to true, disable intermediate checkpoints for SFT and only the last checkpoint will be exported. */
5456
- exportLastCheckpointOnly?: boolean;
5457
5484
  }
5458
5485
 
5459
5486
  export declare interface TestTableFile {
@@ -5521,7 +5548,7 @@ export declare interface Tool {
5521
5548
  googleMaps?: GoogleMaps;
5522
5549
  /** Optional. Tool to support URL context retrieval. */
5523
5550
  urlContext?: UrlContext;
5524
- /** Optional. CodeExecution tool type. Enables the model to execute code as part of generation. This field is only used by the Gemini Developer API services. */
5551
+ /** Optional. CodeExecution tool type. Enables the model to execute code as part of generation. */
5525
5552
  codeExecution?: ToolCodeExecution;
5526
5553
  }
5527
5554
 
@@ -5649,7 +5676,7 @@ export declare interface TuningJob {
5649
5676
  error?: GoogleRpcStatus;
5650
5677
  /** Optional. The description of the TuningJob. */
5651
5678
  description?: string;
5652
- /** The base model that is being tuned, e.g., "gemini-1.0-pro-002". . */
5679
+ /** The base model that is being tuned. See [Supported models](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/tuning#supported_models). */
5653
5680
  baseModel?: string;
5654
5681
  /** Output only. The tuned model resources associated with this TuningJob. */
5655
5682
  tunedModel?: TunedModel;
@@ -5669,6 +5696,8 @@ export declare interface TuningJob {
5669
5696
  labels?: Record<string, string>;
5670
5697
  /** Output only. The resource name of the PipelineJob associated with the TuningJob. Format: `projects/{project}/locations/{location}/pipelineJobs/{pipeline_job}`. */
5671
5698
  pipelineJob?: string;
5699
+ /** The service account that the tuningJob workload runs as. If not specified, the Vertex AI Secure Fine-Tuned Service Agent in the project will be used. See https://cloud.google.com/iam/docs/service-agents#vertex-ai-secure-fine-tuning-service-agent Users starting the pipeline must have the `iam.serviceAccounts.actAs` permission on this service account. */
5700
+ serviceAccount?: string;
5672
5701
  /** Optional. The display name of the TunedModel. The name can be up to 128 characters long and can consist of any UTF-8 characters. */
5673
5702
  tunedModelDisplayName?: string;
5674
5703
  }
@@ -5762,7 +5791,11 @@ export declare enum Type {
5762
5791
  /**
5763
5792
  * OpenAPI object type
5764
5793
  */
5765
- OBJECT = "OBJECT"
5794
+ OBJECT = "OBJECT",
5795
+ /**
5796
+ * Null type
5797
+ */
5798
+ NULL = "NULL"
5766
5799
  }
5767
5800
 
5768
5801
  declare namespace types {
@@ -5778,10 +5811,10 @@ declare namespace types {
5778
5811
  createModelContent,
5779
5812
  Outcome,
5780
5813
  Language,
5814
+ Type,
5781
5815
  HarmCategory,
5782
5816
  HarmBlockMethod,
5783
5817
  HarmBlockThreshold,
5784
- Type,
5785
5818
  Mode,
5786
5819
  AuthType,
5787
5820
  FinishReason,
@@ -5814,21 +5847,20 @@ declare namespace types {
5814
5847
  TurnCoverage,
5815
5848
  FunctionResponseScheduling,
5816
5849
  Scale,
5817
- MusicGenerationMode,
5818
5850
  LiveMusicPlaybackControl,
5819
5851
  VideoMetadata,
5820
5852
  Blob_2 as Blob,
5853
+ FileData,
5821
5854
  CodeExecutionResult,
5822
5855
  ExecutableCode,
5823
- FileData,
5824
5856
  FunctionCall,
5825
5857
  FunctionResponse,
5826
5858
  Part,
5827
5859
  Content,
5828
5860
  HttpOptions,
5861
+ Schema,
5829
5862
  ModelSelectionConfig,
5830
5863
  SafetySetting,
5831
- Schema,
5832
5864
  FunctionDeclaration,
5833
5865
  Interval,
5834
5866
  GoogleSearch,
@@ -5876,6 +5908,8 @@ declare namespace types {
5876
5908
  CitationMetadata,
5877
5909
  UrlMetadata,
5878
5910
  UrlContextMetadata,
5911
+ RagChunkPageSpan,
5912
+ RagChunk,
5879
5913
  GroundingChunkRetrievedContext,
5880
5914
  GroundingChunkWeb,
5881
5915
  GroundingChunk,
@@ -5928,6 +5962,7 @@ declare namespace types {
5928
5962
  DeleteModelConfig,
5929
5963
  DeleteModelParameters,
5930
5964
  DeleteModelResponse,
5965
+ GenerationConfigThinkingConfig,
5931
5966
  GenerationConfig,
5932
5967
  CountTokensConfig,
5933
5968
  CountTokensParameters,
@@ -6292,6 +6327,10 @@ export declare interface VertexAISearch {
6292
6327
  datastore?: string;
6293
6328
  /** Optional. Fully-qualified Vertex AI Search engine resource ID. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}` */
6294
6329
  engine?: string;
6330
+ /** Optional. Filter strings to be passed to the search API. */
6331
+ filter?: string;
6332
+ /** Optional. Number of search results to return per query. The default value is 10. The maximumm allowed value is 10. */
6333
+ maxResults?: number;
6295
6334
  }
6296
6335
 
6297
6336
  /** Retrieve from Vertex RAG Store for grounding. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google/genai",
3
- "version": "1.0.1",
3
+ "version": "1.2.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/node/index.mjs",
@@ -17,10 +17,12 @@
17
17
  "node": {
18
18
  "types": "./dist/node/node.d.ts",
19
19
  "import": "./dist/node/index.mjs",
20
+ "require": "./dist/node/index.cjs",
20
21
  "default": "./dist/node/index.mjs"
21
22
  },
22
23
  "types": "./dist/genai.d.ts",
23
24
  "import": "./dist/index.mjs",
25
+ "require": "./dist/index.cjs",
24
26
  "default": "./dist/index.mjs"
25
27
  },
26
28
  "./web": {
@@ -55,8 +57,10 @@
55
57
  "files": [
56
58
  "dist/genai.d.ts",
57
59
  "dist/index.mjs",
60
+ "dist/index.cjs",
58
61
  "dist/index.mjs.map",
59
62
  "dist/node/index.mjs",
63
+ "dist/node/index.cjs",
60
64
  "dist/node/index.mjs.map",
61
65
  "dist/node/node.d.ts",
62
66
  "dist/web/index.mjs",