@google/genai 2.7.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 +292 -47
- package/dist/index.cjs +432 -64
- package/dist/index.mjs +430 -65
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +432 -64
- package/dist/node/index.mjs +430 -65
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +292 -47
- package/dist/tokenizer/node.cjs +53 -1
- package/dist/tokenizer/node.d.ts +14 -28
- package/dist/tokenizer/node.mjs +53 -1
- package/dist/tokenizer/node.mjs.map +1 -1
- package/dist/vertex_internal/index.cjs +54 -2
- package/dist/vertex_internal/index.cjs.map +1 -1
- package/dist/vertex_internal/index.d.ts +291 -47
- package/dist/vertex_internal/index.js +54 -2
- package/dist/vertex_internal/index.js.map +1 -1
- package/dist/web/index.mjs +430 -65
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +292 -47
- package/package.json +1 -1
|
@@ -1484,6 +1484,10 @@ declare interface CreateTuningJobConfig {
|
|
|
1484
1484
|
checkpointInterval?: number;
|
|
1485
1485
|
/** The maximum number of tokens to generate per prompt. Reinforcement tuning only. */
|
|
1486
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;
|
|
1487
1491
|
}
|
|
1488
1492
|
|
|
1489
1493
|
/** Fine-tuning job creation parameters - optional fields. */
|
|
@@ -2600,14 +2604,13 @@ declare interface FunctionDeclaration {
|
|
|
2600
2604
|
behavior?: Behavior;
|
|
2601
2605
|
}
|
|
2602
2606
|
|
|
2603
|
-
/**
|
|
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. */
|
|
2604
2608
|
declare class FunctionResponse {
|
|
2605
|
-
/** 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. */
|
|
2606
2610
|
willContinue?: boolean;
|
|
2607
|
-
/** 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. */
|
|
2608
2612
|
scheduling?: FunctionResponseScheduling;
|
|
2609
|
-
/**
|
|
2610
|
-
have a different IANA MIME type. */
|
|
2613
|
+
/** Optional. Ordered `Parts` that constitute a function response. Parts may have different IANA MIME types. */
|
|
2611
2614
|
parts?: FunctionResponsePart[];
|
|
2612
2615
|
/** Optional. The id of the function call this response is for. Populated by the client to match the corresponding function call `id`. */
|
|
2613
2616
|
id?: string;
|
|
@@ -2617,49 +2620,36 @@ declare class FunctionResponse {
|
|
|
2617
2620
|
response?: Record<string, unknown>;
|
|
2618
2621
|
}
|
|
2619
2622
|
|
|
2620
|
-
/** Raw media bytes for function response.
|
|
2621
|
-
|
|
2622
|
-
Text should not be sent as raw bytes, use the FunctionResponse.response
|
|
2623
|
-
field. */
|
|
2623
|
+
/** Raw media bytes for function response. Text should not be sent as raw bytes, use the 'text' field. */
|
|
2624
2624
|
declare class FunctionResponseBlob {
|
|
2625
2625
|
/** Required. The IANA standard MIME type of the source data. */
|
|
2626
2626
|
mimeType?: string;
|
|
2627
|
-
/** Required.
|
|
2627
|
+
/** Required. Raw bytes.
|
|
2628
2628
|
* @remarks Encoded as base64 string. */
|
|
2629
2629
|
data?: string;
|
|
2630
|
-
/** Optional. Display name of the blob.
|
|
2631
|
-
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. */
|
|
2632
2631
|
displayName?: string;
|
|
2633
2632
|
}
|
|
2634
2633
|
|
|
2635
|
-
/** URI based data for function response. */
|
|
2634
|
+
/** URI based data for function response. This data type is not supported in Gemini API. */
|
|
2636
2635
|
declare class FunctionResponseFileData {
|
|
2637
2636
|
/** Required. URI. */
|
|
2638
2637
|
fileUri?: string;
|
|
2639
2638
|
/** Required. The IANA standard MIME type of the source data. */
|
|
2640
2639
|
mimeType?: string;
|
|
2641
|
-
/** Optional. Display name of the file.
|
|
2642
|
-
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. */
|
|
2643
2641
|
displayName?: string;
|
|
2644
2642
|
}
|
|
2645
2643
|
|
|
2646
|
-
/** A datatype containing media that is part of a `FunctionResponse` message.
|
|
2647
|
-
|
|
2648
|
-
A `FunctionResponsePart` consists of data which has an associated datatype. A
|
|
2649
|
-
`FunctionResponsePart` can only contain one of the accepted types in
|
|
2650
|
-
`FunctionResponsePart.data`.
|
|
2651
|
-
|
|
2652
|
-
A `FunctionResponsePart` must have a fixed IANA MIME type identifying the
|
|
2653
|
-
type and subtype of the media if the `inline_data` field is filled with raw
|
|
2654
|
-
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. */
|
|
2655
2645
|
declare class FunctionResponsePart {
|
|
2656
|
-
/**
|
|
2646
|
+
/** Inline media bytes. */
|
|
2657
2647
|
inlineData?: FunctionResponseBlob;
|
|
2658
|
-
/**
|
|
2648
|
+
/** URI based data. This field is not supported in Gemini API. */
|
|
2659
2649
|
fileData?: FunctionResponseFileData;
|
|
2660
2650
|
}
|
|
2661
2651
|
|
|
2662
|
-
/** 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. */
|
|
2663
2653
|
declare enum FunctionResponseScheduling {
|
|
2664
2654
|
/**
|
|
2665
2655
|
* This value is unused.
|
|
@@ -3569,7 +3559,7 @@ export declare function getValueByPath(data: unknown, keys: string[], defaultVal
|
|
|
3569
3559
|
declare interface GoogleMaps {
|
|
3570
3560
|
/** The authentication config to access the API. Only API key is supported. This field is not supported in Gemini API. */
|
|
3571
3561
|
authConfig?: AuthConfig;
|
|
3572
|
-
/**
|
|
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. */
|
|
3573
3563
|
enableWidget?: boolean;
|
|
3574
3564
|
}
|
|
3575
3565
|
|
|
@@ -4831,8 +4821,8 @@ declare interface LiveConnectConfig {
|
|
|
4831
4821
|
response.
|
|
4832
4822
|
*/
|
|
4833
4823
|
safetySettings?: SafetySetting[];
|
|
4834
|
-
/** Config for
|
|
4835
|
-
|
|
4824
|
+
/** Config for translation. */
|
|
4825
|
+
translationConfig?: TranslationConfig;
|
|
4836
4826
|
}
|
|
4837
4827
|
|
|
4838
4828
|
/** Config for LiveConnectConstraints for Auth Token creation. */
|
|
@@ -5261,6 +5251,26 @@ declare enum MaskReferenceMode {
|
|
|
5261
5251
|
MASK_MODE_SEMANTIC = "MASK_MODE_SEMANTIC"
|
|
5262
5252
|
}
|
|
5263
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
|
+
|
|
5264
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. */
|
|
5265
5275
|
declare interface McpServer {
|
|
5266
5276
|
/** The name of the MCPServer. */
|
|
@@ -6121,6 +6131,145 @@ declare class RegisterFilesResponse {
|
|
|
6121
6131
|
declare interface ReinforcementTuningAutoraterScorer {
|
|
6122
6132
|
/** Autorater config for evaluation. */
|
|
6123
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"
|
|
6124
6273
|
}
|
|
6125
6274
|
|
|
6126
6275
|
/** Represents a recorded session. */
|
|
@@ -6176,6 +6325,22 @@ declare enum ResourceScope {
|
|
|
6176
6325
|
COLLECTION = "COLLECTION"
|
|
6177
6326
|
}
|
|
6178
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
|
+
|
|
6179
6344
|
/** Defines a retrieval tool that model can call to access external knowledge. This data type is not supported in Gemini API. */
|
|
6180
6345
|
declare interface Retrieval {
|
|
6181
6346
|
/** Optional. Deprecated. This option is no longer supported. */
|
|
@@ -6549,7 +6714,18 @@ declare class SingleEmbedContentResponse {
|
|
|
6549
6714
|
|
|
6550
6715
|
/** Single reinforcement tuning reward config. */
|
|
6551
6716
|
declare interface SingleReinforcementTuningRewardConfig {
|
|
6717
|
+
/** Scores parsed responses for autorater use cases by using a model to compute the reward. */
|
|
6552
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;
|
|
6553
6729
|
}
|
|
6554
6730
|
|
|
6555
6731
|
/** Context window will be truncated by keeping only suffix of it.
|
|
@@ -6613,17 +6789,6 @@ declare interface StreamableHttpTransport {
|
|
|
6613
6789
|
url?: string;
|
|
6614
6790
|
}
|
|
6615
6791
|
|
|
6616
|
-
/** Config for stream translation. */
|
|
6617
|
-
declare interface StreamTranslationConfig {
|
|
6618
|
-
/** If true, the model will generate audio when the target language is
|
|
6619
|
-
spoken, essentially it will parrot the input. If false, we will not produce
|
|
6620
|
-
audio for the target language. */
|
|
6621
|
-
echoTargetLanguage?: boolean;
|
|
6622
|
-
/** The target language for translation. Supported values are BCP-47
|
|
6623
|
-
language codes (e.g. "en", "es", "fr"). */
|
|
6624
|
-
targetLanguageCode?: string;
|
|
6625
|
-
}
|
|
6626
|
-
|
|
6627
6792
|
/** User provided string values assigned to a single metadata key. This data type is not supported in Vertex AI. */
|
|
6628
6793
|
declare interface StringList {
|
|
6629
6794
|
/** The string values of the metadata to store. */
|
|
@@ -6997,6 +7162,19 @@ declare interface Transcription {
|
|
|
6997
7162
|
text?: string;
|
|
6998
7163
|
/** Optional. The bool indicates the end of the transcription. */
|
|
6999
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;
|
|
7000
7178
|
}
|
|
7001
7179
|
|
|
7002
7180
|
/** TunedModel for the Tuned Model of a Tuning Job. */
|
|
@@ -7105,6 +7283,7 @@ declare interface TuningJob {
|
|
|
7105
7283
|
preferenceOptimizationSpec?: PreferenceOptimizationSpec;
|
|
7106
7284
|
/** Tuning Spec for Distillation. */
|
|
7107
7285
|
distillationSpec?: DistillationSpec;
|
|
7286
|
+
reinforcementTuningSpec?: ReinforcementTuningSpec;
|
|
7108
7287
|
/** Output only. The tuning data statistics associated with this TuningJob. */
|
|
7109
7288
|
tuningDataStats?: TuningDataStats;
|
|
7110
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. */
|
|
@@ -7508,6 +7687,9 @@ declare namespace types {
|
|
|
7508
7687
|
VideoGenerationMaskMode,
|
|
7509
7688
|
VideoCompressionQuality,
|
|
7510
7689
|
ImageResizeMode,
|
|
7690
|
+
ResponseParseType,
|
|
7691
|
+
MatchOperation,
|
|
7692
|
+
ReinforcementTuningThinkingLevel,
|
|
7511
7693
|
TuningMethod,
|
|
7512
7694
|
FileState,
|
|
7513
7695
|
FileSource,
|
|
@@ -7716,6 +7898,21 @@ declare namespace types {
|
|
|
7716
7898
|
DistillationHyperParameters,
|
|
7717
7899
|
DistillationSamplingSpec,
|
|
7718
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,
|
|
7719
7916
|
GoogleRpcStatus,
|
|
7720
7917
|
PreTunedModel,
|
|
7721
7918
|
DatasetDistributionDistributionBucket,
|
|
@@ -7762,14 +7959,14 @@ declare namespace types {
|
|
|
7762
7959
|
TuningExample,
|
|
7763
7960
|
TuningDataset,
|
|
7764
7961
|
TuningValidationDataset,
|
|
7765
|
-
AutoraterConfig,
|
|
7766
|
-
ReinforcementTuningAutoraterScorer,
|
|
7767
|
-
SingleReinforcementTuningRewardConfig,
|
|
7768
|
-
CompositeReinforcementTuningRewardConfigWeightedRewardConfig,
|
|
7769
|
-
CompositeReinforcementTuningRewardConfig,
|
|
7770
7962
|
CreateTuningJobConfig,
|
|
7771
7963
|
CreateTuningJobParametersPrivate,
|
|
7772
7964
|
TuningOperation,
|
|
7965
|
+
ReinforcementTuningExample,
|
|
7966
|
+
ValidateRewardConfig,
|
|
7967
|
+
ValidateRewardParameters,
|
|
7968
|
+
ReinforcementTuningRewardInfo,
|
|
7969
|
+
ValidateRewardResponse,
|
|
7773
7970
|
CreateCachedContentConfig,
|
|
7774
7971
|
CreateCachedContentParameters,
|
|
7775
7972
|
CachedContentUsageMetadata,
|
|
@@ -7907,7 +8104,7 @@ declare namespace types {
|
|
|
7907
8104
|
LiveClientRealtimeInput,
|
|
7908
8105
|
LiveClientToolResponse,
|
|
7909
8106
|
LiveClientMessage,
|
|
7910
|
-
|
|
8107
|
+
TranslationConfig,
|
|
7911
8108
|
LiveConnectConfig,
|
|
7912
8109
|
LiveConnectParameters,
|
|
7913
8110
|
CreateChatParameters,
|
|
@@ -8291,6 +8488,53 @@ declare enum VadSignalType {
|
|
|
8291
8488
|
VAD_SIGNAL_TYPE_EOS = "VAD_SIGNAL_TYPE_EOS"
|
|
8292
8489
|
}
|
|
8293
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
|
+
|
|
8294
8538
|
/** Hyperparameters for Veo. This data type is not supported in Gemini API. */
|
|
8295
8539
|
declare interface VeoHyperParameters {
|
|
8296
8540
|
/** Optional. Number of complete passes the model makes over the entire training dataset during training. */
|
|
@@ -360,7 +360,7 @@ var Language;
|
|
|
360
360
|
*/
|
|
361
361
|
Language["PYTHON"] = "PYTHON";
|
|
362
362
|
})(Language || (Language = {}));
|
|
363
|
-
/** Specifies how the response should be scheduled in the conversation. */
|
|
363
|
+
/** Specifies how the response should be scheduled in the conversation. Only applicable to NON_BLOCKING function calls, is ignored otherwise. Defaults to WHEN_IDLE. */
|
|
364
364
|
var FunctionResponseScheduling;
|
|
365
365
|
(function (FunctionResponseScheduling) {
|
|
366
366
|
/**
|
|
@@ -1556,6 +1556,58 @@ var ImageResizeMode;
|
|
|
1556
1556
|
*/
|
|
1557
1557
|
ImageResizeMode["PAD"] = "PAD";
|
|
1558
1558
|
})(ImageResizeMode || (ImageResizeMode = {}));
|
|
1559
|
+
/** Defines how to parse sample response. */
|
|
1560
|
+
var ResponseParseType;
|
|
1561
|
+
(function (ResponseParseType) {
|
|
1562
|
+
/**
|
|
1563
|
+
* Default value. This value is unused.
|
|
1564
|
+
*/
|
|
1565
|
+
ResponseParseType["RESPONSE_PARSE_TYPE_UNSPECIFIED"] = "RESPONSE_PARSE_TYPE_UNSPECIFIED";
|
|
1566
|
+
/**
|
|
1567
|
+
* Use the sample response as is.
|
|
1568
|
+
*/
|
|
1569
|
+
ResponseParseType["IDENTITY"] = "IDENTITY";
|
|
1570
|
+
/**
|
|
1571
|
+
* Use regex to extract the important part of sample response.
|
|
1572
|
+
*/
|
|
1573
|
+
ResponseParseType["REGEX_EXTRACT"] = "REGEX_EXTRACT";
|
|
1574
|
+
})(ResponseParseType || (ResponseParseType = {}));
|
|
1575
|
+
/** Match operation to use for evaluation. */
|
|
1576
|
+
var MatchOperation;
|
|
1577
|
+
(function (MatchOperation) {
|
|
1578
|
+
/**
|
|
1579
|
+
* Default value. This value is unused.
|
|
1580
|
+
*/
|
|
1581
|
+
MatchOperation["MATCH_OPERATION_UNSPECIFIED"] = "MATCH_OPERATION_UNSPECIFIED";
|
|
1582
|
+
/**
|
|
1583
|
+
* Equivalent to GoogleSQL `REGEX_CONTAINS(target, expression)`.
|
|
1584
|
+
*/
|
|
1585
|
+
MatchOperation["REGEX_CONTAINS"] = "REGEX_CONTAINS";
|
|
1586
|
+
/**
|
|
1587
|
+
* `expression` is a substring of target.
|
|
1588
|
+
*/
|
|
1589
|
+
MatchOperation["PARTIAL_MATCH"] = "PARTIAL_MATCH";
|
|
1590
|
+
/**
|
|
1591
|
+
* `expression` is an exact match of target.
|
|
1592
|
+
*/
|
|
1593
|
+
MatchOperation["EXACT_MATCH"] = "EXACT_MATCH";
|
|
1594
|
+
})(MatchOperation || (MatchOperation = {}));
|
|
1595
|
+
/** Represents how much to think for the tuning job. */
|
|
1596
|
+
var ReinforcementTuningThinkingLevel;
|
|
1597
|
+
(function (ReinforcementTuningThinkingLevel) {
|
|
1598
|
+
/**
|
|
1599
|
+
* Unspecified thinking level.
|
|
1600
|
+
*/
|
|
1601
|
+
ReinforcementTuningThinkingLevel["REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED"] = "REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED";
|
|
1602
|
+
/**
|
|
1603
|
+
* Little to no thinking.
|
|
1604
|
+
*/
|
|
1605
|
+
ReinforcementTuningThinkingLevel["MINIMAL"] = "MINIMAL";
|
|
1606
|
+
/**
|
|
1607
|
+
* High thinking level.
|
|
1608
|
+
*/
|
|
1609
|
+
ReinforcementTuningThinkingLevel["HIGH"] = "HIGH";
|
|
1610
|
+
})(ReinforcementTuningThinkingLevel || (ReinforcementTuningThinkingLevel = {}));
|
|
1559
1611
|
/** Enum representing the tuning method. */
|
|
1560
1612
|
var TuningMethod;
|
|
1561
1613
|
(function (TuningMethod) {
|
|
@@ -2094,7 +2146,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
2094
2146
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
2095
2147
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
2096
2148
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
2097
|
-
const SDK_VERSION = '2.
|
|
2149
|
+
const SDK_VERSION = '2.8.0'; // x-release-please-version
|
|
2098
2150
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
2099
2151
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
2100
2152
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|