@google/genai 2.7.0 → 2.9.0-rc.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 +7 -0
- package/dist/genai.d.ts +3688 -2587
- package/dist/index.cjs +4562 -2037
- package/dist/index.mjs +4560 -2038
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +4486 -1961
- package/dist/node/index.mjs +4484 -1962
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +3688 -2587
- package/dist/tokenizer/node.cjs +117 -65
- package/dist/tokenizer/node.d.ts +14 -28
- package/dist/tokenizer/node.mjs +117 -65
- package/dist/tokenizer/node.mjs.map +1 -1
- package/dist/vertex_internal/index.cjs +118 -66
- package/dist/vertex_internal/index.cjs.map +1 -1
- package/dist/vertex_internal/index.d.ts +317 -84
- package/dist/vertex_internal/index.js +118 -66
- package/dist/vertex_internal/index.js.map +1 -1
- package/dist/web/index.mjs +4502 -1981
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +3688 -2587
- package/package.json +2 -2
|
@@ -157,7 +157,7 @@ declare interface ApiAuthApiKeyConfig {
|
|
|
157
157
|
* WARNING: This is an internal API and may change without notice. Direct usage
|
|
158
158
|
* is not supported and may break your application.
|
|
159
159
|
*/
|
|
160
|
-
export declare class ApiClient
|
|
160
|
+
export declare class ApiClient {
|
|
161
161
|
readonly clientOptions: ApiClientInitOptions;
|
|
162
162
|
private readonly customBaseUrl?;
|
|
163
163
|
constructor(opts: ApiClientInitOptions);
|
|
@@ -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. */
|
|
@@ -2177,7 +2181,7 @@ declare interface Endpoint {
|
|
|
2177
2181
|
/** End of speech sensitivity. */
|
|
2178
2182
|
declare enum EndSensitivity {
|
|
2179
2183
|
/**
|
|
2180
|
-
* The default is END_SENSITIVITY_LOW.
|
|
2184
|
+
* The default is END_SENSITIVITY_LOW for Gemini Enterprise Agent Platform and END_SENSITIVITY_HIGH for Gemini Live.
|
|
2181
2185
|
*/
|
|
2182
2186
|
END_SENSITIVITY_UNSPECIFIED = "END_SENSITIVITY_UNSPECIFIED",
|
|
2183
2187
|
/**
|
|
@@ -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.
|
|
@@ -2685,18 +2675,6 @@ declare interface GcsSource {
|
|
|
2685
2675
|
uris?: string[];
|
|
2686
2676
|
}
|
|
2687
2677
|
|
|
2688
|
-
/**
|
|
2689
|
-
* @license
|
|
2690
|
-
* Copyright 2025 Google LLC
|
|
2691
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
2692
|
-
*/
|
|
2693
|
-
declare interface GeminiNextGenAPIClientAdapter {
|
|
2694
|
-
isVertexAI: () => boolean;
|
|
2695
|
-
getProject: () => string | undefined;
|
|
2696
|
-
getLocation: () => string | undefined;
|
|
2697
|
-
getAuthHeaders: () => Headers | Promise<Headers>;
|
|
2698
|
-
}
|
|
2699
|
-
|
|
2700
2678
|
/** Input example for preference optimization. This data type is not supported in Gemini API. */
|
|
2701
2679
|
declare interface GeminiPreferenceExample {
|
|
2702
2680
|
/** List of completions for a given prompt. */
|
|
@@ -3569,7 +3547,7 @@ export declare function getValueByPath(data: unknown, keys: string[], defaultVal
|
|
|
3569
3547
|
declare interface GoogleMaps {
|
|
3570
3548
|
/** The authentication config to access the API. Only API key is supported. This field is not supported in Gemini API. */
|
|
3571
3549
|
authConfig?: AuthConfig;
|
|
3572
|
-
/**
|
|
3550
|
+
/** 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
3551
|
enableWidget?: boolean;
|
|
3574
3552
|
}
|
|
3575
3553
|
|
|
@@ -4831,8 +4809,8 @@ declare interface LiveConnectConfig {
|
|
|
4831
4809
|
response.
|
|
4832
4810
|
*/
|
|
4833
4811
|
safetySettings?: SafetySetting[];
|
|
4834
|
-
/** Config for
|
|
4835
|
-
|
|
4812
|
+
/** Config for translation. */
|
|
4813
|
+
translationConfig?: TranslationConfig;
|
|
4836
4814
|
}
|
|
4837
4815
|
|
|
4838
4816
|
/** Config for LiveConnectConstraints for Auth Token creation. */
|
|
@@ -5261,6 +5239,26 @@ declare enum MaskReferenceMode {
|
|
|
5261
5239
|
MASK_MODE_SEMANTIC = "MASK_MODE_SEMANTIC"
|
|
5262
5240
|
}
|
|
5263
5241
|
|
|
5242
|
+
/** Match operation to use for evaluation. */
|
|
5243
|
+
declare enum MatchOperation {
|
|
5244
|
+
/**
|
|
5245
|
+
* Default value. This value is unused.
|
|
5246
|
+
*/
|
|
5247
|
+
MATCH_OPERATION_UNSPECIFIED = "MATCH_OPERATION_UNSPECIFIED",
|
|
5248
|
+
/**
|
|
5249
|
+
* Equivalent to GoogleSQL `REGEX_CONTAINS(target, expression)`.
|
|
5250
|
+
*/
|
|
5251
|
+
REGEX_CONTAINS = "REGEX_CONTAINS",
|
|
5252
|
+
/**
|
|
5253
|
+
* `expression` is a substring of target.
|
|
5254
|
+
*/
|
|
5255
|
+
PARTIAL_MATCH = "PARTIAL_MATCH",
|
|
5256
|
+
/**
|
|
5257
|
+
* `expression` is an exact match of target.
|
|
5258
|
+
*/
|
|
5259
|
+
EXACT_MATCH = "EXACT_MATCH"
|
|
5260
|
+
}
|
|
5261
|
+
|
|
5264
5262
|
/** 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
5263
|
declare interface McpServer {
|
|
5266
5264
|
/** The name of the MCPServer. */
|
|
@@ -5269,30 +5267,30 @@ declare interface McpServer {
|
|
|
5269
5267
|
streamableHttpTransport?: StreamableHttpTransport;
|
|
5270
5268
|
}
|
|
5271
5269
|
|
|
5272
|
-
/**
|
|
5270
|
+
/** The modality that this token count applies to. */
|
|
5273
5271
|
declare enum MediaModality {
|
|
5274
5272
|
/**
|
|
5275
|
-
*
|
|
5273
|
+
* When a modality is not specified, it is treated as `TEXT`.
|
|
5276
5274
|
*/
|
|
5277
5275
|
MODALITY_UNSPECIFIED = "MODALITY_UNSPECIFIED",
|
|
5278
5276
|
/**
|
|
5279
|
-
*
|
|
5277
|
+
* The `Part` contains plain text.
|
|
5280
5278
|
*/
|
|
5281
5279
|
TEXT = "TEXT",
|
|
5282
5280
|
/**
|
|
5283
|
-
*
|
|
5281
|
+
* The `Part` contains an image.
|
|
5284
5282
|
*/
|
|
5285
5283
|
IMAGE = "IMAGE",
|
|
5286
5284
|
/**
|
|
5287
|
-
*
|
|
5285
|
+
* The `Part` contains a video.
|
|
5288
5286
|
*/
|
|
5289
5287
|
VIDEO = "VIDEO",
|
|
5290
5288
|
/**
|
|
5291
|
-
*
|
|
5289
|
+
* The `Part` contains audio.
|
|
5292
5290
|
*/
|
|
5293
5291
|
AUDIO = "AUDIO",
|
|
5294
5292
|
/**
|
|
5295
|
-
*
|
|
5293
|
+
* The `Part` contains a document, such as a PDF.
|
|
5296
5294
|
*/
|
|
5297
5295
|
DOCUMENT = "DOCUMENT"
|
|
5298
5296
|
}
|
|
@@ -5341,9 +5339,9 @@ declare enum Modality {
|
|
|
5341
5339
|
VIDEO = "VIDEO"
|
|
5342
5340
|
}
|
|
5343
5341
|
|
|
5344
|
-
/** Represents token
|
|
5342
|
+
/** Represents a breakdown of token usage by modality. This message is used in CountTokensResponse and GenerateContentResponse.UsageMetadata to provide a detailed view of how many tokens are used by each modality (e.g., text, image, video) in a request. This is particularly useful for multimodal models, allowing you to track and manage token consumption for billing and quota purposes. */
|
|
5345
5343
|
declare interface ModalityTokenCount {
|
|
5346
|
-
/** The modality
|
|
5344
|
+
/** The modality that this token count applies to. */
|
|
5347
5345
|
modality?: MediaModality;
|
|
5348
5346
|
/** The number of tokens counted for this modality. */
|
|
5349
5347
|
tokenCount?: number;
|
|
@@ -6121,6 +6119,145 @@ declare class RegisterFilesResponse {
|
|
|
6121
6119
|
declare interface ReinforcementTuningAutoraterScorer {
|
|
6122
6120
|
/** Autorater config for evaluation. */
|
|
6123
6121
|
autoraterConfig?: AutoraterConfig;
|
|
6122
|
+
/** Allows substituting `prompt`, `response`, `system_instruction` and `references.reference` (each wrapped in double curly braces) into the autorater prompt. */
|
|
6123
|
+
autoraterPrompt?: string;
|
|
6124
|
+
/** Parses autorater returned response. */
|
|
6125
|
+
autoraterResponseParseConfig?: ReinforcementTuningParseResponseConfig;
|
|
6126
|
+
/** Scores autorater responses by directly converting parsed autorater response to float reward. */
|
|
6127
|
+
parsedResponseConversionScorer?: ReinforcementTuningAutoraterScorerParsedResponseConversionScorer;
|
|
6128
|
+
/** Scores autorater responses by using exact string match reward scorer. */
|
|
6129
|
+
exactMatchScorer?: ReinforcementTuningAutoraterScorerExactMatchScorer;
|
|
6130
|
+
}
|
|
6131
|
+
|
|
6132
|
+
/** Scores autorater responses by using exact string match reward scorer. */
|
|
6133
|
+
declare interface ReinforcementTuningAutoraterScorerExactMatchScorer {
|
|
6134
|
+
/** Assigns this reward score if parsed response string equals the expression. */
|
|
6135
|
+
correctAnswerReward?: number;
|
|
6136
|
+
/** Assigns this reward score if parsed reward value does not equal the expression. */
|
|
6137
|
+
wrongAnswerReward?: number;
|
|
6138
|
+
/** The string expression to match against. Supports substitution in the format of `references.reference` (wrapped in double curly braces) before matching. No regex support. */
|
|
6139
|
+
expression?: string;
|
|
6140
|
+
}
|
|
6141
|
+
|
|
6142
|
+
/** Scores responses by directly converting parsed autorater response to float reward (reward is clipped to be within [-1, 1]). */
|
|
6143
|
+
declare class ReinforcementTuningAutoraterScorerParsedResponseConversionScorer {
|
|
6144
|
+
}
|
|
6145
|
+
|
|
6146
|
+
/** Scores parsed responses by calling a Cloud Run service. */
|
|
6147
|
+
declare interface ReinforcementTuningCloudRunRewardScorer {
|
|
6148
|
+
/** 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. */
|
|
6149
|
+
cloudRunUri?: string;
|
|
6150
|
+
}
|
|
6151
|
+
|
|
6152
|
+
/** Scores parsed responses for code execution use cases. */
|
|
6153
|
+
declare interface ReinforcementTuningCodeExecutionRewardScorer {
|
|
6154
|
+
/** Example python code snippet which assigns reward of 1 to answer matching user provided reference answer in per prompt references map. */
|
|
6155
|
+
pythonCodeSnippet?: string;
|
|
6156
|
+
}
|
|
6157
|
+
|
|
6158
|
+
/** User-facing format for Gemini Reinforcement Tuning examples on Vertex. */
|
|
6159
|
+
declare interface ReinforcementTuningExample {
|
|
6160
|
+
/** Multi-turn contents that represents the Prompt. */
|
|
6161
|
+
contents?: Content[];
|
|
6162
|
+
/** References for the given prompt. The key is the name of the reference, and the value is the reference itself. */
|
|
6163
|
+
references?: Record<string, string>;
|
|
6164
|
+
/** Corresponds to `system_instruction` in user-facing GenerateContentRequest. */
|
|
6165
|
+
systemInstruction?: Content;
|
|
6166
|
+
}
|
|
6167
|
+
|
|
6168
|
+
/** Hyperparameters for Reinforcement Tuning. */
|
|
6169
|
+
declare interface ReinforcementTuningHyperParameters {
|
|
6170
|
+
/** Number of training epochs for the tuning job. */
|
|
6171
|
+
epochCount?: string;
|
|
6172
|
+
/** Learning rate multiplier for Reinforcement Learning. */
|
|
6173
|
+
learningRateMultiplier?: number;
|
|
6174
|
+
/** Adapter size for Reinforcement Tuning. */
|
|
6175
|
+
adapterSize?: AdapterSize;
|
|
6176
|
+
/** Number of different responses to generate per prompt during tuning. */
|
|
6177
|
+
samplesPerPrompt?: number;
|
|
6178
|
+
/** 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. */
|
|
6179
|
+
batchSize?: number;
|
|
6180
|
+
/** How often (in steps) to evaluate the tuning job during training. If not set, evaluation will run per epoch. */
|
|
6181
|
+
evaluateInterval?: number;
|
|
6182
|
+
/** How often (in steps) to save checkpoints during training. If not set, one checkpoint per epoch will be saved. */
|
|
6183
|
+
checkpointInterval?: number;
|
|
6184
|
+
/** The maximum number of tokens to generate per prompt. If not set, defaults to 32768. */
|
|
6185
|
+
maxOutputTokens?: number;
|
|
6186
|
+
/** Indicates the maximum thinking depth. Use with earlier models shall result in error. */
|
|
6187
|
+
thinkingLevel?: ReinforcementTuningThinkingLevel;
|
|
6188
|
+
}
|
|
6189
|
+
|
|
6190
|
+
/** Defines how to parse sample response for reinforcement tuning. */
|
|
6191
|
+
declare class ReinforcementTuningParseResponseConfig {
|
|
6192
|
+
/** Defines how to parse sample response. */
|
|
6193
|
+
parseType?: ResponseParseType;
|
|
6194
|
+
/** Defines the regex to extract the important part of sample response. This field is only used when `parse_type` is `REGEX_EXTRACT`. */
|
|
6195
|
+
regexExtractExpression?: string;
|
|
6196
|
+
}
|
|
6197
|
+
|
|
6198
|
+
/** The reward info for a reward function. */
|
|
6199
|
+
declare interface ReinforcementTuningRewardInfo {
|
|
6200
|
+
/** Output only. The calculated reward for the reward function. */
|
|
6201
|
+
reward?: number;
|
|
6202
|
+
/** Output only. The user-requested auxiliary info for the reward function. */
|
|
6203
|
+
userRequestedAuxInfo?: string;
|
|
6204
|
+
}
|
|
6205
|
+
|
|
6206
|
+
/** Reinforcement tuning spec for tuning. */
|
|
6207
|
+
declare interface ReinforcementTuningSpec {
|
|
6208
|
+
compositeRewardConfig?: CompositeReinforcementTuningRewardConfig;
|
|
6209
|
+
/** Cloud Storage path to file containing training dataset for tuning. The dataset must be formatted as a JSONL file. */
|
|
6210
|
+
trainingDatasetUri?: string;
|
|
6211
|
+
/** 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. */
|
|
6212
|
+
validationDatasetUri?: string;
|
|
6213
|
+
/** Additional hyper-parameters to use during tuning. */
|
|
6214
|
+
hyperParameters?: ReinforcementTuningHyperParameters;
|
|
6215
|
+
/** Single reward function configuration for reinforcement tuning. */
|
|
6216
|
+
singleRewardConfig?: SingleReinforcementTuningRewardConfig;
|
|
6217
|
+
}
|
|
6218
|
+
|
|
6219
|
+
/** Scores parsed responses for string matching use cases. */
|
|
6220
|
+
declare interface ReinforcementTuningStringMatchRewardScorer {
|
|
6221
|
+
/** Wrong answer reward is returned if evaluator evaluates to `false`. All wrong answers get the same reward. */
|
|
6222
|
+
wrongAnswerReward?: number;
|
|
6223
|
+
/** Correct answer reward is returned if evaluator evaluates to `true`. All correct answers get the same reward. */
|
|
6224
|
+
correctAnswerReward?: number;
|
|
6225
|
+
/** Uses string match expression to evaluate parsed response. */
|
|
6226
|
+
stringMatchExpression?: ReinforcementTuningStringMatchRewardScorerStringMatchExpression;
|
|
6227
|
+
/** Uses json match expression to evaluate parsed response. */
|
|
6228
|
+
jsonMatchExpression?: ReinforcementTuningStringMatchRewardScorerJsonMatchExpression;
|
|
6229
|
+
}
|
|
6230
|
+
|
|
6231
|
+
/** Converts parsed responses to JSON format, finds the first-level matching key, then performs StringMatchExpression on the value. */
|
|
6232
|
+
declare interface ReinforcementTuningStringMatchRewardScorerJsonMatchExpression {
|
|
6233
|
+
/** Json key name to find the value to match against. */
|
|
6234
|
+
keyName?: string;
|
|
6235
|
+
/** String match expression to match against the value of json key. */
|
|
6236
|
+
valueStringMatchExpression?: ReinforcementTuningStringMatchRewardScorerStringMatchExpression;
|
|
6237
|
+
}
|
|
6238
|
+
|
|
6239
|
+
/** Evaluates parsed response using match type against expression. */
|
|
6240
|
+
declare interface ReinforcementTuningStringMatchRewardScorerStringMatchExpression {
|
|
6241
|
+
/** Match operation to use for evaluation. */
|
|
6242
|
+
matchOperation?: MatchOperation;
|
|
6243
|
+
/** 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). */
|
|
6244
|
+
expression?: string;
|
|
6245
|
+
}
|
|
6246
|
+
|
|
6247
|
+
/** Represents how much to think for the tuning job. */
|
|
6248
|
+
declare enum ReinforcementTuningThinkingLevel {
|
|
6249
|
+
/**
|
|
6250
|
+
* Unspecified thinking level.
|
|
6251
|
+
*/
|
|
6252
|
+
REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED = "REINFORCEMENT_TUNING_THINKING_LEVEL_UNSPECIFIED",
|
|
6253
|
+
/**
|
|
6254
|
+
* Little to no thinking.
|
|
6255
|
+
*/
|
|
6256
|
+
MINIMAL = "MINIMAL",
|
|
6257
|
+
/**
|
|
6258
|
+
* High thinking level.
|
|
6259
|
+
*/
|
|
6260
|
+
HIGH = "HIGH"
|
|
6124
6261
|
}
|
|
6125
6262
|
|
|
6126
6263
|
/** Represents a recorded session. */
|
|
@@ -6176,6 +6313,22 @@ declare enum ResourceScope {
|
|
|
6176
6313
|
COLLECTION = "COLLECTION"
|
|
6177
6314
|
}
|
|
6178
6315
|
|
|
6316
|
+
/** Defines how to parse sample response. */
|
|
6317
|
+
declare enum ResponseParseType {
|
|
6318
|
+
/**
|
|
6319
|
+
* Default value. This value is unused.
|
|
6320
|
+
*/
|
|
6321
|
+
RESPONSE_PARSE_TYPE_UNSPECIFIED = "RESPONSE_PARSE_TYPE_UNSPECIFIED",
|
|
6322
|
+
/**
|
|
6323
|
+
* Use the sample response as is.
|
|
6324
|
+
*/
|
|
6325
|
+
IDENTITY = "IDENTITY",
|
|
6326
|
+
/**
|
|
6327
|
+
* Use regex to extract the important part of sample response.
|
|
6328
|
+
*/
|
|
6329
|
+
REGEX_EXTRACT = "REGEX_EXTRACT"
|
|
6330
|
+
}
|
|
6331
|
+
|
|
6179
6332
|
/** Defines a retrieval tool that model can call to access external knowledge. This data type is not supported in Gemini API. */
|
|
6180
6333
|
declare interface Retrieval {
|
|
6181
6334
|
/** Optional. Deprecated. This option is no longer supported. */
|
|
@@ -6549,7 +6702,18 @@ declare class SingleEmbedContentResponse {
|
|
|
6549
6702
|
|
|
6550
6703
|
/** Single reinforcement tuning reward config. */
|
|
6551
6704
|
declare interface SingleReinforcementTuningRewardConfig {
|
|
6705
|
+
/** Scores parsed responses for autorater use cases by using a model to compute the reward. */
|
|
6552
6706
|
autoraterScorer?: ReinforcementTuningAutoraterScorer;
|
|
6707
|
+
/** A unique reward name used to identify each single reinforcement tuning reward. */
|
|
6708
|
+
rewardName?: string;
|
|
6709
|
+
/** Defines how to parse sample response. */
|
|
6710
|
+
parseResponseConfig?: ReinforcementTuningParseResponseConfig;
|
|
6711
|
+
/** Scores parsed responses for code execution use cases. */
|
|
6712
|
+
codeExecutionRewardScorer?: ReinforcementTuningCodeExecutionRewardScorer;
|
|
6713
|
+
/** Scores parsed responses for simple string matching use cases against reference answer without writing python code. */
|
|
6714
|
+
stringMatchRewardScorer?: ReinforcementTuningStringMatchRewardScorer;
|
|
6715
|
+
/** Scores parsed responses by calling a Cloud Run service. */
|
|
6716
|
+
cloudRunRewardScorer?: ReinforcementTuningCloudRunRewardScorer;
|
|
6553
6717
|
}
|
|
6554
6718
|
|
|
6555
6719
|
/** Context window will be truncated by keeping only suffix of it.
|
|
@@ -6586,7 +6750,7 @@ declare type SpeechConfigUnion = SpeechConfig | string;
|
|
|
6586
6750
|
/** Start of speech sensitivity. */
|
|
6587
6751
|
declare enum StartSensitivity {
|
|
6588
6752
|
/**
|
|
6589
|
-
* The default is START_SENSITIVITY_LOW.
|
|
6753
|
+
* The default is START_SENSITIVITY_LOW for Gemini Enterprise Agent Platform and START_SENSITIVITY_HIGH for Gemini Live.
|
|
6590
6754
|
*/
|
|
6591
6755
|
START_SENSITIVITY_UNSPECIFIED = "START_SENSITIVITY_UNSPECIFIED",
|
|
6592
6756
|
/**
|
|
@@ -6613,17 +6777,6 @@ declare interface StreamableHttpTransport {
|
|
|
6613
6777
|
url?: string;
|
|
6614
6778
|
}
|
|
6615
6779
|
|
|
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
6780
|
/** User provided string values assigned to a single metadata key. This data type is not supported in Vertex AI. */
|
|
6628
6781
|
declare interface StringList {
|
|
6629
6782
|
/** The string values of the metadata to store. */
|
|
@@ -6997,6 +7150,19 @@ declare interface Transcription {
|
|
|
6997
7150
|
text?: string;
|
|
6998
7151
|
/** Optional. The bool indicates the end of the transcription. */
|
|
6999
7152
|
finished?: boolean;
|
|
7153
|
+
/** The BCP-47 language code of the transcription. */
|
|
7154
|
+
languageCode?: string;
|
|
7155
|
+
}
|
|
7156
|
+
|
|
7157
|
+
/** Config for stream translation. */
|
|
7158
|
+
declare interface TranslationConfig {
|
|
7159
|
+
/** If true, the model will generate audio when the target language is
|
|
7160
|
+
spoken, essentially it will parrot the input. If false, we will not produce
|
|
7161
|
+
audio for the target language. */
|
|
7162
|
+
echoTargetLanguage?: boolean;
|
|
7163
|
+
/** The target language for translation. Supported values are BCP-47
|
|
7164
|
+
language codes (e.g. "en", "es", "fr"). */
|
|
7165
|
+
targetLanguageCode?: string;
|
|
7000
7166
|
}
|
|
7001
7167
|
|
|
7002
7168
|
/** TunedModel for the Tuned Model of a Tuning Job. */
|
|
@@ -7105,6 +7271,7 @@ declare interface TuningJob {
|
|
|
7105
7271
|
preferenceOptimizationSpec?: PreferenceOptimizationSpec;
|
|
7106
7272
|
/** Tuning Spec for Distillation. */
|
|
7107
7273
|
distillationSpec?: DistillationSpec;
|
|
7274
|
+
reinforcementTuningSpec?: ReinforcementTuningSpec;
|
|
7108
7275
|
/** Output only. The tuning data statistics associated with this TuningJob. */
|
|
7109
7276
|
tuningDataStats?: TuningDataStats;
|
|
7110
7277
|
/** 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. */
|
|
@@ -7478,9 +7645,10 @@ declare namespace types {
|
|
|
7478
7645
|
UrlRetrievalStatus,
|
|
7479
7646
|
BlockedReason,
|
|
7480
7647
|
TrafficType,
|
|
7481
|
-
|
|
7648
|
+
MediaModality,
|
|
7482
7649
|
ModelStage,
|
|
7483
7650
|
MediaResolution,
|
|
7651
|
+
Modality,
|
|
7484
7652
|
TuningMode,
|
|
7485
7653
|
AdapterSize,
|
|
7486
7654
|
JobState,
|
|
@@ -7491,10 +7659,10 @@ declare namespace types {
|
|
|
7491
7659
|
TuningTask,
|
|
7492
7660
|
VideoOrientation,
|
|
7493
7661
|
DocumentState,
|
|
7662
|
+
ServiceTier,
|
|
7494
7663
|
PartMediaResolutionLevel,
|
|
7495
7664
|
ToolType,
|
|
7496
7665
|
ResourceScope,
|
|
7497
|
-
ServiceTier,
|
|
7498
7666
|
FeatureSelectionPreference,
|
|
7499
7667
|
EmbeddingApiType,
|
|
7500
7668
|
SafetyFilterLevel,
|
|
@@ -7508,11 +7676,13 @@ declare namespace types {
|
|
|
7508
7676
|
VideoGenerationMaskMode,
|
|
7509
7677
|
VideoCompressionQuality,
|
|
7510
7678
|
ImageResizeMode,
|
|
7679
|
+
ResponseParseType,
|
|
7680
|
+
MatchOperation,
|
|
7681
|
+
ReinforcementTuningThinkingLevel,
|
|
7511
7682
|
TuningMethod,
|
|
7512
7683
|
FileState,
|
|
7513
7684
|
FileSource,
|
|
7514
7685
|
TurnCompleteReason,
|
|
7515
|
-
MediaModality,
|
|
7516
7686
|
VadSignalType,
|
|
7517
7687
|
VoiceActivityType,
|
|
7518
7688
|
StartSensitivity,
|
|
@@ -7716,6 +7886,21 @@ declare namespace types {
|
|
|
7716
7886
|
DistillationHyperParameters,
|
|
7717
7887
|
DistillationSamplingSpec,
|
|
7718
7888
|
DistillationSpec,
|
|
7889
|
+
AutoraterConfig,
|
|
7890
|
+
ReinforcementTuningParseResponseConfig,
|
|
7891
|
+
ReinforcementTuningAutoraterScorerParsedResponseConversionScorer,
|
|
7892
|
+
ReinforcementTuningAutoraterScorerExactMatchScorer,
|
|
7893
|
+
ReinforcementTuningAutoraterScorer,
|
|
7894
|
+
ReinforcementTuningCodeExecutionRewardScorer,
|
|
7895
|
+
ReinforcementTuningStringMatchRewardScorerStringMatchExpression,
|
|
7896
|
+
ReinforcementTuningStringMatchRewardScorerJsonMatchExpression,
|
|
7897
|
+
ReinforcementTuningStringMatchRewardScorer,
|
|
7898
|
+
ReinforcementTuningCloudRunRewardScorer,
|
|
7899
|
+
SingleReinforcementTuningRewardConfig,
|
|
7900
|
+
CompositeReinforcementTuningRewardConfigWeightedRewardConfig,
|
|
7901
|
+
CompositeReinforcementTuningRewardConfig,
|
|
7902
|
+
ReinforcementTuningHyperParameters,
|
|
7903
|
+
ReinforcementTuningSpec,
|
|
7719
7904
|
GoogleRpcStatus,
|
|
7720
7905
|
PreTunedModel,
|
|
7721
7906
|
DatasetDistributionDistributionBucket,
|
|
@@ -7762,14 +7947,14 @@ declare namespace types {
|
|
|
7762
7947
|
TuningExample,
|
|
7763
7948
|
TuningDataset,
|
|
7764
7949
|
TuningValidationDataset,
|
|
7765
|
-
AutoraterConfig,
|
|
7766
|
-
ReinforcementTuningAutoraterScorer,
|
|
7767
|
-
SingleReinforcementTuningRewardConfig,
|
|
7768
|
-
CompositeReinforcementTuningRewardConfigWeightedRewardConfig,
|
|
7769
|
-
CompositeReinforcementTuningRewardConfig,
|
|
7770
7950
|
CreateTuningJobConfig,
|
|
7771
7951
|
CreateTuningJobParametersPrivate,
|
|
7772
7952
|
TuningOperation,
|
|
7953
|
+
ReinforcementTuningExample,
|
|
7954
|
+
ValidateRewardConfig,
|
|
7955
|
+
ValidateRewardParameters,
|
|
7956
|
+
ReinforcementTuningRewardInfo,
|
|
7957
|
+
ValidateRewardResponse,
|
|
7773
7958
|
CreateCachedContentConfig,
|
|
7774
7959
|
CreateCachedContentParameters,
|
|
7775
7960
|
CachedContentUsageMetadata,
|
|
@@ -7907,7 +8092,7 @@ declare namespace types {
|
|
|
7907
8092
|
LiveClientRealtimeInput,
|
|
7908
8093
|
LiveClientToolResponse,
|
|
7909
8094
|
LiveClientMessage,
|
|
7910
|
-
|
|
8095
|
+
TranslationConfig,
|
|
7911
8096
|
LiveConnectConfig,
|
|
7912
8097
|
LiveConnectParameters,
|
|
7913
8098
|
CreateChatParameters,
|
|
@@ -8250,29 +8435,30 @@ declare enum UrlRetrievalStatus {
|
|
|
8250
8435
|
|
|
8251
8436
|
/** Usage metadata about response(s). */
|
|
8252
8437
|
declare interface UsageMetadata {
|
|
8253
|
-
/**
|
|
8438
|
+
/** The total number of tokens in the prompt. This includes any text, images, or other media provided in the request. When `cached_content` is set, this also includes the number of tokens in the cached content. */
|
|
8254
8439
|
promptTokenCount?: number;
|
|
8255
|
-
/**
|
|
8440
|
+
/** Output only. The number of tokens in the cached content that was used for this request. */
|
|
8256
8441
|
cachedContentTokenCount?: number;
|
|
8257
8442
|
/** Total number of tokens across all the generated response candidates. */
|
|
8258
8443
|
responseTokenCount?: number;
|
|
8259
|
-
/**
|
|
8444
|
+
/** Output only. The number of tokens in the results from tool executions, which are provided back to the model as input, if applicable. */
|
|
8260
8445
|
toolUsePromptTokenCount?: number;
|
|
8261
|
-
/**
|
|
8446
|
+
/** Output only. The number of tokens that were part of the model's generated "thoughts" output, if applicable. */
|
|
8262
8447
|
thoughtsTokenCount?: number;
|
|
8263
|
-
/**
|
|
8448
|
+
/** The total number of tokens for the entire request. This is the sum of `prompt_token_count`, `candidates_token_count`, `tool_use_prompt_token_count`, and `thoughts_token_count`. */
|
|
8264
8449
|
totalTokenCount?: number;
|
|
8265
|
-
/**
|
|
8450
|
+
/** Output only. A detailed breakdown of the token count for each modality in the prompt. */
|
|
8266
8451
|
promptTokensDetails?: ModalityTokenCount[];
|
|
8267
|
-
/**
|
|
8452
|
+
/** Output only. A detailed breakdown of the token count for each modality in the cached content. */
|
|
8268
8453
|
cacheTokensDetails?: ModalityTokenCount[];
|
|
8269
8454
|
/** List of modalities that were returned in the response. */
|
|
8270
8455
|
responseTokensDetails?: ModalityTokenCount[];
|
|
8271
|
-
/**
|
|
8456
|
+
/** Output only. A detailed breakdown by modality of the token counts from the results of tool executions, which are provided back to the model as input. */
|
|
8272
8457
|
toolUsePromptTokensDetails?: ModalityTokenCount[];
|
|
8273
|
-
/**
|
|
8274
|
-
or Provisioned Throughput quota. */
|
|
8458
|
+
/** Output only. The traffic type for this request. This field is not supported in Gemini API. */
|
|
8275
8459
|
trafficType?: TrafficType;
|
|
8460
|
+
/** Output only. Service tier of the request. This field is not supported in Vertex AI. */
|
|
8461
|
+
serviceTier?: ServiceTier;
|
|
8276
8462
|
}
|
|
8277
8463
|
|
|
8278
8464
|
/** The type of the VAD signal. */
|
|
@@ -8291,6 +8477,53 @@ declare enum VadSignalType {
|
|
|
8291
8477
|
VAD_SIGNAL_TYPE_EOS = "VAD_SIGNAL_TYPE_EOS"
|
|
8292
8478
|
}
|
|
8293
8479
|
|
|
8480
|
+
/** Optional parameters for tunings.validate_reward. */
|
|
8481
|
+
declare interface ValidateRewardConfig {
|
|
8482
|
+
/** Used to override HTTP request options. */
|
|
8483
|
+
httpOptions?: HttpOptions;
|
|
8484
|
+
/** Abort signal which can be used to cancel the request.
|
|
8485
|
+
|
|
8486
|
+
NOTE: AbortSignal is a client-only operation. Using it to cancel an
|
|
8487
|
+
operation will not cancel the request in the service. You will still
|
|
8488
|
+
be charged usage for any applicable operations.
|
|
8489
|
+
*/
|
|
8490
|
+
abortSignal?: AbortSignal;
|
|
8491
|
+
}
|
|
8492
|
+
|
|
8493
|
+
/** Parameters for the validate_reward method.
|
|
8494
|
+
|
|
8495
|
+
Validates a reinforcement tuning reward configuration against a sample
|
|
8496
|
+
response and example before creating a reinforcement tuning job. */
|
|
8497
|
+
declare interface ValidateRewardParameters {
|
|
8498
|
+
/** Required. The resource name of the Location to validate the reward in, e.g. `projects/{project}/locations/{location}`. */
|
|
8499
|
+
parent: string;
|
|
8500
|
+
/** Required. The sample response for validating the reward configuration. */
|
|
8501
|
+
sampleResponse: Content;
|
|
8502
|
+
/** Required. The example to validate the reward configuration. */
|
|
8503
|
+
example: ReinforcementTuningExample;
|
|
8504
|
+
/** Single reward function configuration for reinforcement tuning. Mutually exclusive with composite_reward_config. */
|
|
8505
|
+
singleRewardConfig?: SingleReinforcementTuningRewardConfig;
|
|
8506
|
+
/** Composite reward function configuration for reinforcement tuning. Mutually exclusive with single_reward_config. */
|
|
8507
|
+
compositeRewardConfig?: CompositeReinforcementTuningRewardConfig;
|
|
8508
|
+
/** Optional parameters for the request. */
|
|
8509
|
+
config?: ValidateRewardConfig;
|
|
8510
|
+
}
|
|
8511
|
+
|
|
8512
|
+
/** Response for the validate_reward method.
|
|
8513
|
+
|
|
8514
|
+
Contains the computed reward for a reinforcement tuning reward
|
|
8515
|
+
configuration. */
|
|
8516
|
+
declare class ValidateRewardResponse {
|
|
8517
|
+
/** Used to retain the full HTTP response. */
|
|
8518
|
+
sdkHttpResponse?: HttpResponse;
|
|
8519
|
+
/** 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. */
|
|
8520
|
+
overallReward?: number;
|
|
8521
|
+
/** Output only. In case of an error, this field will be populated with a detailed error message to help with debugging. */
|
|
8522
|
+
error?: string;
|
|
8523
|
+
/** A map from reward name to reward info. */
|
|
8524
|
+
rewardInfoDetails?: Record<string, ReinforcementTuningRewardInfo>;
|
|
8525
|
+
}
|
|
8526
|
+
|
|
8294
8527
|
/** Hyperparameters for Veo. This data type is not supported in Gemini API. */
|
|
8295
8528
|
declare interface VeoHyperParameters {
|
|
8296
8529
|
/** Optional. Number of complete passes the model makes over the entire training dataset during training. */
|