@google/genai 1.0.1 → 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 +5 -5
- package/dist/genai.d.ts +79 -21
- package/dist/index.cjs +14589 -0
- package/dist/index.mjs +453 -76
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +14994 -0
- package/dist/node/index.mjs +453 -76
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +79 -21
- package/dist/web/index.mjs +453 -76
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +79 -21
- package/package.json +5 -1
package/dist/node/node.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
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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.
|
|
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.
|
|
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. */
|
|
@@ -2776,6 +2794,8 @@ export declare interface GroundingChunk {
|
|
|
2776
2794
|
|
|
2777
2795
|
/** Chunk from context retrieved by the retrieval tools. */
|
|
2778
2796
|
export declare interface GroundingChunkRetrievedContext {
|
|
2797
|
+
/** Additional context for the RAG retrieval result. This is only populated when using the RAG retrieval tool. */
|
|
2798
|
+
ragChunk?: RagChunk;
|
|
2779
2799
|
/** Text of the attribution. */
|
|
2780
2800
|
text?: string;
|
|
2781
2801
|
/** Title of the attribution. */
|
|
@@ -2887,7 +2907,7 @@ export declare enum HarmCategory {
|
|
|
2887
2907
|
*/
|
|
2888
2908
|
HARM_CATEGORY_SEXUALLY_EXPLICIT = "HARM_CATEGORY_SEXUALLY_EXPLICIT",
|
|
2889
2909
|
/**
|
|
2890
|
-
* The harm category is civic integrity.
|
|
2910
|
+
* Deprecated: Election filter is not longer supported. The harm category is civic integrity.
|
|
2891
2911
|
*/
|
|
2892
2912
|
HARM_CATEGORY_CIVIC_INTEGRITY = "HARM_CATEGORY_CIVIC_INTEGRITY"
|
|
2893
2913
|
}
|
|
@@ -4729,12 +4749,12 @@ export declare interface Part {
|
|
|
4729
4749
|
thought?: boolean;
|
|
4730
4750
|
/** Optional. Inlined bytes data. */
|
|
4731
4751
|
inlineData?: Blob_2;
|
|
4752
|
+
/** Optional. URI based data. */
|
|
4753
|
+
fileData?: FileData;
|
|
4732
4754
|
/** Optional. Result of executing the [ExecutableCode]. */
|
|
4733
4755
|
codeExecutionResult?: CodeExecutionResult;
|
|
4734
4756
|
/** Optional. Code generated by the model that is meant to be executed. */
|
|
4735
4757
|
executableCode?: ExecutableCode;
|
|
4736
|
-
/** Optional. URI based data. */
|
|
4737
|
-
fileData?: FileData;
|
|
4738
4758
|
/** Optional. A predicted [FunctionCall] returned from the model that contains a string representing the [FunctionDeclaration.name] with the parameters and their values. */
|
|
4739
4759
|
functionCall?: FunctionCall;
|
|
4740
4760
|
/** 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. */
|
|
@@ -4778,6 +4798,22 @@ export declare interface ProactivityConfig {
|
|
|
4778
4798
|
proactiveAudio?: boolean;
|
|
4779
4799
|
}
|
|
4780
4800
|
|
|
4801
|
+
/** A RagChunk includes the content of a chunk of a RagFile, and associated metadata. */
|
|
4802
|
+
export declare interface RagChunk {
|
|
4803
|
+
/** If populated, represents where the chunk starts and ends in the document. */
|
|
4804
|
+
pageSpan?: RagChunkPageSpan;
|
|
4805
|
+
/** The content of the chunk. */
|
|
4806
|
+
text?: string;
|
|
4807
|
+
}
|
|
4808
|
+
|
|
4809
|
+
/** Represents where the chunk starts and ends in the document. */
|
|
4810
|
+
export declare interface RagChunkPageSpan {
|
|
4811
|
+
/** Page where chunk starts in the document. Inclusive. 1-indexed. */
|
|
4812
|
+
firstPage?: number;
|
|
4813
|
+
/** Page where chunk ends in the document. Inclusive. 1-indexed. */
|
|
4814
|
+
lastPage?: number;
|
|
4815
|
+
}
|
|
4816
|
+
|
|
4781
4817
|
/** Specifies the context retrieval config. */
|
|
4782
4818
|
export declare interface RagRetrievalConfig {
|
|
4783
4819
|
/** Optional. Config for filters. */
|
|
@@ -4816,7 +4852,7 @@ export declare interface RagRetrievalConfigRanking {
|
|
|
4816
4852
|
|
|
4817
4853
|
/** Config for LlmRanker. */
|
|
4818
4854
|
export declare interface RagRetrievalConfigRankingLlmRanker {
|
|
4819
|
-
/** Optional. The model name used for ranking.
|
|
4855
|
+
/** Optional. The model name used for ranking. See [Supported models](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/inference#supported-models). */
|
|
4820
4856
|
modelName?: string;
|
|
4821
4857
|
}
|
|
4822
4858
|
|
|
@@ -4902,6 +4938,8 @@ export declare interface Retrieval {
|
|
|
4902
4938
|
export declare interface RetrievalConfig {
|
|
4903
4939
|
/** Optional. The location of the user. */
|
|
4904
4940
|
latLng?: LatLng;
|
|
4941
|
+
/** The language code of the user. */
|
|
4942
|
+
languageCode?: string;
|
|
4905
4943
|
}
|
|
4906
4944
|
|
|
4907
4945
|
/** Metadata related to retrieval in the grounding flow. */
|
|
@@ -5014,7 +5052,12 @@ export declare enum Scale {
|
|
|
5014
5052
|
B_MAJOR_A_FLAT_MINOR = "B_MAJOR_A_FLAT_MINOR"
|
|
5015
5053
|
}
|
|
5016
5054
|
|
|
5017
|
-
/** Schema is used to define the format of input/output data.
|
|
5055
|
+
/** Schema is used to define the format of input/output data.
|
|
5056
|
+
|
|
5057
|
+
Represents a select subset of an [OpenAPI 3.0 schema
|
|
5058
|
+
object](https://spec.openapis.org/oas/v3.0.3#schema-object). More fields may
|
|
5059
|
+
be added in the future as needed.
|
|
5060
|
+
*/
|
|
5018
5061
|
export declare interface Schema {
|
|
5019
5062
|
/** Optional. The value should be validated against any (one or more) of the subschemas in the list. */
|
|
5020
5063
|
anyOf?: Schema[];
|
|
@@ -5427,15 +5470,17 @@ export declare interface SupervisedTuningDatasetDistributionDatasetBucket {
|
|
|
5427
5470
|
|
|
5428
5471
|
/** Tuning data statistics for Supervised Tuning. */
|
|
5429
5472
|
export declare interface SupervisedTuningDataStats {
|
|
5473
|
+
/** Output only. For each index in `truncated_example_indices`, the user-facing reason why the example was dropped. */
|
|
5474
|
+
droppedExampleReasons?: string[];
|
|
5430
5475
|
/** Output only. Number of billable characters in the tuning dataset. */
|
|
5431
5476
|
totalBillableCharacterCount?: string;
|
|
5432
5477
|
/** Output only. Number of billable tokens in the tuning dataset. */
|
|
5433
5478
|
totalBillableTokenCount?: string;
|
|
5434
|
-
/** The number of examples in the dataset that have been
|
|
5479
|
+
/** 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. */
|
|
5435
5480
|
totalTruncatedExampleCount?: string;
|
|
5436
5481
|
/** Output only. Number of tuning characters in the tuning dataset. */
|
|
5437
5482
|
totalTuningCharacterCount?: string;
|
|
5438
|
-
/** A partial sample of the indices (starting from 1) of the
|
|
5483
|
+
/** Output only. A partial sample of the indices (starting from 1) of the dropped examples. */
|
|
5439
5484
|
truncatedExampleIndices?: string[];
|
|
5440
5485
|
/** Output only. Number of examples in the tuning dataset. */
|
|
5441
5486
|
tuningDatasetExampleCount?: string;
|
|
@@ -5453,14 +5498,14 @@ export declare interface SupervisedTuningDataStats {
|
|
|
5453
5498
|
|
|
5454
5499
|
/** Tuning Spec for Supervised Tuning for first party models. */
|
|
5455
5500
|
export declare interface SupervisedTuningSpec {
|
|
5501
|
+
/** 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. */
|
|
5502
|
+
exportLastCheckpointOnly?: boolean;
|
|
5456
5503
|
/** Optional. Hyperparameters for SFT. */
|
|
5457
5504
|
hyperParameters?: SupervisedHyperParameters;
|
|
5458
5505
|
/** Required. Cloud Storage path to file containing training dataset for tuning. The dataset must be formatted as a JSONL file. */
|
|
5459
5506
|
trainingDatasetUri?: string;
|
|
5460
5507
|
/** Optional. Cloud Storage path to file containing validation dataset for tuning. The dataset must be formatted as a JSONL file. */
|
|
5461
5508
|
validationDatasetUri?: string;
|
|
5462
|
-
/** Optional. If set to true, disable intermediate checkpoints for SFT and only the last checkpoint will be exported. */
|
|
5463
|
-
exportLastCheckpointOnly?: boolean;
|
|
5464
5509
|
}
|
|
5465
5510
|
|
|
5466
5511
|
export declare interface TestTableFile {
|
|
@@ -5528,7 +5573,7 @@ export declare interface Tool {
|
|
|
5528
5573
|
googleMaps?: GoogleMaps;
|
|
5529
5574
|
/** Optional. Tool to support URL context retrieval. */
|
|
5530
5575
|
urlContext?: UrlContext;
|
|
5531
|
-
/** Optional. CodeExecution tool type. Enables the model to execute code as part of generation.
|
|
5576
|
+
/** Optional. CodeExecution tool type. Enables the model to execute code as part of generation. */
|
|
5532
5577
|
codeExecution?: ToolCodeExecution;
|
|
5533
5578
|
}
|
|
5534
5579
|
|
|
@@ -5656,7 +5701,7 @@ export declare interface TuningJob {
|
|
|
5656
5701
|
error?: GoogleRpcStatus;
|
|
5657
5702
|
/** Optional. The description of the TuningJob. */
|
|
5658
5703
|
description?: string;
|
|
5659
|
-
/** The base model that is being tuned
|
|
5704
|
+
/** The base model that is being tuned. See [Supported models](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/tuning#supported_models). */
|
|
5660
5705
|
baseModel?: string;
|
|
5661
5706
|
/** Output only. The tuned model resources associated with this TuningJob. */
|
|
5662
5707
|
tunedModel?: TunedModel;
|
|
@@ -5676,6 +5721,8 @@ export declare interface TuningJob {
|
|
|
5676
5721
|
labels?: Record<string, string>;
|
|
5677
5722
|
/** Output only. The resource name of the PipelineJob associated with the TuningJob. Format: `projects/{project}/locations/{location}/pipelineJobs/{pipeline_job}`. */
|
|
5678
5723
|
pipelineJob?: string;
|
|
5724
|
+
/** 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. */
|
|
5725
|
+
serviceAccount?: string;
|
|
5679
5726
|
/** Optional. The display name of the TunedModel. The name can be up to 128 characters long and can consist of any UTF-8 characters. */
|
|
5680
5727
|
tunedModelDisplayName?: string;
|
|
5681
5728
|
}
|
|
@@ -5769,7 +5816,11 @@ export declare enum Type {
|
|
|
5769
5816
|
/**
|
|
5770
5817
|
* OpenAPI object type
|
|
5771
5818
|
*/
|
|
5772
|
-
OBJECT = "OBJECT"
|
|
5819
|
+
OBJECT = "OBJECT",
|
|
5820
|
+
/**
|
|
5821
|
+
* Null type
|
|
5822
|
+
*/
|
|
5823
|
+
NULL = "NULL"
|
|
5773
5824
|
}
|
|
5774
5825
|
|
|
5775
5826
|
declare namespace types {
|
|
@@ -5785,10 +5836,10 @@ declare namespace types {
|
|
|
5785
5836
|
createModelContent,
|
|
5786
5837
|
Outcome,
|
|
5787
5838
|
Language,
|
|
5839
|
+
Type,
|
|
5788
5840
|
HarmCategory,
|
|
5789
5841
|
HarmBlockMethod,
|
|
5790
5842
|
HarmBlockThreshold,
|
|
5791
|
-
Type,
|
|
5792
5843
|
Mode,
|
|
5793
5844
|
AuthType,
|
|
5794
5845
|
FinishReason,
|
|
@@ -5825,17 +5876,17 @@ declare namespace types {
|
|
|
5825
5876
|
LiveMusicPlaybackControl,
|
|
5826
5877
|
VideoMetadata,
|
|
5827
5878
|
Blob_2 as Blob,
|
|
5879
|
+
FileData,
|
|
5828
5880
|
CodeExecutionResult,
|
|
5829
5881
|
ExecutableCode,
|
|
5830
|
-
FileData,
|
|
5831
5882
|
FunctionCall,
|
|
5832
5883
|
FunctionResponse,
|
|
5833
5884
|
Part,
|
|
5834
5885
|
Content,
|
|
5835
5886
|
HttpOptions,
|
|
5887
|
+
Schema,
|
|
5836
5888
|
ModelSelectionConfig,
|
|
5837
5889
|
SafetySetting,
|
|
5838
|
-
Schema,
|
|
5839
5890
|
FunctionDeclaration,
|
|
5840
5891
|
Interval,
|
|
5841
5892
|
GoogleSearch,
|
|
@@ -5883,6 +5934,8 @@ declare namespace types {
|
|
|
5883
5934
|
CitationMetadata,
|
|
5884
5935
|
UrlMetadata,
|
|
5885
5936
|
UrlContextMetadata,
|
|
5937
|
+
RagChunkPageSpan,
|
|
5938
|
+
RagChunk,
|
|
5886
5939
|
GroundingChunkRetrievedContext,
|
|
5887
5940
|
GroundingChunkWeb,
|
|
5888
5941
|
GroundingChunk,
|
|
@@ -5935,6 +5988,7 @@ declare namespace types {
|
|
|
5935
5988
|
DeleteModelConfig,
|
|
5936
5989
|
DeleteModelParameters,
|
|
5937
5990
|
DeleteModelResponse,
|
|
5991
|
+
GenerationConfigThinkingConfig,
|
|
5938
5992
|
GenerationConfig,
|
|
5939
5993
|
CountTokensConfig,
|
|
5940
5994
|
CountTokensParameters,
|
|
@@ -6299,6 +6353,10 @@ export declare interface VertexAISearch {
|
|
|
6299
6353
|
datastore?: string;
|
|
6300
6354
|
/** Optional. Fully-qualified Vertex AI Search engine resource ID. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}` */
|
|
6301
6355
|
engine?: string;
|
|
6356
|
+
/** Optional. Filter strings to be passed to the search API. */
|
|
6357
|
+
filter?: string;
|
|
6358
|
+
/** Optional. Number of search results to return per query. The default value is 10. The maximumm allowed value is 10. */
|
|
6359
|
+
maxResults?: number;
|
|
6302
6360
|
}
|
|
6303
6361
|
|
|
6304
6362
|
/** Retrieve from Vertex RAG Store for grounding. */
|