@google/genai 2.6.0 → 2.7.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 +200 -27
- package/dist/index.cjs +138 -83
- package/dist/index.mjs +138 -83
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +138 -83
- package/dist/node/index.mjs +138 -83
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +200 -27
- package/dist/tokenizer/node.cjs +28 -24
- package/dist/tokenizer/node.d.ts +2 -3
- package/dist/tokenizer/node.mjs +28 -24
- package/dist/tokenizer/node.mjs.map +1 -1
- package/dist/vertex_internal/index.cjs +29 -25
- package/dist/vertex_internal/index.cjs.map +1 -1
- package/dist/vertex_internal/index.d.ts +85 -24
- package/dist/vertex_internal/index.js +29 -25
- package/dist/vertex_internal/index.js.map +1 -1
- package/dist/web/index.mjs +138 -83
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +200 -27
- 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,18 @@ 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;
|
|
1437
1487
|
}
|
|
1438
1488
|
|
|
1439
1489
|
/** Fine-tuning job creation parameters - optional fields. */
|
|
@@ -2484,10 +2534,9 @@ declare interface FullFineTuningSpec {
|
|
|
2484
2534
|
validationDatasetUri?: string;
|
|
2485
2535
|
}
|
|
2486
2536
|
|
|
2487
|
-
/** A
|
|
2537
|
+
/** 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
2538
|
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`. */
|
|
2539
|
+
/** 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
2540
|
id?: string;
|
|
2492
2541
|
/** Optional. The function parameters and values in JSON object format. See FunctionDeclaration.parameters for parameter details. */
|
|
2493
2542
|
args?: Record<string, unknown>;
|
|
@@ -4308,16 +4357,11 @@ declare enum Language {
|
|
|
4308
4357
|
PYTHON = "PYTHON"
|
|
4309
4358
|
}
|
|
4310
4359
|
|
|
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. */
|
|
4360
|
+
/** 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
4361
|
declare interface LatLng {
|
|
4318
4362
|
/** The latitude in degrees. It must be in the range [-90.0, +90.0]. */
|
|
4319
4363
|
latitude?: number;
|
|
4320
|
-
/** The longitude in degrees. It must be in the range [-180.0, +180.0] */
|
|
4364
|
+
/** The longitude in degrees. It must be in the range [-180.0, +180.0]. */
|
|
4321
4365
|
longitude?: number;
|
|
4322
4366
|
}
|
|
4323
4367
|
|
|
@@ -6073,6 +6117,12 @@ declare class RegisterFilesResponse {
|
|
|
6073
6117
|
files?: File_2[];
|
|
6074
6118
|
}
|
|
6075
6119
|
|
|
6120
|
+
/** Reinforcement tuning autorater scorer. */
|
|
6121
|
+
declare interface ReinforcementTuningAutoraterScorer {
|
|
6122
|
+
/** Autorater config for evaluation. */
|
|
6123
|
+
autoraterConfig?: AutoraterConfig;
|
|
6124
|
+
}
|
|
6125
|
+
|
|
6076
6126
|
/** Represents a recorded session. */
|
|
6077
6127
|
declare interface ReplayFile {
|
|
6078
6128
|
replayId?: string;
|
|
@@ -6138,10 +6188,9 @@ declare interface Retrieval {
|
|
|
6138
6188
|
vertexRagStore?: VertexRagStore;
|
|
6139
6189
|
}
|
|
6140
6190
|
|
|
6141
|
-
/** Retrieval config.
|
|
6142
|
-
*/
|
|
6191
|
+
/** Retrieval config. */
|
|
6143
6192
|
declare interface RetrievalConfig {
|
|
6144
|
-
/**
|
|
6193
|
+
/** The location of the user. */
|
|
6145
6194
|
latLng?: LatLng;
|
|
6146
6195
|
/** The language code of the user. */
|
|
6147
6196
|
languageCode?: string;
|
|
@@ -6498,6 +6547,11 @@ declare class SingleEmbedContentResponse {
|
|
|
6498
6547
|
tokenCount?: string;
|
|
6499
6548
|
}
|
|
6500
6549
|
|
|
6550
|
+
/** Single reinforcement tuning reward config. */
|
|
6551
|
+
declare interface SingleReinforcementTuningRewardConfig {
|
|
6552
|
+
autoraterScorer?: ReinforcementTuningAutoraterScorer;
|
|
6553
|
+
}
|
|
6554
|
+
|
|
6501
6555
|
/** Context window will be truncated by keeping only suffix of it.
|
|
6502
6556
|
|
|
6503
6557
|
Context window will always be cut at start of USER role turn. System
|
|
@@ -6848,15 +6902,13 @@ declare interface ToolCall {
|
|
|
6848
6902
|
declare interface ToolCodeExecution {
|
|
6849
6903
|
}
|
|
6850
6904
|
|
|
6851
|
-
/** Tool config.
|
|
6852
|
-
|
|
6853
|
-
This config is shared for all tools provided in the request. */
|
|
6905
|
+
/** Tool config. This config is shared for all tools provided in the request. */
|
|
6854
6906
|
declare interface ToolConfig {
|
|
6855
6907
|
/** Optional. Retrieval config. */
|
|
6856
6908
|
retrievalConfig?: RetrievalConfig;
|
|
6857
6909
|
/** Optional. Function calling config. */
|
|
6858
6910
|
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
|
|
6911
|
+
/** 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
6912
|
includeServerSideToolInvocations?: boolean;
|
|
6861
6913
|
}
|
|
6862
6914
|
|
|
@@ -7137,7 +7189,11 @@ declare enum TuningMethod {
|
|
|
7137
7189
|
/**
|
|
7138
7190
|
* Distillation tuning.
|
|
7139
7191
|
*/
|
|
7140
|
-
DISTILLATION = "DISTILLATION"
|
|
7192
|
+
DISTILLATION = "DISTILLATION",
|
|
7193
|
+
/**
|
|
7194
|
+
* Reinforcement tuning.
|
|
7195
|
+
*/
|
|
7196
|
+
REINFORCEMENT_TUNING = "REINFORCEMENT_TUNING"
|
|
7141
7197
|
}
|
|
7142
7198
|
|
|
7143
7199
|
/** Tuning mode. This enum is not supported in Gemini API. */
|
|
@@ -7409,13 +7465,13 @@ declare namespace types {
|
|
|
7409
7465
|
PhishBlockThreshold,
|
|
7410
7466
|
Behavior,
|
|
7411
7467
|
DynamicRetrievalConfigMode,
|
|
7412
|
-
FunctionCallingConfigMode,
|
|
7413
7468
|
ThinkingLevel,
|
|
7414
7469
|
PersonGeneration,
|
|
7415
7470
|
ProminentPeople,
|
|
7416
7471
|
HarmCategory,
|
|
7417
7472
|
HarmBlockMethod,
|
|
7418
7473
|
HarmBlockThreshold,
|
|
7474
|
+
FunctionCallingConfigMode,
|
|
7419
7475
|
FinishReason,
|
|
7420
7476
|
HarmProbability,
|
|
7421
7477
|
HarmSeverity,
|
|
@@ -7526,10 +7582,6 @@ declare namespace types {
|
|
|
7526
7582
|
StreamableHttpTransport,
|
|
7527
7583
|
McpServer,
|
|
7528
7584
|
Tool,
|
|
7529
|
-
LatLng,
|
|
7530
|
-
RetrievalConfig,
|
|
7531
|
-
FunctionCallingConfig,
|
|
7532
|
-
ToolConfig,
|
|
7533
7585
|
ReplicatedVoiceConfig,
|
|
7534
7586
|
PrebuiltVoiceConfig,
|
|
7535
7587
|
VoiceConfig,
|
|
@@ -7544,6 +7596,10 @@ declare namespace types {
|
|
|
7544
7596
|
GenerationConfigRoutingConfigManualRoutingMode,
|
|
7545
7597
|
GenerationConfigRoutingConfig,
|
|
7546
7598
|
SafetySetting,
|
|
7599
|
+
LatLng,
|
|
7600
|
+
RetrievalConfig,
|
|
7601
|
+
FunctionCallingConfig,
|
|
7602
|
+
ToolConfig,
|
|
7547
7603
|
ModelArmorConfig,
|
|
7548
7604
|
GenerateContentConfig,
|
|
7549
7605
|
GenerateContentParameters,
|
|
@@ -7706,6 +7762,11 @@ declare namespace types {
|
|
|
7706
7762
|
TuningExample,
|
|
7707
7763
|
TuningDataset,
|
|
7708
7764
|
TuningValidationDataset,
|
|
7765
|
+
AutoraterConfig,
|
|
7766
|
+
ReinforcementTuningAutoraterScorer,
|
|
7767
|
+
SingleReinforcementTuningRewardConfig,
|
|
7768
|
+
CompositeReinforcementTuningRewardConfigWeightedRewardConfig,
|
|
7769
|
+
CompositeReinforcementTuningRewardConfig,
|
|
7709
7770
|
CreateTuningJobConfig,
|
|
7710
7771
|
CreateTuningJobParametersPrivate,
|
|
7711
7772
|
TuningOperation,
|
|
@@ -566,30 +566,6 @@ var DynamicRetrievalConfigMode;
|
|
|
566
566
|
*/
|
|
567
567
|
DynamicRetrievalConfigMode["MODE_DYNAMIC"] = "MODE_DYNAMIC";
|
|
568
568
|
})(DynamicRetrievalConfigMode || (DynamicRetrievalConfigMode = {}));
|
|
569
|
-
/** Function calling mode. */
|
|
570
|
-
var FunctionCallingConfigMode;
|
|
571
|
-
(function (FunctionCallingConfigMode) {
|
|
572
|
-
/**
|
|
573
|
-
* Unspecified function calling mode. This value should not be used.
|
|
574
|
-
*/
|
|
575
|
-
FunctionCallingConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
576
|
-
/**
|
|
577
|
-
* Default model behavior, model decides to predict either function calls or natural language response.
|
|
578
|
-
*/
|
|
579
|
-
FunctionCallingConfigMode["AUTO"] = "AUTO";
|
|
580
|
-
/**
|
|
581
|
-
* Model is constrained to always predicting function calls only. If "allowed_function_names" are set, the predicted function calls will be limited to any one of "allowed_function_names", else the predicted function calls will be any one of the provided "function_declarations".
|
|
582
|
-
*/
|
|
583
|
-
FunctionCallingConfigMode["ANY"] = "ANY";
|
|
584
|
-
/**
|
|
585
|
-
* Model will not predict any function calls. Model behavior is same as when not passing any function declarations.
|
|
586
|
-
*/
|
|
587
|
-
FunctionCallingConfigMode["NONE"] = "NONE";
|
|
588
|
-
/**
|
|
589
|
-
* Model is constrained to predict either function calls or natural language response. If "allowed_function_names" are set, the predicted function calls will be limited to any one of "allowed_function_names", else the predicted function calls will be any one of the provided "function_declarations".
|
|
590
|
-
*/
|
|
591
|
-
FunctionCallingConfigMode["VALIDATED"] = "VALIDATED";
|
|
592
|
-
})(FunctionCallingConfigMode || (FunctionCallingConfigMode = {}));
|
|
593
569
|
/** The number of thoughts tokens that the model should generate. */
|
|
594
570
|
var ThinkingLevel;
|
|
595
571
|
(function (ThinkingLevel) {
|
|
@@ -738,6 +714,30 @@ var HarmBlockThreshold;
|
|
|
738
714
|
*/
|
|
739
715
|
HarmBlockThreshold["OFF"] = "OFF";
|
|
740
716
|
})(HarmBlockThreshold || (HarmBlockThreshold = {}));
|
|
717
|
+
/** Function calling mode. */
|
|
718
|
+
var FunctionCallingConfigMode;
|
|
719
|
+
(function (FunctionCallingConfigMode) {
|
|
720
|
+
/**
|
|
721
|
+
* Unspecified function calling mode. This value should not be used.
|
|
722
|
+
*/
|
|
723
|
+
FunctionCallingConfigMode["MODE_UNSPECIFIED"] = "MODE_UNSPECIFIED";
|
|
724
|
+
/**
|
|
725
|
+
* Default model behavior, model decides to predict either function calls or natural language response.
|
|
726
|
+
*/
|
|
727
|
+
FunctionCallingConfigMode["AUTO"] = "AUTO";
|
|
728
|
+
/**
|
|
729
|
+
* Model is constrained to always predicting function calls only. If "allowed_function_names" are set, the predicted function calls will be limited to any one of "allowed_function_names", else the predicted function calls will be any one of the provided "function_declarations".
|
|
730
|
+
*/
|
|
731
|
+
FunctionCallingConfigMode["ANY"] = "ANY";
|
|
732
|
+
/**
|
|
733
|
+
* Model will not predict any function calls. Model behavior is same as when not passing any function declarations.
|
|
734
|
+
*/
|
|
735
|
+
FunctionCallingConfigMode["NONE"] = "NONE";
|
|
736
|
+
/**
|
|
737
|
+
* Model is constrained to predict either function calls or natural language response. If "allowed_function_names" are set, the predicted function calls will be limited to any one of "allowed_function_names", else the predicted function calls will be any one of the provided "function_declarations".
|
|
738
|
+
*/
|
|
739
|
+
FunctionCallingConfigMode["VALIDATED"] = "VALIDATED";
|
|
740
|
+
})(FunctionCallingConfigMode || (FunctionCallingConfigMode = {}));
|
|
741
741
|
/** Output only. The reason why the model stopped generating tokens.
|
|
742
742
|
|
|
743
743
|
If empty, the model has not stopped generating the tokens. */
|
|
@@ -1571,6 +1571,10 @@ var TuningMethod;
|
|
|
1571
1571
|
* Distillation tuning.
|
|
1572
1572
|
*/
|
|
1573
1573
|
TuningMethod["DISTILLATION"] = "DISTILLATION";
|
|
1574
|
+
/**
|
|
1575
|
+
* Reinforcement tuning.
|
|
1576
|
+
*/
|
|
1577
|
+
TuningMethod["REINFORCEMENT_TUNING"] = "REINFORCEMENT_TUNING";
|
|
1574
1578
|
})(TuningMethod || (TuningMethod = {}));
|
|
1575
1579
|
/** State for the lifecycle of a File. */
|
|
1576
1580
|
var FileState;
|
|
@@ -2090,7 +2094,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
2090
2094
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
2091
2095
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
2092
2096
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
2093
|
-
const SDK_VERSION = '2.
|
|
2097
|
+
const SDK_VERSION = '2.7.0'; // x-release-please-version
|
|
2094
2098
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
2095
2099
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
2096
2100
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|