@google/genai 1.0.0 → 1.1.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/README.md CHANGED
@@ -130,19 +130,19 @@ const ai = new GoogleGenAI({
130
130
  All API features are accessed through an instance of the `GoogleGenAI` classes.
131
131
  The submodules bundle together related API methods:
132
132
 
133
- - [`ai.models`](https://googleapis.github.io/js-genai/main/classes/models.Models.html):
133
+ - [`ai.models`](https://googleapis.github.io/js-genai/release_docs/classes/models.Models.html):
134
134
  Use `models` to query models (`generateContent`, `generateImages`, ...), or
135
135
  examine their metadata.
136
- - [`ai.caches`](https://googleapis.github.io/js-genai/main/classes/caches.Caches.html):
136
+ - [`ai.caches`](https://googleapis.github.io/js-genai/release_docs/classes/caches.Caches.html):
137
137
  Create and manage `caches` to reduce costs when repeatedly using the same
138
138
  large prompt prefix.
139
- - [`ai.chats`](https://googleapis.github.io/js-genai/main/classes/chats.Chats.html):
139
+ - [`ai.chats`](https://googleapis.github.io/js-genai/release_docs/classes/chats.Chats.html):
140
140
  Create local stateful `chat` objects to simplify multi turn interactions.
141
- - [`ai.files`](https://googleapis.github.io/js-genai/main/classes/files.Files.html):
141
+ - [`ai.files`](https://googleapis.github.io/js-genai/release_docs/classes/files.Files.html):
142
142
  Upload `files` to the API and reference them in your prompts.
143
143
  This reduces bandwidth if you use a file many times, and handles files too
144
144
  large to fit inline with your prompt.
145
- - [`ai.live`](https://googleapis.github.io/js-genai/main/classes/live.Live.html):
145
+ - [`ai.live`](https://googleapis.github.io/js-genai/release_docs/classes/live.Live.html):
146
146
  Start a `live` session for real time interaction, allows text + audio + video
147
147
  input, and text or audio output.
148
148
 
package/dist/genai.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;
@@ -2448,6 +2450,8 @@ export declare class GenerateVideosResponse {
2448
2450
 
2449
2451
  /** Generation config. */
2450
2452
  export declare interface GenerationConfig {
2453
+ /** Optional. Config for model selection. */
2454
+ modelSelectionConfig?: ModelSelectionConfig;
2451
2455
  /** Optional. If enabled, audio timestamp will be included in the request to the model. */
2452
2456
  audioTimestamp?: boolean;
2453
2457
  /** Optional. Number of candidates to generate. */
@@ -2466,16 +2470,22 @@ export declare interface GenerationConfig {
2466
2470
  responseLogprobs?: boolean;
2467
2471
  /** 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
2472
  responseMimeType?: string;
2473
+ /** Optional. The modalities of the response. */
2474
+ responseModalities?: Modality[];
2469
2475
  /** 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
2476
  responseSchema?: Schema;
2471
2477
  /** Optional. Routing configuration. */
2472
2478
  routingConfig?: GenerationConfigRoutingConfig;
2473
2479
  /** Optional. Seed. */
2474
2480
  seed?: number;
2481
+ /** Optional. The speech generation config. */
2482
+ speechConfig?: SpeechConfig;
2475
2483
  /** Optional. Stop sequences. */
2476
2484
  stopSequences?: string[];
2477
2485
  /** Optional. Controls the randomness of predictions. */
2478
2486
  temperature?: number;
2487
+ /** Optional. Config for thinking features. An error will be returned if this field is set for models that don't support thinking. */
2488
+ thinkingConfig?: GenerationConfigThinkingConfig;
2479
2489
  /** Optional. If specified, top-k sampling will be used. */
2480
2490
  topK?: number;
2481
2491
  /** Optional. If specified, nucleus sampling will be used. */
@@ -2498,10 +2508,18 @@ export declare interface GenerationConfigRoutingConfigAutoRoutingMode {
2498
2508
 
2499
2509
  /** When manual routing is set, the specified model will be used directly. */
2500
2510
  export declare interface GenerationConfigRoutingConfigManualRoutingMode {
2501
- /** The model name to use. Only the public LLM models are accepted. e.g. 'gemini-1.5-pro-001'. */
2511
+ /** 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
2512
  modelName?: string;
2503
2513
  }
2504
2514
 
2515
+ /** Config for thinking features. */
2516
+ export declare interface GenerationConfigThinkingConfig {
2517
+ /** Optional. Indicates whether to include thoughts in the response. If true, thoughts are returned only when available. */
2518
+ includeThoughts?: boolean;
2519
+ /** Optional. Indicates the thinking budget in tokens. This is only applied when enable_thinking is true. */
2520
+ thinkingBudget?: number;
2521
+ }
2522
+
2505
2523
  /** Optional parameters for caches.get method. */
2506
2524
  export declare interface GetCachedContentConfig {
2507
2525
  /** Used to override HTTP request options. */
@@ -2764,6 +2782,8 @@ export declare interface GroundingChunk {
2764
2782
 
2765
2783
  /** Chunk from context retrieved by the retrieval tools. */
2766
2784
  export declare interface GroundingChunkRetrievedContext {
2785
+ /** Additional context for the RAG retrieval result. This is only populated when using the RAG retrieval tool. */
2786
+ ragChunk?: RagChunk;
2767
2787
  /** Text of the attribution. */
2768
2788
  text?: string;
2769
2789
  /** Title of the attribution. */
@@ -2875,7 +2895,7 @@ export declare enum HarmCategory {
2875
2895
  */
2876
2896
  HARM_CATEGORY_SEXUALLY_EXPLICIT = "HARM_CATEGORY_SEXUALLY_EXPLICIT",
2877
2897
  /**
2878
- * The harm category is civic integrity.
2898
+ * Deprecated: Election filter is not longer supported. The harm category is civic integrity.
2879
2899
  */
2880
2900
  HARM_CATEGORY_CIVIC_INTEGRITY = "HARM_CATEGORY_CIVIC_INTEGRITY"
2881
2901
  }
@@ -4717,12 +4737,12 @@ export declare interface Part {
4717
4737
  thought?: boolean;
4718
4738
  /** Optional. Inlined bytes data. */
4719
4739
  inlineData?: Blob_2;
4740
+ /** Optional. URI based data. */
4741
+ fileData?: FileData;
4720
4742
  /** Optional. Result of executing the [ExecutableCode]. */
4721
4743
  codeExecutionResult?: CodeExecutionResult;
4722
4744
  /** Optional. Code generated by the model that is meant to be executed. */
4723
4745
  executableCode?: ExecutableCode;
4724
- /** Optional. URI based data. */
4725
- fileData?: FileData;
4726
4746
  /** Optional. A predicted [FunctionCall] returned from the model that contains a string representing the [FunctionDeclaration.name] with the parameters and their values. */
4727
4747
  functionCall?: FunctionCall;
4728
4748
  /** 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. */
@@ -4766,6 +4786,22 @@ export declare interface ProactivityConfig {
4766
4786
  proactiveAudio?: boolean;
4767
4787
  }
4768
4788
 
4789
+ /** A RagChunk includes the content of a chunk of a RagFile, and associated metadata. */
4790
+ export declare interface RagChunk {
4791
+ /** If populated, represents where the chunk starts and ends in the document. */
4792
+ pageSpan?: RagChunkPageSpan;
4793
+ /** The content of the chunk. */
4794
+ text?: string;
4795
+ }
4796
+
4797
+ /** Represents where the chunk starts and ends in the document. */
4798
+ export declare interface RagChunkPageSpan {
4799
+ /** Page where chunk starts in the document. Inclusive. 1-indexed. */
4800
+ firstPage?: number;
4801
+ /** Page where chunk ends in the document. Inclusive. 1-indexed. */
4802
+ lastPage?: number;
4803
+ }
4804
+
4769
4805
  /** Specifies the context retrieval config. */
4770
4806
  export declare interface RagRetrievalConfig {
4771
4807
  /** Optional. Config for filters. */
@@ -4804,7 +4840,7 @@ export declare interface RagRetrievalConfigRanking {
4804
4840
 
4805
4841
  /** Config for LlmRanker. */
4806
4842
  export declare interface RagRetrievalConfigRankingLlmRanker {
4807
- /** Optional. The model name used for ranking. Format: `gemini-1.5-pro` */
4843
+ /** Optional. The model name used for ranking. See [Supported models](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#supported-models). */
4808
4844
  modelName?: string;
4809
4845
  }
4810
4846
 
@@ -4890,6 +4926,8 @@ export declare interface Retrieval {
4890
4926
  export declare interface RetrievalConfig {
4891
4927
  /** Optional. The location of the user. */
4892
4928
  latLng?: LatLng;
4929
+ /** The language code of the user. */
4930
+ languageCode?: string;
4893
4931
  }
4894
4932
 
4895
4933
  /** Metadata related to retrieval in the grounding flow. */
@@ -5002,7 +5040,12 @@ export declare enum Scale {
5002
5040
  B_MAJOR_A_FLAT_MINOR = "B_MAJOR_A_FLAT_MINOR"
5003
5041
  }
5004
5042
 
5005
- /** 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. */
5043
+ /** Schema is used to define the format of input/output data.
5044
+
5045
+ Represents a select subset of an [OpenAPI 3.0 schema
5046
+ object](https://spec.openapis.org/oas/v3.0.3#schema-object). More fields may
5047
+ be added in the future as needed.
5048
+ */
5006
5049
  export declare interface Schema {
5007
5050
  /** Optional. The value should be validated against any (one or more) of the subschemas in the list. */
5008
5051
  anyOf?: Schema[];
@@ -5415,15 +5458,17 @@ export declare interface SupervisedTuningDatasetDistributionDatasetBucket {
5415
5458
 
5416
5459
  /** Tuning data statistics for Supervised Tuning. */
5417
5460
  export declare interface SupervisedTuningDataStats {
5461
+ /** Output only. For each index in `truncated_example_indices`, the user-facing reason why the example was dropped. */
5462
+ droppedExampleReasons?: string[];
5418
5463
  /** Output only. Number of billable characters in the tuning dataset. */
5419
5464
  totalBillableCharacterCount?: string;
5420
5465
  /** Output only. Number of billable tokens in the tuning dataset. */
5421
5466
  totalBillableTokenCount?: string;
5422
- /** The number of examples in the dataset that have been truncated by any amount. */
5467
+ /** 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. */
5423
5468
  totalTruncatedExampleCount?: string;
5424
5469
  /** Output only. Number of tuning characters in the tuning dataset. */
5425
5470
  totalTuningCharacterCount?: string;
5426
- /** A partial sample of the indices (starting from 1) of the truncated examples. */
5471
+ /** Output only. A partial sample of the indices (starting from 1) of the dropped examples. */
5427
5472
  truncatedExampleIndices?: string[];
5428
5473
  /** Output only. Number of examples in the tuning dataset. */
5429
5474
  tuningDatasetExampleCount?: string;
@@ -5441,14 +5486,14 @@ export declare interface SupervisedTuningDataStats {
5441
5486
 
5442
5487
  /** Tuning Spec for Supervised Tuning for first party models. */
5443
5488
  export declare interface SupervisedTuningSpec {
5489
+ /** 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. */
5490
+ exportLastCheckpointOnly?: boolean;
5444
5491
  /** Optional. Hyperparameters for SFT. */
5445
5492
  hyperParameters?: SupervisedHyperParameters;
5446
5493
  /** Required. Cloud Storage path to file containing training dataset for tuning. The dataset must be formatted as a JSONL file. */
5447
5494
  trainingDatasetUri?: string;
5448
5495
  /** Optional. Cloud Storage path to file containing validation dataset for tuning. The dataset must be formatted as a JSONL file. */
5449
5496
  validationDatasetUri?: string;
5450
- /** Optional. If set to true, disable intermediate checkpoints for SFT and only the last checkpoint will be exported. */
5451
- exportLastCheckpointOnly?: boolean;
5452
5497
  }
5453
5498
 
5454
5499
  export declare interface TestTableFile {
@@ -5516,7 +5561,7 @@ export declare interface Tool {
5516
5561
  googleMaps?: GoogleMaps;
5517
5562
  /** Optional. Tool to support URL context retrieval. */
5518
5563
  urlContext?: UrlContext;
5519
- /** 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. */
5564
+ /** Optional. CodeExecution tool type. Enables the model to execute code as part of generation. */
5520
5565
  codeExecution?: ToolCodeExecution;
5521
5566
  }
5522
5567
 
@@ -5644,7 +5689,7 @@ export declare interface TuningJob {
5644
5689
  error?: GoogleRpcStatus;
5645
5690
  /** Optional. The description of the TuningJob. */
5646
5691
  description?: string;
5647
- /** The base model that is being tuned, e.g., "gemini-1.0-pro-002". . */
5692
+ /** The base model that is being tuned. See [Supported models](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/tuning#supported_models). */
5648
5693
  baseModel?: string;
5649
5694
  /** Output only. The tuned model resources associated with this TuningJob. */
5650
5695
  tunedModel?: TunedModel;
@@ -5664,6 +5709,8 @@ export declare interface TuningJob {
5664
5709
  labels?: Record<string, string>;
5665
5710
  /** Output only. The resource name of the PipelineJob associated with the TuningJob. Format: `projects/{project}/locations/{location}/pipelineJobs/{pipeline_job}`. */
5666
5711
  pipelineJob?: string;
5712
+ /** 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. */
5713
+ serviceAccount?: string;
5667
5714
  /** Optional. The display name of the TunedModel. The name can be up to 128 characters long and can consist of any UTF-8 characters. */
5668
5715
  tunedModelDisplayName?: string;
5669
5716
  }
@@ -5757,7 +5804,11 @@ export declare enum Type {
5757
5804
  /**
5758
5805
  * OpenAPI object type
5759
5806
  */
5760
- OBJECT = "OBJECT"
5807
+ OBJECT = "OBJECT",
5808
+ /**
5809
+ * Null type
5810
+ */
5811
+ NULL = "NULL"
5761
5812
  }
5762
5813
 
5763
5814
  declare namespace types {
@@ -5773,10 +5824,10 @@ declare namespace types {
5773
5824
  createModelContent,
5774
5825
  Outcome,
5775
5826
  Language,
5827
+ Type,
5776
5828
  HarmCategory,
5777
5829
  HarmBlockMethod,
5778
5830
  HarmBlockThreshold,
5779
- Type,
5780
5831
  Mode,
5781
5832
  AuthType,
5782
5833
  FinishReason,
@@ -5813,17 +5864,17 @@ declare namespace types {
5813
5864
  LiveMusicPlaybackControl,
5814
5865
  VideoMetadata,
5815
5866
  Blob_2 as Blob,
5867
+ FileData,
5816
5868
  CodeExecutionResult,
5817
5869
  ExecutableCode,
5818
- FileData,
5819
5870
  FunctionCall,
5820
5871
  FunctionResponse,
5821
5872
  Part,
5822
5873
  Content,
5823
5874
  HttpOptions,
5875
+ Schema,
5824
5876
  ModelSelectionConfig,
5825
5877
  SafetySetting,
5826
- Schema,
5827
5878
  FunctionDeclaration,
5828
5879
  Interval,
5829
5880
  GoogleSearch,
@@ -5871,6 +5922,8 @@ declare namespace types {
5871
5922
  CitationMetadata,
5872
5923
  UrlMetadata,
5873
5924
  UrlContextMetadata,
5925
+ RagChunkPageSpan,
5926
+ RagChunk,
5874
5927
  GroundingChunkRetrievedContext,
5875
5928
  GroundingChunkWeb,
5876
5929
  GroundingChunk,
@@ -5923,6 +5976,7 @@ declare namespace types {
5923
5976
  DeleteModelConfig,
5924
5977
  DeleteModelParameters,
5925
5978
  DeleteModelResponse,
5979
+ GenerationConfigThinkingConfig,
5926
5980
  GenerationConfig,
5927
5981
  CountTokensConfig,
5928
5982
  CountTokensParameters,
@@ -6287,6 +6341,10 @@ export declare interface VertexAISearch {
6287
6341
  datastore?: string;
6288
6342
  /** Optional. Fully-qualified Vertex AI Search engine resource ID. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}` */
6289
6343
  engine?: string;
6344
+ /** Optional. Filter strings to be passed to the search API. */
6345
+ filter?: string;
6346
+ /** Optional. Number of search results to return per query. The default value is 10. The maximumm allowed value is 10. */
6347
+ maxResults?: number;
6290
6348
  }
6291
6349
 
6292
6350
  /** Retrieve from Vertex RAG Store for grounding. */