@google/genai 2.5.0 → 2.6.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 +144 -68
- package/dist/index.cjs +470 -36
- package/dist/index.mjs +471 -37
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +470 -36
- package/dist/node/index.mjs +471 -37
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +144 -68
- package/dist/tokenizer/node.cjs +56 -16
- package/dist/tokenizer/node.d.ts +26 -21
- package/dist/tokenizer/node.mjs +56 -16
- package/dist/tokenizer/node.mjs.map +1 -1
- package/dist/vertex_internal/index.cjs +57 -17
- package/dist/vertex_internal/index.cjs.map +1 -1
- package/dist/vertex_internal/index.d.ts +142 -66
- package/dist/vertex_internal/index.js +57 -17
- package/dist/vertex_internal/index.js.map +1 -1
- package/dist/web/index.mjs +471 -37
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +144 -68
- package/package.json +1 -1
package/dist/tokenizer/node.d.ts
CHANGED
|
@@ -142,15 +142,13 @@ declare interface Blob_2 {
|
|
|
142
142
|
mimeType?: string;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
/** Result of executing the `
|
|
146
|
-
|
|
147
|
-
Generated only when the `CodeExecution` tool is used. */
|
|
145
|
+
/** Result of executing the ExecutableCode. Generated only when the `CodeExecution` tool is used. */
|
|
148
146
|
declare interface CodeExecutionResult {
|
|
149
147
|
/** Required. Outcome of the code execution. */
|
|
150
148
|
outcome?: Outcome;
|
|
151
149
|
/** Optional. Contains stdout when code execution is successful, stderr or other description otherwise. */
|
|
152
150
|
output?: string;
|
|
153
|
-
/** The identifier of the `ExecutableCode` part this result is for. Only populated if the corresponding `ExecutableCode` has an id. */
|
|
151
|
+
/** Optional. The identifier of the `ExecutableCode` part this result is for. Only populated if the corresponding `ExecutableCode` has an id. This field is not supported in Vertex AI. */
|
|
154
152
|
id?: string;
|
|
155
153
|
}
|
|
156
154
|
|
|
@@ -164,6 +162,9 @@ declare interface ComputerUse {
|
|
|
164
162
|
1. Using a more restricted / different action space.
|
|
165
163
|
2. Improving the definitions / instructions of predefined functions. */
|
|
166
164
|
excludedPredefinedFunctions?: string[];
|
|
165
|
+
/** Optional. Whether enable the prompt injection detection check on computer-use request.
|
|
166
|
+
*/
|
|
167
|
+
enablePromptInjectionDetection?: boolean;
|
|
167
168
|
}
|
|
168
169
|
|
|
169
170
|
/** Local tokenizer compute tokens result. */
|
|
@@ -252,20 +253,24 @@ declare enum Environment {
|
|
|
252
253
|
/**
|
|
253
254
|
* Operates in a web browser.
|
|
254
255
|
*/
|
|
255
|
-
ENVIRONMENT_BROWSER = "ENVIRONMENT_BROWSER"
|
|
256
|
+
ENVIRONMENT_BROWSER = "ENVIRONMENT_BROWSER",
|
|
257
|
+
/**
|
|
258
|
+
* Operates in a mobile environment.
|
|
259
|
+
*/
|
|
260
|
+
ENVIRONMENT_MOBILE = "ENVIRONMENT_MOBILE",
|
|
261
|
+
/**
|
|
262
|
+
* Operates in a desktop environment.
|
|
263
|
+
*/
|
|
264
|
+
ENVIRONMENT_DESKTOP = "ENVIRONMENT_DESKTOP"
|
|
256
265
|
}
|
|
257
266
|
|
|
258
|
-
/**
|
|
259
|
-
|
|
260
|
-
Only generated when using the `CodeExecution` tool, in which the code will
|
|
261
|
-
be automatically executed, and a corresponding `CodeExecutionResult` will
|
|
262
|
-
also be generated. */
|
|
267
|
+
/** Code generated by the model that is meant to be executed, and the result returned to the model. Generated when using the `CodeExecution` tool, in which the code will be automatically executed, and a corresponding CodeExecutionResult will also be generated. */
|
|
263
268
|
declare interface ExecutableCode {
|
|
264
269
|
/** Required. The code to be executed. */
|
|
265
270
|
code?: string;
|
|
266
271
|
/** Required. Programming language of the `code`. */
|
|
267
272
|
language?: Language;
|
|
268
|
-
/** Unique identifier of the `ExecutableCode` part. The server returns the `CodeExecutionResult` with the matching `id`. */
|
|
273
|
+
/** Optional. Unique identifier of the `ExecutableCode` part. The server returns the `CodeExecutionResult` with the matching `id`. This field is not supported in Vertex AI. */
|
|
269
274
|
id?: string;
|
|
270
275
|
}
|
|
271
276
|
|
|
@@ -332,9 +337,9 @@ declare interface FunctionCall {
|
|
|
332
337
|
/** The unique id of the function call. If populated, the client to execute the
|
|
333
338
|
`function_call` and return the response with the matching `id`. */
|
|
334
339
|
id?: string;
|
|
335
|
-
/** Optional. The function parameters and values in JSON object format. See
|
|
340
|
+
/** Optional. The function parameters and values in JSON object format. See FunctionDeclaration.parameters for parameter details. */
|
|
336
341
|
args?: Record<string, unknown>;
|
|
337
|
-
/** Optional. The name of the function to call. Matches
|
|
342
|
+
/** Optional. The name of the function to call. Matches FunctionDeclaration.name. */
|
|
338
343
|
name?: string;
|
|
339
344
|
/** Optional. The partial argument value of the function call. If provided, represents the arguments/fields that are streamed incrementally. This field is not supported in Gemini API. */
|
|
340
345
|
partialArgs?: PartialArg[];
|
|
@@ -346,7 +351,7 @@ declare interface FunctionCall {
|
|
|
346
351
|
declare interface FunctionDeclaration {
|
|
347
352
|
/** Optional. Description and purpose of the function. Model uses it to decide how and whether to call the function. */
|
|
348
353
|
description?: string;
|
|
349
|
-
/** Required. The name of the function to call. Must start with a letter or an underscore. Must be a-z, A-Z, 0-9, or contain underscores, dots, colons and dashes, with a maximum length of
|
|
354
|
+
/** Required. The name of the function to call. Must start with a letter or an underscore. Must be a-z, A-Z, 0-9, or contain underscores, dots, colons and dashes, with a maximum length of 128. */
|
|
350
355
|
name?: string;
|
|
351
356
|
/** Optional. Describes the parameters to this function in JSON Schema Object format. Reflects the Open API 3.03 Parameter Object. string Key: the name of the parameter. Parameter names are case sensitive. Schema Value: the Schema defining the type used for the parameter. For function with no parameters, this can be left unset. Parameter names must start with a letter or an underscore and must only contain chars a-z, A-Z, 0-9, or underscores with a maximum length of 64. Example with 1 required and 1 optional parameter: type: OBJECT properties: param1: type: STRING param2: type: INTEGER required: - param1 */
|
|
352
357
|
parameters?: Schema;
|
|
@@ -371,7 +376,7 @@ declare class FunctionResponse {
|
|
|
371
376
|
parts?: FunctionResponsePart[];
|
|
372
377
|
/** Optional. The id of the function call this response is for. Populated by the client to match the corresponding function call `id`. */
|
|
373
378
|
id?: string;
|
|
374
|
-
/** Required. The name of the function to call. Matches
|
|
379
|
+
/** Required. The name of the function to call. Matches FunctionDeclaration.name and FunctionCall.name. */
|
|
375
380
|
name?: string;
|
|
376
381
|
/** Required. The function response in JSON object format. Use "output" key to specify function output and "error" key to specify error details (if any). If "output" and "error" keys are not specified, then whole "response" is treated as function output. */
|
|
377
382
|
response?: Record<string, unknown>;
|
|
@@ -465,7 +470,7 @@ declare interface GenerationConfig {
|
|
|
465
470
|
presencePenalty?: number;
|
|
466
471
|
/** Optional. If set to true, the log probabilities of the output tokens are returned. Log probabilities are the logarithm of the probability of a token appearing in the output. A higher log probability means the token is more likely to be generated. This can be useful for analyzing the model's confidence in its own output and for debugging. */
|
|
467
472
|
responseLogprobs?: boolean;
|
|
468
|
-
/** Optional. The IANA standard MIME type of the response. The model will generate output that conforms to this MIME type. Supported values include 'text/plain' (default) and 'application/json'. The model needs to be prompted to output the appropriate response type, otherwise the behavior is undefined.
|
|
473
|
+
/** Optional. The IANA standard MIME type of the response. The model will generate output that conforms to this MIME type. Supported values include 'text/plain' (default) and 'application/json'. The model needs to be prompted to output the appropriate response type, otherwise the behavior is undefined. */
|
|
469
474
|
responseMimeType?: string;
|
|
470
475
|
/** Optional. The modalities of the response. The model will generate a response that includes all the specified modalities. For example, if this is set to `[TEXT, IMAGE]`, the response will include both text and an image. */
|
|
471
476
|
responseModalities?: Modality[];
|
|
@@ -656,7 +661,7 @@ export declare class LocalTokenizer {
|
|
|
656
661
|
computeTokens(contents: ContentListUnion): Promise<ComputeTokensResult>;
|
|
657
662
|
}
|
|
658
663
|
|
|
659
|
-
/** 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:
|
|
664
|
+
/** 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. */
|
|
660
665
|
declare interface McpServer {
|
|
661
666
|
/** The name of the MCPServer. */
|
|
662
667
|
name?: string;
|
|
@@ -727,15 +732,15 @@ declare enum Outcome {
|
|
|
727
732
|
*/
|
|
728
733
|
OUTCOME_UNSPECIFIED = "OUTCOME_UNSPECIFIED",
|
|
729
734
|
/**
|
|
730
|
-
* Code execution completed successfully.
|
|
735
|
+
* Code execution completed successfully. `output` contains the stdout, if any.
|
|
731
736
|
*/
|
|
732
737
|
OUTCOME_OK = "OUTCOME_OK",
|
|
733
738
|
/**
|
|
734
|
-
* Code execution
|
|
739
|
+
* Code execution failed. `output` contains the stderr and stdout, if any.
|
|
735
740
|
*/
|
|
736
741
|
OUTCOME_FAILED = "OUTCOME_FAILED",
|
|
737
742
|
/**
|
|
738
|
-
* Code execution ran for too long, and was cancelled. There may or may not be a partial output present.
|
|
743
|
+
* Code execution ran for too long, and was cancelled. There may or may not be a partial `output` present.
|
|
739
744
|
*/
|
|
740
745
|
OUTCOME_DEADLINE_EXCEEDED = "OUTCOME_DEADLINE_EXCEEDED"
|
|
741
746
|
}
|
|
@@ -1138,7 +1143,7 @@ declare interface ToolCall {
|
|
|
1138
1143
|
args?: Record<string, unknown>;
|
|
1139
1144
|
}
|
|
1140
1145
|
|
|
1141
|
-
/** Tool that executes code generated by the model, and automatically returns the result to the model. See also
|
|
1146
|
+
/** Tool that executes code generated by the model, and automatically returns the result to the model. See also ExecutableCode and CodeExecutionResult, which are input and output to this tool. This data type is not supported in Gemini API. */
|
|
1142
1147
|
declare interface ToolCodeExecution {
|
|
1143
1148
|
}
|
|
1144
1149
|
|
package/dist/tokenizer/node.mjs
CHANGED
|
@@ -9,18 +9,6 @@ import * as path from 'path';
|
|
|
9
9
|
* Copyright 2025 Google LLC
|
|
10
10
|
* SPDX-License-Identifier: Apache-2.0
|
|
11
11
|
*/
|
|
12
|
-
/** Programming language of the `code`. */
|
|
13
|
-
var Language;
|
|
14
|
-
(function (Language) {
|
|
15
|
-
/**
|
|
16
|
-
* Unspecified language. This value should not be used.
|
|
17
|
-
*/
|
|
18
|
-
Language["LANGUAGE_UNSPECIFIED"] = "LANGUAGE_UNSPECIFIED";
|
|
19
|
-
/**
|
|
20
|
-
* Python >= 3.10, with numpy and simpy available.
|
|
21
|
-
*/
|
|
22
|
-
Language["PYTHON"] = "PYTHON";
|
|
23
|
-
})(Language || (Language = {}));
|
|
24
12
|
/** Outcome of the code execution. */
|
|
25
13
|
var Outcome;
|
|
26
14
|
(function (Outcome) {
|
|
@@ -29,18 +17,30 @@ var Outcome;
|
|
|
29
17
|
*/
|
|
30
18
|
Outcome["OUTCOME_UNSPECIFIED"] = "OUTCOME_UNSPECIFIED";
|
|
31
19
|
/**
|
|
32
|
-
* Code execution completed successfully.
|
|
20
|
+
* Code execution completed successfully. `output` contains the stdout, if any.
|
|
33
21
|
*/
|
|
34
22
|
Outcome["OUTCOME_OK"] = "OUTCOME_OK";
|
|
35
23
|
/**
|
|
36
|
-
* Code execution
|
|
24
|
+
* Code execution failed. `output` contains the stderr and stdout, if any.
|
|
37
25
|
*/
|
|
38
26
|
Outcome["OUTCOME_FAILED"] = "OUTCOME_FAILED";
|
|
39
27
|
/**
|
|
40
|
-
* Code execution ran for too long, and was cancelled. There may or may not be a partial output present.
|
|
28
|
+
* Code execution ran for too long, and was cancelled. There may or may not be a partial `output` present.
|
|
41
29
|
*/
|
|
42
30
|
Outcome["OUTCOME_DEADLINE_EXCEEDED"] = "OUTCOME_DEADLINE_EXCEEDED";
|
|
43
31
|
})(Outcome || (Outcome = {}));
|
|
32
|
+
/** Programming language of the `code`. */
|
|
33
|
+
var Language;
|
|
34
|
+
(function (Language) {
|
|
35
|
+
/**
|
|
36
|
+
* Unspecified language. This value should not be used.
|
|
37
|
+
*/
|
|
38
|
+
Language["LANGUAGE_UNSPECIFIED"] = "LANGUAGE_UNSPECIFIED";
|
|
39
|
+
/**
|
|
40
|
+
* Python >= 3.10, with numpy and simpy available.
|
|
41
|
+
*/
|
|
42
|
+
Language["PYTHON"] = "PYTHON";
|
|
43
|
+
})(Language || (Language = {}));
|
|
44
44
|
/** Specifies how the response should be scheduled in the conversation. */
|
|
45
45
|
var FunctionResponseScheduling;
|
|
46
46
|
(function (FunctionResponseScheduling) {
|
|
@@ -108,6 +108,14 @@ var Environment;
|
|
|
108
108
|
* Operates in a web browser.
|
|
109
109
|
*/
|
|
110
110
|
Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
|
|
111
|
+
/**
|
|
112
|
+
* Operates in a mobile environment.
|
|
113
|
+
*/
|
|
114
|
+
Environment["ENVIRONMENT_MOBILE"] = "ENVIRONMENT_MOBILE";
|
|
115
|
+
/**
|
|
116
|
+
* Operates in a desktop environment.
|
|
117
|
+
*/
|
|
118
|
+
Environment["ENVIRONMENT_DESKTOP"] = "ENVIRONMENT_DESKTOP";
|
|
111
119
|
})(Environment || (Environment = {}));
|
|
112
120
|
/** Type of auth scheme. This enum is not supported in Gemini API. */
|
|
113
121
|
var AuthType;
|
|
@@ -893,7 +901,23 @@ var PairwiseChoice;
|
|
|
893
901
|
*/
|
|
894
902
|
PairwiseChoice["TIE"] = "TIE";
|
|
895
903
|
})(PairwiseChoice || (PairwiseChoice = {}));
|
|
896
|
-
/** The tuning
|
|
904
|
+
/** The speed of the tuning job. Only supported for Veo 3.0 models. This enum is not supported in Gemini API. */
|
|
905
|
+
var TuningSpeed;
|
|
906
|
+
(function (TuningSpeed) {
|
|
907
|
+
/**
|
|
908
|
+
* The default / unset value. For Veo 3.0 models, this defaults to FAST.
|
|
909
|
+
*/
|
|
910
|
+
TuningSpeed["TUNING_SPEED_UNSPECIFIED"] = "TUNING_SPEED_UNSPECIFIED";
|
|
911
|
+
/**
|
|
912
|
+
* Regular tuning speed.
|
|
913
|
+
*/
|
|
914
|
+
TuningSpeed["REGULAR"] = "REGULAR";
|
|
915
|
+
/**
|
|
916
|
+
* Fast tuning speed.
|
|
917
|
+
*/
|
|
918
|
+
TuningSpeed["FAST"] = "FAST";
|
|
919
|
+
})(TuningSpeed || (TuningSpeed = {}));
|
|
920
|
+
/** The tuning task for Veo. This enum is not supported in Gemini API. */
|
|
897
921
|
var TuningTask;
|
|
898
922
|
(function (TuningTask) {
|
|
899
923
|
/**
|
|
@@ -913,6 +937,22 @@ var TuningTask;
|
|
|
913
937
|
*/
|
|
914
938
|
TuningTask["TUNING_TASK_R2V"] = "TUNING_TASK_R2V";
|
|
915
939
|
})(TuningTask || (TuningTask = {}));
|
|
940
|
+
/** The orientation of the video. Defaults to LANDSCAPE. This enum is not supported in Gemini API. */
|
|
941
|
+
var VideoOrientation;
|
|
942
|
+
(function (VideoOrientation) {
|
|
943
|
+
/**
|
|
944
|
+
* Unspecified video orientation. Defaults to landscape.
|
|
945
|
+
*/
|
|
946
|
+
VideoOrientation["VIDEO_ORIENTATION_UNSPECIFIED"] = "VIDEO_ORIENTATION_UNSPECIFIED";
|
|
947
|
+
/**
|
|
948
|
+
* Landscape orientation (e.g. 16:9, 1280x720).
|
|
949
|
+
*/
|
|
950
|
+
VideoOrientation["LANDSCAPE"] = "LANDSCAPE";
|
|
951
|
+
/**
|
|
952
|
+
* Portrait orientation (e.g. 9:16, 720x1280).
|
|
953
|
+
*/
|
|
954
|
+
VideoOrientation["PORTRAIT"] = "PORTRAIT";
|
|
955
|
+
})(VideoOrientation || (VideoOrientation = {}));
|
|
916
956
|
/** Output only. Current state of the `Document`. This enum is not supported in Vertex AI. */
|
|
917
957
|
var DocumentState;
|
|
918
958
|
(function (DocumentState) {
|