@google/genai 2.6.0 → 2.8.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/genai.d.ts +487 -69
- package/dist/index.cjs +567 -144
- package/dist/index.mjs +565 -145
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +567 -144
- package/dist/node/index.mjs +565 -145
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +487 -69
- package/dist/tokenizer/node.cjs +81 -25
- package/dist/tokenizer/node.d.ts +16 -31
- package/dist/tokenizer/node.mjs +81 -25
- package/dist/tokenizer/node.mjs.map +1 -1
- package/dist/vertex_internal/index.cjs +82 -26
- package/dist/vertex_internal/index.cjs.map +1 -1
- package/dist/vertex_internal/index.d.ts +371 -66
- package/dist/vertex_internal/index.js +82 -26
- package/dist/vertex_internal/index.js.map +1 -1
- package/dist/web/index.mjs +565 -145
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +487 -69
- package/package.json +1 -1
|
@@ -462,6 +462,32 @@ declare interface AutomaticFunctionCallingConfig {
|
|
|
462
462
|
ignoreCallHistory?: boolean;
|
|
463
463
|
}
|
|
464
464
|
|
|
465
|
+
/** Autorater config used for evaluation. */
|
|
466
|
+
declare interface AutoraterConfig {
|
|
467
|
+
/** Number of samples for each instance in the dataset.
|
|
468
|
+
If not specified, the default is 4. Minimum value is 1, maximum value
|
|
469
|
+
is 32. */
|
|
470
|
+
samplingCount?: number;
|
|
471
|
+
/** Optional. Default is true. Whether to flip the candidate and baseline
|
|
472
|
+
responses. This is only applicable to the pairwise metric. If enabled, also
|
|
473
|
+
provide PairwiseMetricSpec.candidate_response_field_name and
|
|
474
|
+
PairwiseMetricSpec.baseline_response_field_name. When rendering
|
|
475
|
+
PairwiseMetricSpec.metric_prompt_template, the candidate and baseline
|
|
476
|
+
fields will be flipped for half of the samples to reduce bias. */
|
|
477
|
+
flipEnabled?: boolean;
|
|
478
|
+
/** The fully qualified name of the publisher model or tuned autorater
|
|
479
|
+
endpoint to use.
|
|
480
|
+
|
|
481
|
+
Publisher model format:
|
|
482
|
+
`projects/{project}/locations/{location}/publishers/{publisher}/models/{model}`
|
|
483
|
+
|
|
484
|
+
Tuned model endpoint format:
|
|
485
|
+
`projects/{project}/locations/{location}/endpoints/{endpoint}` */
|
|
486
|
+
autoraterModel?: string;
|
|
487
|
+
/** Configuration options for model generation and outputs. */
|
|
488
|
+
generationConfig?: GenerationConfig;
|
|
489
|
+
}
|
|
490
|
+
|
|
465
491
|
/** Configures the avatar to be used in the session. */
|
|
466
492
|
declare interface AvatarConfig {
|
|
467
493
|
/** Pre-built avatar id. */
|
|
@@ -886,6 +912,18 @@ declare interface CompletionStats {
|
|
|
886
912
|
successfulForecastPointCount?: string;
|
|
887
913
|
}
|
|
888
914
|
|
|
915
|
+
/** Composite reinforcement tuning reward config. */
|
|
916
|
+
declare interface CompositeReinforcementTuningRewardConfig {
|
|
917
|
+
weightedRewardConfigs?: CompositeReinforcementTuningRewardConfigWeightedRewardConfig[];
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
/** Composite reinforcement tuning reward config weighted reward config. */
|
|
921
|
+
declare interface CompositeReinforcementTuningRewardConfigWeightedRewardConfig {
|
|
922
|
+
rewardConfig?: SingleReinforcementTuningRewardConfig;
|
|
923
|
+
/** How much this single reward contributes to the total overall reward. */
|
|
924
|
+
weight?: number;
|
|
925
|
+
}
|
|
926
|
+
|
|
889
927
|
/** Tool to support computer use. */
|
|
890
928
|
declare interface ComputerUse {
|
|
891
929
|
/** Required. The environment being operated. */
|
|
@@ -1394,7 +1432,7 @@ declare interface CreateTuningJobConfig {
|
|
|
1394
1432
|
be charged usage for any applicable operations.
|
|
1395
1433
|
*/
|
|
1396
1434
|
abortSignal?: AbortSignal;
|
|
1397
|
-
/** The method to use for tuning (SUPERVISED_FINE_TUNING or PREFERENCE_TUNING or DISTILLATION). If not set, the default method (SFT) will be used. */
|
|
1435
|
+
/** The method to use for tuning (SUPERVISED_FINE_TUNING or PREFERENCE_TUNING or DISTILLATION or REINFORCEMENT_TUNING). If not set, the default method (SFT) will be used. */
|
|
1398
1436
|
method?: TuningMethod;
|
|
1399
1437
|
/** Validation dataset for tuning. The dataset must be formatted as a JSONL file. */
|
|
1400
1438
|
validationDataset?: TuningValidationDataset;
|
|
@@ -1434,6 +1472,22 @@ declare interface CreateTuningJobConfig {
|
|
|
1434
1472
|
outputUri?: string;
|
|
1435
1473
|
/** The encryption spec of the tuning job. Customer-managed encryption key options for a TuningJob. If this is set, then all resources created by the TuningJob will be encrypted with provided encryption key. */
|
|
1436
1474
|
encryptionSpec?: EncryptionSpec;
|
|
1475
|
+
/** Reward function configuration for reinforcement tuning. Reinforcement tuning only. */
|
|
1476
|
+
rewardConfig?: SingleReinforcementTuningRewardConfig;
|
|
1477
|
+
/** Composite reward function configuration for reinforcement tuning. Reinforcement tuning only. */
|
|
1478
|
+
compositeRewardConfig?: CompositeReinforcementTuningRewardConfig;
|
|
1479
|
+
/** Number of different responses to generate per prompt during tuning. Reinforcement tuning only. */
|
|
1480
|
+
samplesPerPrompt?: number;
|
|
1481
|
+
/** How often at steps to evaluate the tuning job during training. Reinforcement tuning only. */
|
|
1482
|
+
evaluateInterval?: number;
|
|
1483
|
+
/** How often at steps to save checkpoints during training. Reinforcement tuning only. */
|
|
1484
|
+
checkpointInterval?: number;
|
|
1485
|
+
/** The maximum number of tokens to generate per prompt. Reinforcement tuning only. */
|
|
1486
|
+
maxOutputTokens?: number;
|
|
1487
|
+
/** Indicates the maximum thinking depth. Use with earlier models shall result in error. Reinforcement tuning only. */
|
|
1488
|
+
thinkingLevel?: ReinforcementTuningThinkingLevel;
|
|
1489
|
+
/** Cloud Storage path to file containing validation dataset for tuning. The dataset must be formatted as a JSONL file. If no validation dataset is provided, by default the API splits 25% of the training dataset or 50 examples, whichever is larger, as the validation dataset. Reinforcement tuning only. */
|
|
1490
|
+
validationDatasetUri?: string;
|
|
1437
1491
|
}
|
|
1438
1492
|
|
|
1439
1493
|
/** Fine-tuning job creation parameters - optional fields. */
|
|
@@ -2484,10 +2538,9 @@ declare interface FullFineTuningSpec {
|
|
|
2484
2538
|
validationDatasetUri?: string;
|
|
2485
2539
|
}
|
|
2486
2540
|
|
|
2487
|
-
/** A
|
|
2541
|
+
/** A predicted FunctionCall returned from the model that contains a string representing the FunctionDeclaration.name and a structured JSON object containing the parameters and their values. */
|
|
2488
2542
|
declare interface FunctionCall {
|
|
2489
|
-
/** The unique id of the function call. If populated, the client to execute the
|
|
2490
|
-
`function_call` and return the response with the matching `id`. */
|
|
2543
|
+
/** Optional. The unique id of the function call. If populated, the client to execute the `function_call` and return the response with the matching `id`. */
|
|
2491
2544
|
id?: string;
|
|
2492
2545
|
/** Optional. The function parameters and values in JSON object format. See FunctionDeclaration.parameters for parameter details. */
|
|
2493
2546
|
args?: Record<string, unknown>;
|
|
@@ -2551,14 +2604,13 @@ declare interface FunctionDeclaration {
|
|
|
2551
2604
|
behavior?: Behavior;
|
|
2552
2605
|
}
|
|
2553
2606
|
|
|
2554
|
-
/**
|
|
2607
|
+
/** The result output from a FunctionCall that contains a string representing the FunctionDeclaration.name and a structured JSON object containing any output from the function is used as context to the model. This should contain the result of a `FunctionCall` made based on model prediction. */
|
|
2555
2608
|
declare class FunctionResponse {
|
|
2556
|
-
/** Signals that function call continues, and more responses will be returned, turning the function call into a generator. Is only applicable to NON_BLOCKING function calls
|
|
2609
|
+
/** Optional. Signals that function call continues, and more responses will be returned, turning the function call into a generator. Is only applicable to NON_BLOCKING function calls, is ignored otherwise. If set to false, future responses will not be considered. It is allowed to return empty `response` with `will_continue=False` to signal that the function call is finished. This may still trigger the model generation. To avoid triggering the generation and finish the function call, additionally set `scheduling` to `SILENT`. This field is not supported in Vertex AI. */
|
|
2557
2610
|
willContinue?: boolean;
|
|
2558
|
-
/** Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE. */
|
|
2611
|
+
/** Optional. Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE. */
|
|
2559
2612
|
scheduling?: FunctionResponseScheduling;
|
|
2560
|
-
/**
|
|
2561
|
-
have a different IANA MIME type. */
|
|
2613
|
+
/** Optional. Ordered `Parts` that constitute a function response. Parts may have different IANA MIME types. */
|
|
2562
2614
|
parts?: FunctionResponsePart[];
|
|
2563
2615
|
/** Optional. The id of the function call this response is for. Populated by the client to match the corresponding function call `id`. */
|
|
2564
2616
|
id?: string;
|
|
@@ -2568,49 +2620,36 @@ declare class FunctionResponse {
|
|
|
2568
2620
|
response?: Record<string, unknown>;
|
|
2569
2621
|
}
|
|
2570
2622
|
|
|
2571
|
-
/** Raw media bytes for function response.
|
|
2572
|
-
|
|
2573
|
-
Text should not be sent as raw bytes, use the FunctionResponse.response
|
|
2574
|
-
field. */
|
|
2623
|
+
/** Raw media bytes for function response. Text should not be sent as raw bytes, use the 'text' field. */
|
|
2575
2624
|
declare class FunctionResponseBlob {
|
|
2576
2625
|
/** Required. The IANA standard MIME type of the source data. */
|
|
2577
2626
|
mimeType?: string;
|
|
2578
|
-
/** Required.
|
|
2627
|
+
/** Required. Raw bytes.
|
|
2579
2628
|
* @remarks Encoded as base64 string. */
|
|
2580
2629
|
data?: string;
|
|
2581
|
-
/** Optional. Display name of the blob.
|
|
2582
|
-
Used to provide a label or filename to distinguish blobs. */
|
|
2630
|
+
/** Optional. Display name of the blob. Used to provide a label or filename to distinguish blobs. This field is only returned in PromptMessage for prompt management. It is currently used in the Gemini GenerateContent calls only when server side tools (code_execution, google_search, and url_context) are enabled. This field is not supported in Gemini API. */
|
|
2583
2631
|
displayName?: string;
|
|
2584
2632
|
}
|
|
2585
2633
|
|
|
2586
|
-
/** URI based data for function response. */
|
|
2634
|
+
/** URI based data for function response. This data type is not supported in Gemini API. */
|
|
2587
2635
|
declare class FunctionResponseFileData {
|
|
2588
2636
|
/** Required. URI. */
|
|
2589
2637
|
fileUri?: string;
|
|
2590
2638
|
/** Required. The IANA standard MIME type of the source data. */
|
|
2591
2639
|
mimeType?: string;
|
|
2592
|
-
/** Optional. Display name of the file.
|
|
2593
|
-
Used to provide a label or filename to distinguish files. */
|
|
2640
|
+
/** Optional. Display name of the file data. Used to provide a label or filename to distinguish file datas. This field is only returned in PromptMessage for prompt management. It is currently used in the Gemini GenerateContent calls only when server side tools (code_execution, google_search, and url_context) are enabled. */
|
|
2594
2641
|
displayName?: string;
|
|
2595
2642
|
}
|
|
2596
2643
|
|
|
2597
|
-
/** A datatype containing media that is part of a `FunctionResponse` message.
|
|
2598
|
-
|
|
2599
|
-
A `FunctionResponsePart` consists of data which has an associated datatype. A
|
|
2600
|
-
`FunctionResponsePart` can only contain one of the accepted types in
|
|
2601
|
-
`FunctionResponsePart.data`.
|
|
2602
|
-
|
|
2603
|
-
A `FunctionResponsePart` must have a fixed IANA MIME type identifying the
|
|
2604
|
-
type and subtype of the media if the `inline_data` field is filled with raw
|
|
2605
|
-
bytes. */
|
|
2644
|
+
/** A datatype containing media that is part of a `FunctionResponse` message. A `FunctionResponsePart` consists of data which has an associated datatype. A `FunctionResponsePart` can only contain one of the accepted types in `FunctionResponsePart.data`. A `FunctionResponsePart` must have a fixed IANA MIME type identifying the type and subtype of the media if the `inline_data` field is filled with raw bytes. */
|
|
2606
2645
|
declare class FunctionResponsePart {
|
|
2607
|
-
/**
|
|
2646
|
+
/** Inline media bytes. */
|
|
2608
2647
|
inlineData?: FunctionResponseBlob;
|
|
2609
|
-
/**
|
|
2648
|
+
/** URI based data. This field is not supported in Gemini API. */
|
|
2610
2649
|
fileData?: FunctionResponseFileData;
|
|
2611
2650
|
}
|
|
2612
2651
|
|
|
2613
|
-
/** Specifies how the response should be scheduled in the conversation. */
|
|
2652
|
+
/** Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE. */
|
|
2614
2653
|
declare enum FunctionResponseScheduling {
|
|
2615
2654
|
/**
|
|
2616
2655
|
* This value is unused.
|
|
@@ -3520,7 +3559,7 @@ export declare function getValueByPath(data: unknown, keys: string[], defaultVal
|
|
|
3520
3559
|
declare interface GoogleMaps {
|
|
3521
3560
|
/** The authentication config to access the API. Only API key is supported. This field is not supported in Gemini API. */
|
|
3522
3561
|
authConfig?: AuthConfig;
|
|
3523
|
-
/**
|
|
3562
|
+
/** Deprecated. The Google Maps contextual widget behavior in Grounding with Google Maps is being deprecated; this field is planned for removal and no longer has any effect once removed. Optional. Whether to return a widget context token in the GroundingMetadata of the response. */
|
|
3524
3563
|
enableWidget?: boolean;
|
|
3525
3564
|
}
|
|
3526
3565
|
|
|
@@ -4308,16 +4347,11 @@ declare enum Language {
|
|
|
4308
4347
|
PYTHON = "PYTHON"
|
|
4309
4348
|
}
|
|
4310
4349
|
|
|
4311
|
-
/** An object that represents a latitude/longitude pair.
|
|
4312
|
-
|
|
4313
|
-
This is expressed as a pair of doubles to represent degrees latitude and
|
|
4314
|
-
degrees longitude. Unless specified otherwise, this object must conform to the
|
|
4315
|
-
<a href="https://en.wikipedia.org/wiki/World_Geodetic_System#1984_version">
|
|
4316
|
-
WGS84 standard</a>. Values must be within normalized ranges. */
|
|
4350
|
+
/** An object that represents a latitude/longitude pair. This is expressed as a pair of doubles to represent degrees latitude and degrees longitude. Unless specified otherwise, this object must conform to the WGS84 standard. Values must be within normalized ranges. */
|
|
4317
4351
|
declare interface LatLng {
|
|
4318
4352
|
/** The latitude in degrees. It must be in the range [-90.0, +90.0]. */
|
|
4319
4353
|
latitude?: number;
|
|
4320
|
-
/** The longitude in degrees. It must be in the range [-180.0, +180.0] */
|
|
4354
|
+
/** The longitude in degrees. It must be in the range [-180.0, +180.0]. */
|
|
4321
4355
|
longitude?: number;
|
|
4322
4356
|
}
|
|
4323
4357
|
|
|
@@ -4787,8 +4821,8 @@ declare interface LiveConnectConfig {
|
|
|
4787
4821
|
response.
|
|
4788
4822
|
*/
|
|
4789
4823
|
safetySettings?: SafetySetting[];
|
|
4790
|
-
/** Config for
|
|
4791
|
-
|
|
4824
|
+
/** Config for translation. */
|
|
4825
|
+
translationConfig?: TranslationConfig;
|
|
4792
4826
|
}
|
|
4793
4827
|
|
|
4794
4828
|
/** Config for LiveConnectConstraints for Auth Token creation. */
|
|
@@ -5217,6 +5251,26 @@ declare enum MaskReferenceMode {
|
|
|
5217
5251
|
MASK_MODE_SEMANTIC = "MASK_MODE_SEMANTIC"
|
|
5218
5252
|
}
|
|
5219
5253
|
|
|
5254
|
+
/** Match operation to use for evaluation. */
|
|
5255
|
+
declare enum MatchOperation {
|
|
5256
|
+
/**
|
|
5257
|
+
* Default value. This value is unused.
|
|
5258
|
+
*/
|
|
5259
|
+
MATCH_OPERATION_UNSPECIFIED = "MATCH_OPERATION_UNSPECIFIED",
|
|
5260
|
+
/**
|
|
5261
|
+
* Equivalent to GoogleSQL `REGEX_CONTAINS(target, expression)`.
|
|
5262
|
+
*/
|
|
5263
|
+
REGEX_CONTAINS = "REGEX_CONTAINS",
|
|
5264
|
+
/**
|
|
5265
|
+
* `expression` is a substring of target.
|
|
5266
|
+
*/
|
|
5267
|
+
PARTIAL_MATCH = "PARTIAL_MATCH",
|
|
5268
|
+
/**
|
|
5269
|
+
* `expression` is an exact match of target.
|
|
5270
|
+
*/
|
|
5271
|
+
EXACT_MATCH = "EXACT_MATCH"
|
|
5272
|
+
}
|
|
5273
|
+
|
|
5220
5274
|
/** A MCPServer is a server that can be called by the model to perform actions. It is a server that implements the MCP protocol. Next ID: 6. This data type is not supported in Vertex AI. */
|
|
5221
5275
|
declare interface McpServer {
|
|
5222
5276
|
/** The name of the MCPServer. */
|
|
@@ -6073,6 +6127,151 @@ declare class RegisterFilesResponse {
|
|
|
6073
6127
|
files?: File_2[];
|
|
6074
6128
|
}
|
|
6075
6129
|
|
|
6130
|
+
/** Reinforcement tuning autorater scorer. */
|
|
6131
|
+
declare interface ReinforcementTuningAutoraterScorer {
|
|
6132
|
+
/** Autorater config for evaluation. */
|
|
6133
|
+
autoraterConfig?: AutoraterConfig;
|
|
6134
|
+
/** Allows substituting `prompt`, `response`, `system_instruction` and `references.reference` (each wrapped in double curly braces) into the autorater prompt. */
|
|
6135
|
+
autoraterPrompt?: string;
|
|
6136
|
+
/** Parses autorater returned response. */
|
|
6137
|
+
autoraterResponseParseConfig?: ReinforcementTuningParseResponseConfig;
|
|
6138
|
+
/** Scores autorater responses by directly converting parsed autorater response to float reward. */
|
|
6139
|
+
parsedResponseConversionScorer?: ReinforcementTuningAutoraterScorerParsedResponseConversionScorer;
|
|
6140
|
+
/** Scores autorater responses by using exact string match reward scorer. */
|
|
6141
|
+
exactMatchScorer?: ReinforcementTuningAutoraterScorerExactMatchScorer;
|
|
6142
|
+
}
|
|
6143
|
+
|
|
6144
|
+
/** Scores autorater responses by using exact string match reward scorer. */
|
|
6145
|
+
declare interface ReinforcementTuningAutoraterScorerExactMatchScorer {
|
|
6146
|
+
/** Assigns this reward score if parsed response string equals the expression. */
|
|
6147
|
+
correctAnswerReward?: number;
|
|
6148
|
+
/** Assigns this reward score if parsed reward value does not equal the expression. */
|
|
6149
|
+
wrongAnswerReward?: number;
|
|
6150
|
+
/** The string expression to match against. Supports substitution in the format of `references.reference` (wrapped in double curly braces) before matching. No regex support. */
|
|
6151
|
+
expression?: string;
|
|
6152
|
+
}
|
|
6153
|
+
|
|
6154
|
+
/** Scores responses by directly converting parsed autorater response to float reward (reward is clipped to be within [-1, 1]). */
|
|
6155
|
+
declare class ReinforcementTuningAutoraterScorerParsedResponseConversionScorer {
|
|
6156
|
+
}
|
|
6157
|
+
|
|
6158
|
+
/** Scores parsed responses by calling a Cloud Run service. */
|
|
6159
|
+
declare interface ReinforcementTuningCloudRunRewardScorer {
|
|
6160
|
+
/** URI of the Cloud Run service that will be used to compute the reward. The Vertex AI Secure Fine Tuning Service Agent (`service-PROJECT_NUMBER@gcp-sa-vertex-tune.iam.gserviceaccount.com`, where `PROJECT_NUMBER` is the numeric project number) must be granted the permission (e.g. by granting `roles/run.invoker` in IAM) to invoke the Cloud Run service. */
|
|
6161
|
+
cloudRunUri?: string;
|
|
6162
|
+
}
|
|
6163
|
+
|
|
6164
|
+
/** Scores parsed responses for code execution use cases. */
|
|
6165
|
+
declare interface ReinforcementTuningCodeExecutionRewardScorer {
|
|
6166
|
+
/** Example python code snippet which assigns reward of 1 to answer matching user provided reference answer in per prompt references map. */
|
|
6167
|
+
pythonCodeSnippet?: string;
|
|
6168
|
+
}
|
|
6169
|
+
|
|
6170
|
+
/** User-facing format for Gemini Reinforcement Tuning examples on Vertex. */
|
|
6171
|
+
declare interface ReinforcementTuningExample {
|
|
6172
|
+
/** Multi-turn contents that represents the Prompt. */
|
|
6173
|
+
contents?: Content[];
|
|
6174
|
+
/** References for the given prompt. The key is the name of the reference, and the value is the reference itself. */
|
|
6175
|
+
references?: Record<string, string>;
|
|
6176
|
+
/** Corresponds to `system_instruction` in user-facing GenerateContentRequest. */
|
|
6177
|
+
systemInstruction?: Content;
|
|
6178
|
+
}
|
|
6179
|
+
|
|
6180
|
+
/** Hyperparameters for Reinforcement Tuning. */
|
|
6181
|
+
declare interface ReinforcementTuningHyperParameters {
|
|
6182
|
+
/** Number of training epochs for the tuning job. */
|
|
6183
|
+
epochCount?: string;
|
|
6184
|
+
/** Learning rate multiplier for Reinforcement Learning. */
|
|
6185
|
+
learningRateMultiplier?: number;
|
|
6186
|
+
/** Adapter size for Reinforcement Tuning. */
|
|
6187
|
+
adapterSize?: AdapterSize;
|
|
6188
|
+
/** Number of different responses to generate per prompt during tuning. */
|
|
6189
|
+
samplesPerPrompt?: number;
|
|
6190
|
+
/** Batch size for the tuning job. How many prompts to process at a train step. If not set, the batch size will be determined automatically. */
|
|
6191
|
+
batchSize?: number;
|
|
6192
|
+
/** How often (in steps) to evaluate the tuning job during training. If not set, evaluation will run per epoch. */
|
|
6193
|
+
evaluateInterval?: number;
|
|
6194
|
+
/** How often (in steps) to save checkpoints during training. If not set, one checkpoint per epoch will be saved. */
|
|
6195
|
+
checkpointInterval?: number;
|
|
6196
|
+
/** The maximum number of tokens to generate per prompt. If not set, defaults to 32768. */
|
|
6197
|
+
maxOutputTokens?: number;
|
|
6198
|
+
/** Indicates the maximum thinking depth. Use with earlier models shall result in error. */
|
|
6199
|
+
thinkingLevel?: ReinforcementTuningThinkingLevel;
|
|
6200
|
+
}
|
|
6201
|
+
|
|
6202
|
+
/** Defines how to parse sample response for reinforcement tuning. */
|
|
6203
|
+
declare class ReinforcementTuningParseResponseConfig {
|
|
6204
|
+
/** Defines how to parse sample response. */
|
|
6205
|
+
parseType?: ResponseParseType;
|
|
6206
|
+
/** Defines the regex to extract the important part of sample response. This field is only used when `parse_type` is `REGEX_EXTRACT`. */
|
|
6207
|
+
regexExtractExpression?: string;
|
|
6208
|
+
}
|
|
6209
|
+
|
|
6210
|
+
/** The reward info for a reward function. */
|
|
6211
|
+
declare interface ReinforcementTuningRewardInfo {
|
|
6212
|
+
/** Output only. The calculated reward for the reward function. */
|
|
6213
|
+
reward?: number;
|
|
6214
|
+
/** Output only. The user-requested auxiliary info for the reward function. */
|
|
6215
|
+
userRequestedAuxInfo?: string;
|
|
6216
|
+
}
|
|
6217
|
+
|
|
6218
|
+
/** Reinforcement tuning spec for tuning. */
|
|
6219
|
+
declare interface ReinforcementTuningSpec {
|
|
6220
|
+
compositeRewardConfig?: CompositeReinforcementTuningRewardConfig;
|
|
6221
|
+
/** Cloud Storage path to file containing training dataset for tuning. The dataset must be formatted as a JSONL file. */
|
|
6222
|
+
trainingDatasetUri?: string;
|
|
6223
|
+
/** Cloud Storage path to file containing validation dataset for tuning. The dataset must be formatted as a JSONL file. If no validation dataset is provided, by default the API splits 25% of the training dataset or 50 examples, whichever is larger, as the validation dataset. */
|
|
6224
|
+
validationDatasetUri?: string;
|
|
6225
|
+
/** Additional hyper-parameters to use during tuning. */
|
|
6226
|
+
hyperParameters?: ReinforcementTuningHyperParameters;
|
|
6227
|
+
/** Single reward function configuration for reinforcement tuning. */
|
|
6228
|
+
singleRewardConfig?: SingleReinforcementTuningRewardConfig;
|
|
6229
|
+
}
|
|
6230
|
+
|
|
6231
|
+
/** Scores parsed responses for string matching use cases. */
|
|
6232
|
+
declare interface ReinforcementTuningStringMatchRewardScorer {
|
|
6233
|
+
/** Wrong answer reward is returned if evaluator evaluates to `false`. All wrong answers get the same reward. */
|
|
6234
|
+
wrongAnswerReward?: number;
|
|
6235
|
+
/** Correct answer reward is returned if evaluator evaluates to `true`. All correct answers get the same reward. */
|
|
6236
|
+
correctAnswerReward?: number;
|
|
6237
|
+
/** Uses string match expression to evaluate parsed response. */
|
|
6238
|
+
stringMatchExpression?: ReinforcementTuningStringMatchRewardScorerStringMatchExpression;
|
|
6239
|
+
/** Uses json match expression to evaluate parsed response. */
|
|
6240
|
+
jsonMatchExpression?: ReinforcementTuningStringMatchRewardScorerJsonMatchExpression;
|
|
6241
|
+
}
|
|
6242
|
+
|
|
6243
|
+
/** Converts parsed responses to JSON format, finds the first-level matching key, then performs StringMatchExpression on the value. */
|
|
6244
|
+
declare interface ReinforcementTuningStringMatchRewardScorerJsonMatchExpression {
|
|
6245
|
+
/** Json key name to find the value to match against. */
|
|
6246
|
+
keyName?: string;
|
|
6247
|
+
/** String match expression to match against the value of json key. */
|
|
6248
|
+
valueStringMatchExpression?: ReinforcementTuningStringMatchRewardScorerStringMatchExpression;
|
|
6249
|
+
}
|
|
6250
|
+
|
|
6251
|
+
/** Evaluates parsed response using match type against expression. */
|
|
6252
|
+
declare interface ReinforcementTuningStringMatchRewardScorerStringMatchExpression {
|
|
6253
|
+
/** Match operation to use for evaluation. */
|
|
6254
|
+
matchOperation?: MatchOperation;
|
|
6255
|
+
/** String or regular expression to match against. Customer can also provide a references map (key/value pairs) whose value will be substituted into the expression by referencing `references.key_name` (wrapped in double curly braces). */
|
|
6256
|
+
expression?: string;
|
|
6257
|
+
}
|
|
6258
|
+
|
|
6259
|
+
/** Represents how much to think for the tuning job. */
|
|
6260
|
+
declare enum ReinforcementTuningThinkingLevel {
|
|
6261
|
+
/**
|
|
6262
|
+
* Unspecified thinking level.
|
|
6263
|
+
*/
|
|
6264
|
+
REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED = "REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED",
|
|
6265
|
+
/**
|
|
6266
|
+
* Little to no thinking.
|
|
6267
|
+
*/
|
|
6268
|
+
MINIMAL = "MINIMAL",
|
|
6269
|
+
/**
|
|
6270
|
+
* High thinking level.
|
|
6271
|
+
*/
|
|
6272
|
+
HIGH = "HIGH"
|
|
6273
|
+
}
|
|
6274
|
+
|
|
6076
6275
|
/** Represents a recorded session. */
|
|
6077
6276
|
declare interface ReplayFile {
|
|
6078
6277
|
replayId?: string;
|
|
@@ -6126,6 +6325,22 @@ declare enum ResourceScope {
|
|
|
6126
6325
|
COLLECTION = "COLLECTION"
|
|
6127
6326
|
}
|
|
6128
6327
|
|
|
6328
|
+
/** Defines how to parse sample response. */
|
|
6329
|
+
declare enum ResponseParseType {
|
|
6330
|
+
/**
|
|
6331
|
+
* Default value. This value is unused.
|
|
6332
|
+
*/
|
|
6333
|
+
RESPONSE_PARSE_TYPE_UNSPECIFIED = "RESPONSE_PARSE_TYPE_UNSPECIFIED",
|
|
6334
|
+
/**
|
|
6335
|
+
* Use the sample response as is.
|
|
6336
|
+
*/
|
|
6337
|
+
IDENTITY = "IDENTITY",
|
|
6338
|
+
/**
|
|
6339
|
+
* Use regex to extract the important part of sample response.
|
|
6340
|
+
*/
|
|
6341
|
+
REGEX_EXTRACT = "REGEX_EXTRACT"
|
|
6342
|
+
}
|
|
6343
|
+
|
|
6129
6344
|
/** Defines a retrieval tool that model can call to access external knowledge. This data type is not supported in Gemini API. */
|
|
6130
6345
|
declare interface Retrieval {
|
|
6131
6346
|
/** Optional. Deprecated. This option is no longer supported. */
|
|
@@ -6138,10 +6353,9 @@ declare interface Retrieval {
|
|
|
6138
6353
|
vertexRagStore?: VertexRagStore;
|
|
6139
6354
|
}
|
|
6140
6355
|
|
|
6141
|
-
/** Retrieval config.
|
|
6142
|
-
*/
|
|
6356
|
+
/** Retrieval config. */
|
|
6143
6357
|
declare interface RetrievalConfig {
|
|
6144
|
-
/**
|
|
6358
|
+
/** The location of the user. */
|
|
6145
6359
|
latLng?: LatLng;
|
|
6146
6360
|
/** The language code of the user. */
|
|
6147
6361
|
languageCode?: string;
|
|
@@ -6498,6 +6712,22 @@ declare class SingleEmbedContentResponse {
|
|
|
6498
6712
|
tokenCount?: string;
|
|
6499
6713
|
}
|
|
6500
6714
|
|
|
6715
|
+
/** Single reinforcement tuning reward config. */
|
|
6716
|
+
declare interface SingleReinforcementTuningRewardConfig {
|
|
6717
|
+
/** Scores parsed responses for autorater use cases by using a model to compute the reward. */
|
|
6718
|
+
autoraterScorer?: ReinforcementTuningAutoraterScorer;
|
|
6719
|
+
/** A unique reward name used to identify each single reinforcement tuning reward. */
|
|
6720
|
+
rewardName?: string;
|
|
6721
|
+
/** Defines how to parse sample response. */
|
|
6722
|
+
parseResponseConfig?: ReinforcementTuningParseResponseConfig;
|
|
6723
|
+
/** Scores parsed responses for code execution use cases. */
|
|
6724
|
+
codeExecutionRewardScorer?: ReinforcementTuningCodeExecutionRewardScorer;
|
|
6725
|
+
/** Scores parsed responses for simple string matching use cases against reference answer without writing python code. */
|
|
6726
|
+
stringMatchRewardScorer?: ReinforcementTuningStringMatchRewardScorer;
|
|
6727
|
+
/** Scores parsed responses by calling a Cloud Run service. */
|
|
6728
|
+
cloudRunRewardScorer?: ReinforcementTuningCloudRunRewardScorer;
|
|
6729
|
+
}
|
|
6730
|
+
|
|
6501
6731
|
/** Context window will be truncated by keeping only suffix of it.
|
|
6502
6732
|
|
|
6503
6733
|
Context window will always be cut at start of USER role turn. System
|
|
@@ -6559,17 +6789,6 @@ declare interface StreamableHttpTransport {
|
|
|
6559
6789
|
url?: string;
|
|
6560
6790
|
}
|
|
6561
6791
|
|
|
6562
|
-
/** Config for stream translation. */
|
|
6563
|
-
declare interface StreamTranslationConfig {
|
|
6564
|
-
/** If true, the model will generate audio when the target language is
|
|
6565
|
-
spoken, essentially it will parrot the input. If false, we will not produce
|
|
6566
|
-
audio for the target language. */
|
|
6567
|
-
echoTargetLanguage?: boolean;
|
|
6568
|
-
/** The target language for translation. Supported values are BCP-47
|
|
6569
|
-
language codes (e.g. "en", "es", "fr"). */
|
|
6570
|
-
targetLanguageCode?: string;
|
|
6571
|
-
}
|
|
6572
|
-
|
|
6573
6792
|
/** User provided string values assigned to a single metadata key. This data type is not supported in Vertex AI. */
|
|
6574
6793
|
declare interface StringList {
|
|
6575
6794
|
/** The string values of the metadata to store. */
|
|
@@ -6848,15 +7067,13 @@ declare interface ToolCall {
|
|
|
6848
7067
|
declare interface ToolCodeExecution {
|
|
6849
7068
|
}
|
|
6850
7069
|
|
|
6851
|
-
/** Tool config.
|
|
6852
|
-
|
|
6853
|
-
This config is shared for all tools provided in the request. */
|
|
7070
|
+
/** Tool config. This config is shared for all tools provided in the request. */
|
|
6854
7071
|
declare interface ToolConfig {
|
|
6855
7072
|
/** Optional. Retrieval config. */
|
|
6856
7073
|
retrievalConfig?: RetrievalConfig;
|
|
6857
7074
|
/** Optional. Function calling config. */
|
|
6858
7075
|
functionCallingConfig?: FunctionCallingConfig;
|
|
6859
|
-
/** If true, the API response will include the server-side tool calls and responses within the `Content` message. This allows clients to observe the server's tool
|
|
7076
|
+
/** Optional. If true, the API response will include the server-side tool calls and responses within the `Content` message. This allows clients to observe the server's tool interactions. This field is not supported in Vertex AI. */
|
|
6860
7077
|
includeServerSideToolInvocations?: boolean;
|
|
6861
7078
|
}
|
|
6862
7079
|
|
|
@@ -6945,6 +7162,19 @@ declare interface Transcription {
|
|
|
6945
7162
|
text?: string;
|
|
6946
7163
|
/** Optional. The bool indicates the end of the transcription. */
|
|
6947
7164
|
finished?: boolean;
|
|
7165
|
+
/** The BCP-47 language code of the transcription. */
|
|
7166
|
+
languageCode?: string;
|
|
7167
|
+
}
|
|
7168
|
+
|
|
7169
|
+
/** Config for stream translation. */
|
|
7170
|
+
declare interface TranslationConfig {
|
|
7171
|
+
/** If true, the model will generate audio when the target language is
|
|
7172
|
+
spoken, essentially it will parrot the input. If false, we will not produce
|
|
7173
|
+
audio for the target language. */
|
|
7174
|
+
echoTargetLanguage?: boolean;
|
|
7175
|
+
/** The target language for translation. Supported values are BCP-47
|
|
7176
|
+
language codes (e.g. "en", "es", "fr"). */
|
|
7177
|
+
targetLanguageCode?: string;
|
|
6948
7178
|
}
|
|
6949
7179
|
|
|
6950
7180
|
/** TunedModel for the Tuned Model of a Tuning Job. */
|
|
@@ -7053,6 +7283,7 @@ declare interface TuningJob {
|
|
|
7053
7283
|
preferenceOptimizationSpec?: PreferenceOptimizationSpec;
|
|
7054
7284
|
/** Tuning Spec for Distillation. */
|
|
7055
7285
|
distillationSpec?: DistillationSpec;
|
|
7286
|
+
reinforcementTuningSpec?: ReinforcementTuningSpec;
|
|
7056
7287
|
/** Output only. The tuning data statistics associated with this TuningJob. */
|
|
7057
7288
|
tuningDataStats?: TuningDataStats;
|
|
7058
7289
|
/** Customer-managed encryption key options for a TuningJob. If this is set, then all resources created by the TuningJob will be encrypted with the provided encryption key. */
|
|
@@ -7137,7 +7368,11 @@ declare enum TuningMethod {
|
|
|
7137
7368
|
/**
|
|
7138
7369
|
* Distillation tuning.
|
|
7139
7370
|
*/
|
|
7140
|
-
DISTILLATION = "DISTILLATION"
|
|
7371
|
+
DISTILLATION = "DISTILLATION",
|
|
7372
|
+
/**
|
|
7373
|
+
* Reinforcement tuning.
|
|
7374
|
+
*/
|
|
7375
|
+
REINFORCEMENT_TUNING = "REINFORCEMENT_TUNING"
|
|
7141
7376
|
}
|
|
7142
7377
|
|
|
7143
7378
|
/** Tuning mode. This enum is not supported in Gemini API. */
|
|
@@ -7409,13 +7644,13 @@ declare namespace types {
|
|
|
7409
7644
|
PhishBlockThreshold,
|
|
7410
7645
|
Behavior,
|
|
7411
7646
|
DynamicRetrievalConfigMode,
|
|
7412
|
-
FunctionCallingConfigMode,
|
|
7413
7647
|
ThinkingLevel,
|
|
7414
7648
|
PersonGeneration,
|
|
7415
7649
|
ProminentPeople,
|
|
7416
7650
|
HarmCategory,
|
|
7417
7651
|
HarmBlockMethod,
|
|
7418
7652
|
HarmBlockThreshold,
|
|
7653
|
+
FunctionCallingConfigMode,
|
|
7419
7654
|
FinishReason,
|
|
7420
7655
|
HarmProbability,
|
|
7421
7656
|
HarmSeverity,
|
|
@@ -7452,6 +7687,9 @@ declare namespace types {
|
|
|
7452
7687
|
VideoGenerationMaskMode,
|
|
7453
7688
|
VideoCompressionQuality,
|
|
7454
7689
|
ImageResizeMode,
|
|
7690
|
+
ResponseParseType,
|
|
7691
|
+
MatchOperation,
|
|
7692
|
+
ReinforcementTuningThinkingLevel,
|
|
7455
7693
|
TuningMethod,
|
|
7456
7694
|
FileState,
|
|
7457
7695
|
FileSource,
|
|
@@ -7526,10 +7764,6 @@ declare namespace types {
|
|
|
7526
7764
|
StreamableHttpTransport,
|
|
7527
7765
|
McpServer,
|
|
7528
7766
|
Tool,
|
|
7529
|
-
LatLng,
|
|
7530
|
-
RetrievalConfig,
|
|
7531
|
-
FunctionCallingConfig,
|
|
7532
|
-
ToolConfig,
|
|
7533
7767
|
ReplicatedVoiceConfig,
|
|
7534
7768
|
PrebuiltVoiceConfig,
|
|
7535
7769
|
VoiceConfig,
|
|
@@ -7544,6 +7778,10 @@ declare namespace types {
|
|
|
7544
7778
|
GenerationConfigRoutingConfigManualRoutingMode,
|
|
7545
7779
|
GenerationConfigRoutingConfig,
|
|
7546
7780
|
SafetySetting,
|
|
7781
|
+
LatLng,
|
|
7782
|
+
RetrievalConfig,
|
|
7783
|
+
FunctionCallingConfig,
|
|
7784
|
+
ToolConfig,
|
|
7547
7785
|
ModelArmorConfig,
|
|
7548
7786
|
GenerateContentConfig,
|
|
7549
7787
|
GenerateContentParameters,
|
|
@@ -7660,6 +7898,21 @@ declare namespace types {
|
|
|
7660
7898
|
DistillationHyperParameters,
|
|
7661
7899
|
DistillationSamplingSpec,
|
|
7662
7900
|
DistillationSpec,
|
|
7901
|
+
AutoraterConfig,
|
|
7902
|
+
ReinforcementTuningParseResponseConfig,
|
|
7903
|
+
ReinforcementTuningAutoraterScorerParsedResponseConversionScorer,
|
|
7904
|
+
ReinforcementTuningAutoraterScorerExactMatchScorer,
|
|
7905
|
+
ReinforcementTuningAutoraterScorer,
|
|
7906
|
+
ReinforcementTuningCodeExecutionRewardScorer,
|
|
7907
|
+
ReinforcementTuningStringMatchRewardScorerStringMatchExpression,
|
|
7908
|
+
ReinforcementTuningStringMatchRewardScorerJsonMatchExpression,
|
|
7909
|
+
ReinforcementTuningStringMatchRewardScorer,
|
|
7910
|
+
ReinforcementTuningCloudRunRewardScorer,
|
|
7911
|
+
SingleReinforcementTuningRewardConfig,
|
|
7912
|
+
CompositeReinforcementTuningRewardConfigWeightedRewardConfig,
|
|
7913
|
+
CompositeReinforcementTuningRewardConfig,
|
|
7914
|
+
ReinforcementTuningHyperParameters,
|
|
7915
|
+
ReinforcementTuningSpec,
|
|
7663
7916
|
GoogleRpcStatus,
|
|
7664
7917
|
PreTunedModel,
|
|
7665
7918
|
DatasetDistributionDistributionBucket,
|
|
@@ -7709,6 +7962,11 @@ declare namespace types {
|
|
|
7709
7962
|
CreateTuningJobConfig,
|
|
7710
7963
|
CreateTuningJobParametersPrivate,
|
|
7711
7964
|
TuningOperation,
|
|
7965
|
+
ReinforcementTuningExample,
|
|
7966
|
+
ValidateRewardConfig,
|
|
7967
|
+
ValidateRewardParameters,
|
|
7968
|
+
ReinforcementTuningRewardInfo,
|
|
7969
|
+
ValidateRewardResponse,
|
|
7712
7970
|
CreateCachedContentConfig,
|
|
7713
7971
|
CreateCachedContentParameters,
|
|
7714
7972
|
CachedContentUsageMetadata,
|
|
@@ -7846,7 +8104,7 @@ declare namespace types {
|
|
|
7846
8104
|
LiveClientRealtimeInput,
|
|
7847
8105
|
LiveClientToolResponse,
|
|
7848
8106
|
LiveClientMessage,
|
|
7849
|
-
|
|
8107
|
+
TranslationConfig,
|
|
7850
8108
|
LiveConnectConfig,
|
|
7851
8109
|
LiveConnectParameters,
|
|
7852
8110
|
CreateChatParameters,
|
|
@@ -8230,6 +8488,53 @@ declare enum VadSignalType {
|
|
|
8230
8488
|
VAD_SIGNAL_TYPE_EOS = "VAD_SIGNAL_TYPE_EOS"
|
|
8231
8489
|
}
|
|
8232
8490
|
|
|
8491
|
+
/** Optional parameters for tunings.validate_reward. */
|
|
8492
|
+
declare interface ValidateRewardConfig {
|
|
8493
|
+
/** Used to override HTTP request options. */
|
|
8494
|
+
httpOptions?: HttpOptions;
|
|
8495
|
+
/** Abort signal which can be used to cancel the request.
|
|
8496
|
+
|
|
8497
|
+
NOTE: AbortSignal is a client-only operation. Using it to cancel an
|
|
8498
|
+
operation will not cancel the request in the service. You will still
|
|
8499
|
+
be charged usage for any applicable operations.
|
|
8500
|
+
*/
|
|
8501
|
+
abortSignal?: AbortSignal;
|
|
8502
|
+
}
|
|
8503
|
+
|
|
8504
|
+
/** Parameters for the validate_reward method.
|
|
8505
|
+
|
|
8506
|
+
Validates a reinforcement tuning reward configuration against a sample
|
|
8507
|
+
response and example before creating a reinforcement tuning job. */
|
|
8508
|
+
declare interface ValidateRewardParameters {
|
|
8509
|
+
/** Required. The resource name of the Location to validate the reward in, e.g. `projects/{project}/locations/{location}`. */
|
|
8510
|
+
parent: string;
|
|
8511
|
+
/** Required. The sample response for validating the reward configuration. */
|
|
8512
|
+
sampleResponse: Content;
|
|
8513
|
+
/** Required. The example to validate the reward configuration. */
|
|
8514
|
+
example: ReinforcementTuningExample;
|
|
8515
|
+
/** Single reward function configuration for reinforcement tuning. Mutually exclusive with composite_reward_config. */
|
|
8516
|
+
singleRewardConfig?: SingleReinforcementTuningRewardConfig;
|
|
8517
|
+
/** Composite reward function configuration for reinforcement tuning. Mutually exclusive with single_reward_config. */
|
|
8518
|
+
compositeRewardConfig?: CompositeReinforcementTuningRewardConfig;
|
|
8519
|
+
/** Optional parameters for the request. */
|
|
8520
|
+
config?: ValidateRewardConfig;
|
|
8521
|
+
}
|
|
8522
|
+
|
|
8523
|
+
/** Response for the validate_reward method.
|
|
8524
|
+
|
|
8525
|
+
Contains the computed reward for a reinforcement tuning reward
|
|
8526
|
+
configuration. */
|
|
8527
|
+
declare class ValidateRewardResponse {
|
|
8528
|
+
/** Used to retain the full HTTP response. */
|
|
8529
|
+
sdkHttpResponse?: HttpResponse;
|
|
8530
|
+
/** Output only. The overall weighted reward. For a `CompositeReinforcementTuningRewardConfig`, this is the weighted average of all rewards. For a `SingleReinforcementTuningRewardConfig`, this will be the value of the single reward. */
|
|
8531
|
+
overallReward?: number;
|
|
8532
|
+
/** Output only. In case of an error, this field will be populated with a detailed error message to help with debugging. */
|
|
8533
|
+
error?: string;
|
|
8534
|
+
/** A map from reward name to reward info. */
|
|
8535
|
+
rewardInfoDetails?: Record<string, ReinforcementTuningRewardInfo>;
|
|
8536
|
+
}
|
|
8537
|
+
|
|
8233
8538
|
/** Hyperparameters for Veo. This data type is not supported in Gemini API. */
|
|
8234
8539
|
declare interface VeoHyperParameters {
|
|
8235
8540
|
/** Optional. Number of complete passes the model makes over the entire training dataset during training. */
|