@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/web/web.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. */
|
|
@@ -5374,6 +5365,8 @@ declare type HTTPMethod = 'get' | 'post' | 'put' | 'patch' | 'delete';
|
|
|
5374
5365
|
export declare interface HttpOptions {
|
|
5375
5366
|
/** The base URL for the AI platform service endpoint. */
|
|
5376
5367
|
baseUrl?: string;
|
|
5368
|
+
/** The resource scope used to constructing the resource name when base_url is set */
|
|
5369
|
+
baseUrlResourceScope?: ResourceScope;
|
|
5377
5370
|
/** Specifies the version of the API to use. */
|
|
5378
5371
|
apiVersion?: string;
|
|
5379
5372
|
/** Additional HTTP headers to be sent with the request. */
|
|
@@ -7222,6 +7215,14 @@ export declare interface Model {
|
|
|
7222
7215
|
*/
|
|
7223
7216
|
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 & {});
|
|
7224
7217
|
|
|
7218
|
+
/** Configuration for Model Armor integrations of prompt and responses. This data type is not supported in Gemini API. */
|
|
7219
|
+
export declare interface ModelArmorConfig {
|
|
7220
|
+
/** Optional. The name of the Model Armor template to use for prompt sanitization. */
|
|
7221
|
+
promptTemplateName?: string;
|
|
7222
|
+
/** Optional. The name of the Model Armor template to use for response sanitization. */
|
|
7223
|
+
responseTemplateName?: string;
|
|
7224
|
+
}
|
|
7225
|
+
|
|
7225
7226
|
export declare class Models extends BaseModule {
|
|
7226
7227
|
private readonly apiClient;
|
|
7227
7228
|
constructor(apiClient: ApiClient);
|
|
@@ -8418,6 +8419,18 @@ declare type RequestOptions = {
|
|
|
8418
8419
|
__streamClass?: typeof Stream;
|
|
8419
8420
|
};
|
|
8420
8421
|
|
|
8422
|
+
/** Resource scope. */
|
|
8423
|
+
export declare enum ResourceScope {
|
|
8424
|
+
/**
|
|
8425
|
+
* When setting base_url, this value configures resource scope to be the collection.
|
|
8426
|
+
The resource name will not include api version, project, or location.
|
|
8427
|
+
For example, if base_url is set to "https://aiplatform.googleapis.com",
|
|
8428
|
+
then the resource name for a Model would be
|
|
8429
|
+
"https://aiplatform.googleapis.com/publishers/google/models/gemini-3-pro-preview
|
|
8430
|
+
*/
|
|
8431
|
+
COLLECTION = "COLLECTION"
|
|
8432
|
+
}
|
|
8433
|
+
|
|
8421
8434
|
/** Defines a retrieval tool that model can call to access external knowledge. This data type is not supported in Gemini API. */
|
|
8422
8435
|
export declare interface Retrieval {
|
|
8423
8436
|
/** Optional. Deprecated. This option is no longer supported. */
|
|
@@ -9872,6 +9885,7 @@ declare namespace types {
|
|
|
9872
9885
|
JobState,
|
|
9873
9886
|
TuningTask,
|
|
9874
9887
|
PartMediaResolutionLevel,
|
|
9888
|
+
ResourceScope,
|
|
9875
9889
|
FeatureSelectionPreference,
|
|
9876
9890
|
Environment,
|
|
9877
9891
|
SafetyFilterLevel,
|
|
@@ -9968,6 +9982,7 @@ declare namespace types {
|
|
|
9968
9982
|
GenerationConfigRoutingConfigManualRoutingMode,
|
|
9969
9983
|
GenerationConfigRoutingConfig,
|
|
9970
9984
|
SafetySetting,
|
|
9985
|
+
ModelArmorConfig,
|
|
9971
9986
|
GenerateContentConfig,
|
|
9972
9987
|
GenerateContentParameters,
|
|
9973
9988
|
HttpResponse,
|