@google/genai 1.37.0 → 1.38.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 +32 -17
- package/dist/index.cjs +96 -47
- package/dist/index.mjs +97 -48
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +99 -47
- package/dist/node/index.mjs +100 -48
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +32 -17
- package/dist/tokenizer/node.cjs +12 -0
- package/dist/tokenizer/node.d.ts +14 -0
- package/dist/tokenizer/node.mjs +12 -0
- package/dist/tokenizer/node.mjs.map +1 -1
- package/dist/web/index.mjs +97 -48
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +32 -17
- package/package.json +1 -1
package/dist/node/node.d.ts
CHANGED
|
@@ -121,25 +121,12 @@ export declare interface ApiAuthApiKeyConfig {
|
|
|
121
121
|
*/
|
|
122
122
|
declare class ApiClient implements GeminiNextGenAPIClientAdapter {
|
|
123
123
|
readonly clientOptions: ApiClientInitOptions;
|
|
124
|
+
private readonly customBaseUrl?;
|
|
124
125
|
constructor(opts: ApiClientInitOptions);
|
|
125
|
-
/**
|
|
126
|
-
* Determines the base URL for Vertex AI based on project and location.
|
|
127
|
-
* Uses the global endpoint if location is 'global' or if project/location
|
|
128
|
-
* are not specified (implying API key usage).
|
|
129
|
-
* @private
|
|
130
|
-
*/
|
|
131
|
-
private baseUrlFromProjectLocation;
|
|
132
|
-
/**
|
|
133
|
-
* Normalizes authentication parameters for Vertex AI.
|
|
134
|
-
* If project and location are provided, API key is cleared.
|
|
135
|
-
* If project and location are not provided (implying API key usage),
|
|
136
|
-
* project and location are cleared.
|
|
137
|
-
* @private
|
|
138
|
-
*/
|
|
139
|
-
private normalizeAuthParameters;
|
|
140
126
|
isVertexAI(): boolean;
|
|
141
127
|
getProject(): string | undefined;
|
|
142
128
|
getLocation(): string | undefined;
|
|
129
|
+
getCustomBaseUrl(): string | undefined;
|
|
143
130
|
getAuthHeaders(): Promise<Headers>;
|
|
144
131
|
getApiVersion(): string;
|
|
145
132
|
getBaseUrl(): string;
|
|
@@ -597,7 +584,7 @@ declare interface BaseCreateAgentInteractionParams {
|
|
|
597
584
|
*/
|
|
598
585
|
agent_config?: DynamicAgentConfig | DeepResearchAgentConfig;
|
|
599
586
|
/**
|
|
600
|
-
* Body param: Whether to run the model interaction in the background.
|
|
587
|
+
* Body param: Input only. Whether to run the model interaction in the background.
|
|
601
588
|
*/
|
|
602
589
|
background?: boolean;
|
|
603
590
|
/**
|
|
@@ -649,7 +636,7 @@ declare interface BaseCreateModelInteractionParams {
|
|
|
649
636
|
*/
|
|
650
637
|
api_version?: string;
|
|
651
638
|
/**
|
|
652
|
-
* Body param: Whether to run the model interaction in the background.
|
|
639
|
+
* Body param: Input only. Whether to run the model interaction in the background.
|
|
653
640
|
*/
|
|
654
641
|
background?: boolean;
|
|
655
642
|
/**
|
|
@@ -4115,6 +4102,10 @@ export declare interface GenerateContentConfig {
|
|
|
4115
4102
|
models. This field is not supported in Vertex AI.
|
|
4116
4103
|
*/
|
|
4117
4104
|
enableEnhancedCivicAnswers?: boolean;
|
|
4105
|
+
/** Settings for prompt and response sanitization using the Model Armor
|
|
4106
|
+
service. If supplied, safety_settings must not be supplied.
|
|
4107
|
+
*/
|
|
4108
|
+
modelArmorConfig?: ModelArmorConfig;
|
|
4118
4109
|
}
|
|
4119
4110
|
|
|
4120
4111
|
/** Config for models.generate_content parameters. */
|
|
@@ -5381,6 +5372,8 @@ declare type HTTPMethod = 'get' | 'post' | 'put' | 'patch' | 'delete';
|
|
|
5381
5372
|
export declare interface HttpOptions {
|
|
5382
5373
|
/** The base URL for the AI platform service endpoint. */
|
|
5383
5374
|
baseUrl?: string;
|
|
5375
|
+
/** The resource scope used to constructing the resource name when base_url is set */
|
|
5376
|
+
baseUrlResourceScope?: ResourceScope;
|
|
5384
5377
|
/** Specifies the version of the API to use. */
|
|
5385
5378
|
apiVersion?: string;
|
|
5386
5379
|
/** Additional HTTP headers to be sent with the request. */
|
|
@@ -7229,6 +7222,14 @@ export declare interface Model {
|
|
|
7229
7222
|
*/
|
|
7230
7223
|
declare type Model_2 = 'gemini-2.5-pro' | 'gemini-2.5-flash' | 'gemini-2.5-flash-preview-09-2025' | 'gemini-2.5-flash-lite' | 'gemini-2.5-flash-lite-preview-09-2025' | 'gemini-2.5-flash-preview-native-audio-dialog' | 'gemini-2.5-flash-image-preview' | 'gemini-2.5-pro-preview-tts' | 'gemini-3-pro-preview' | 'gemini-3-flash-preview' | (string & {});
|
|
7231
7224
|
|
|
7225
|
+
/** Configuration for Model Armor integrations of prompt and responses. This data type is not supported in Gemini API. */
|
|
7226
|
+
export declare interface ModelArmorConfig {
|
|
7227
|
+
/** Optional. The name of the Model Armor template to use for prompt sanitization. */
|
|
7228
|
+
promptTemplateName?: string;
|
|
7229
|
+
/** Optional. The name of the Model Armor template to use for response sanitization. */
|
|
7230
|
+
responseTemplateName?: string;
|
|
7231
|
+
}
|
|
7232
|
+
|
|
7232
7233
|
export declare class Models extends BaseModule {
|
|
7233
7234
|
private readonly apiClient;
|
|
7234
7235
|
constructor(apiClient: ApiClient);
|
|
@@ -8425,6 +8426,18 @@ declare type RequestOptions = {
|
|
|
8425
8426
|
__streamClass?: typeof Stream;
|
|
8426
8427
|
};
|
|
8427
8428
|
|
|
8429
|
+
/** Resource scope. */
|
|
8430
|
+
export declare enum ResourceScope {
|
|
8431
|
+
/**
|
|
8432
|
+
* When setting base_url, this value configures resource scope to be the collection.
|
|
8433
|
+
The resource name will not include api version, project, or location.
|
|
8434
|
+
For example, if base_url is set to "https://aiplatform.googleapis.com",
|
|
8435
|
+
then the resource name for a Model would be
|
|
8436
|
+
"https://aiplatform.googleapis.com/publishers/google/models/gemini-3-pro-preview
|
|
8437
|
+
*/
|
|
8438
|
+
COLLECTION = "COLLECTION"
|
|
8439
|
+
}
|
|
8440
|
+
|
|
8428
8441
|
/** Defines a retrieval tool that model can call to access external knowledge. This data type is not supported in Gemini API. */
|
|
8429
8442
|
export declare interface Retrieval {
|
|
8430
8443
|
/** Optional. Deprecated. This option is no longer supported. */
|
|
@@ -9879,6 +9892,7 @@ declare namespace types {
|
|
|
9879
9892
|
JobState,
|
|
9880
9893
|
TuningTask,
|
|
9881
9894
|
PartMediaResolutionLevel,
|
|
9895
|
+
ResourceScope,
|
|
9882
9896
|
FeatureSelectionPreference,
|
|
9883
9897
|
Environment,
|
|
9884
9898
|
SafetyFilterLevel,
|
|
@@ -9975,6 +9989,7 @@ declare namespace types {
|
|
|
9975
9989
|
GenerationConfigRoutingConfigManualRoutingMode,
|
|
9976
9990
|
GenerationConfigRoutingConfig,
|
|
9977
9991
|
SafetySetting,
|
|
9992
|
+
ModelArmorConfig,
|
|
9978
9993
|
GenerateContentConfig,
|
|
9979
9994
|
GenerateContentParameters,
|
|
9980
9995
|
HttpResponse,
|
package/dist/tokenizer/node.cjs
CHANGED
|
@@ -773,6 +773,18 @@ var PartMediaResolutionLevel;
|
|
|
773
773
|
*/
|
|
774
774
|
PartMediaResolutionLevel["MEDIA_RESOLUTION_ULTRA_HIGH"] = "MEDIA_RESOLUTION_ULTRA_HIGH";
|
|
775
775
|
})(PartMediaResolutionLevel || (PartMediaResolutionLevel = {}));
|
|
776
|
+
/** Resource scope. */
|
|
777
|
+
var ResourceScope;
|
|
778
|
+
(function (ResourceScope) {
|
|
779
|
+
/**
|
|
780
|
+
* When setting base_url, this value configures resource scope to be the collection.
|
|
781
|
+
The resource name will not include api version, project, or location.
|
|
782
|
+
For example, if base_url is set to "https://aiplatform.googleapis.com",
|
|
783
|
+
then the resource name for a Model would be
|
|
784
|
+
"https://aiplatform.googleapis.com/publishers/google/models/gemini-3-pro-preview
|
|
785
|
+
*/
|
|
786
|
+
ResourceScope["COLLECTION"] = "COLLECTION";
|
|
787
|
+
})(ResourceScope || (ResourceScope = {}));
|
|
776
788
|
/** Options for feature selection preference. */
|
|
777
789
|
var FeatureSelectionPreference;
|
|
778
790
|
(function (FeatureSelectionPreference) {
|
package/dist/tokenizer/node.d.ts
CHANGED
|
@@ -553,6 +553,8 @@ declare enum HttpElementLocation {
|
|
|
553
553
|
declare interface HttpOptions {
|
|
554
554
|
/** The base URL for the AI platform service endpoint. */
|
|
555
555
|
baseUrl?: string;
|
|
556
|
+
/** The resource scope used to constructing the resource name when base_url is set */
|
|
557
|
+
baseUrlResourceScope?: ResourceScope;
|
|
556
558
|
/** Specifies the version of the API to use. */
|
|
557
559
|
apiVersion?: string;
|
|
558
560
|
/** Additional HTTP headers to be sent with the request. */
|
|
@@ -881,6 +883,18 @@ declare interface ReplicatedVoiceConfig {
|
|
|
881
883
|
voiceSampleAudio?: string;
|
|
882
884
|
}
|
|
883
885
|
|
|
886
|
+
/** Resource scope. */
|
|
887
|
+
declare enum ResourceScope {
|
|
888
|
+
/**
|
|
889
|
+
* When setting base_url, this value configures resource scope to be the collection.
|
|
890
|
+
The resource name will not include api version, project, or location.
|
|
891
|
+
For example, if base_url is set to "https://aiplatform.googleapis.com",
|
|
892
|
+
then the resource name for a Model would be
|
|
893
|
+
"https://aiplatform.googleapis.com/publishers/google/models/gemini-3-pro-preview
|
|
894
|
+
*/
|
|
895
|
+
COLLECTION = "COLLECTION"
|
|
896
|
+
}
|
|
897
|
+
|
|
884
898
|
/** Defines a retrieval tool that model can call to access external knowledge. This data type is not supported in Gemini API. */
|
|
885
899
|
declare interface Retrieval {
|
|
886
900
|
/** Optional. Deprecated. This option is no longer supported. */
|
package/dist/tokenizer/node.mjs
CHANGED
|
@@ -749,6 +749,18 @@ var PartMediaResolutionLevel;
|
|
|
749
749
|
*/
|
|
750
750
|
PartMediaResolutionLevel["MEDIA_RESOLUTION_ULTRA_HIGH"] = "MEDIA_RESOLUTION_ULTRA_HIGH";
|
|
751
751
|
})(PartMediaResolutionLevel || (PartMediaResolutionLevel = {}));
|
|
752
|
+
/** Resource scope. */
|
|
753
|
+
var ResourceScope;
|
|
754
|
+
(function (ResourceScope) {
|
|
755
|
+
/**
|
|
756
|
+
* When setting base_url, this value configures resource scope to be the collection.
|
|
757
|
+
The resource name will not include api version, project, or location.
|
|
758
|
+
For example, if base_url is set to "https://aiplatform.googleapis.com",
|
|
759
|
+
then the resource name for a Model would be
|
|
760
|
+
"https://aiplatform.googleapis.com/publishers/google/models/gemini-3-pro-preview
|
|
761
|
+
*/
|
|
762
|
+
ResourceScope["COLLECTION"] = "COLLECTION";
|
|
763
|
+
})(ResourceScope || (ResourceScope = {}));
|
|
752
764
|
/** Options for feature selection preference. */
|
|
753
765
|
var FeatureSelectionPreference;
|
|
754
766
|
(function (FeatureSelectionPreference) {
|