@google/genai 1.45.0 → 1.46.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 +437 -111
- package/dist/index.cjs +431 -47
- package/dist/index.mjs +431 -48
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +453 -67
- package/dist/node/index.mjs +453 -68
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +437 -111
- package/dist/tokenizer/node.cjs +40 -12
- package/dist/tokenizer/node.d.ts +74 -2
- package/dist/tokenizer/node.mjs +40 -12
- package/dist/tokenizer/node.mjs.map +1 -1
- package/dist/vertex_internal/index.cjs +87 -54
- package/dist/vertex_internal/index.cjs.map +1 -1
- package/dist/vertex_internal/index.d.ts +87 -9
- package/dist/vertex_internal/index.js +87 -54
- package/dist/vertex_internal/index.js.map +1 -1
- package/dist/web/index.mjs +431 -48
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +437 -111
- package/package.json +1 -1
package/dist/tokenizer/node.cjs
CHANGED
|
@@ -33,6 +33,18 @@ var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
|
|
|
33
33
|
* Copyright 2025 Google LLC
|
|
34
34
|
* SPDX-License-Identifier: Apache-2.0
|
|
35
35
|
*/
|
|
36
|
+
/** Programming language of the `code`. */
|
|
37
|
+
var Language;
|
|
38
|
+
(function (Language) {
|
|
39
|
+
/**
|
|
40
|
+
* Unspecified language. This value should not be used.
|
|
41
|
+
*/
|
|
42
|
+
Language["LANGUAGE_UNSPECIFIED"] = "LANGUAGE_UNSPECIFIED";
|
|
43
|
+
/**
|
|
44
|
+
* Python >= 3.10, with numpy and simpy available.
|
|
45
|
+
*/
|
|
46
|
+
Language["PYTHON"] = "PYTHON";
|
|
47
|
+
})(Language || (Language = {}));
|
|
36
48
|
/** Outcome of the code execution. */
|
|
37
49
|
var Outcome;
|
|
38
50
|
(function (Outcome) {
|
|
@@ -53,18 +65,6 @@ var Outcome;
|
|
|
53
65
|
*/
|
|
54
66
|
Outcome["OUTCOME_DEADLINE_EXCEEDED"] = "OUTCOME_DEADLINE_EXCEEDED";
|
|
55
67
|
})(Outcome || (Outcome = {}));
|
|
56
|
-
/** Programming language of the `code`. */
|
|
57
|
-
var Language;
|
|
58
|
-
(function (Language) {
|
|
59
|
-
/**
|
|
60
|
-
* Unspecified language. This value should not be used.
|
|
61
|
-
*/
|
|
62
|
-
Language["LANGUAGE_UNSPECIFIED"] = "LANGUAGE_UNSPECIFIED";
|
|
63
|
-
/**
|
|
64
|
-
* Python >= 3.10, with numpy and simpy available.
|
|
65
|
-
*/
|
|
66
|
-
Language["PYTHON"] = "PYTHON";
|
|
67
|
-
})(Language || (Language = {}));
|
|
68
68
|
/** Specifies how the response should be scheduled in the conversation. */
|
|
69
69
|
var FunctionResponseScheduling;
|
|
70
70
|
(function (FunctionResponseScheduling) {
|
|
@@ -893,6 +893,34 @@ var PartMediaResolutionLevel;
|
|
|
893
893
|
*/
|
|
894
894
|
PartMediaResolutionLevel["MEDIA_RESOLUTION_ULTRA_HIGH"] = "MEDIA_RESOLUTION_ULTRA_HIGH";
|
|
895
895
|
})(PartMediaResolutionLevel || (PartMediaResolutionLevel = {}));
|
|
896
|
+
/** The type of tool in the function call. */
|
|
897
|
+
var ToolType;
|
|
898
|
+
(function (ToolType) {
|
|
899
|
+
/**
|
|
900
|
+
* Unspecified tool type.
|
|
901
|
+
*/
|
|
902
|
+
ToolType["TOOL_TYPE_UNSPECIFIED"] = "TOOL_TYPE_UNSPECIFIED";
|
|
903
|
+
/**
|
|
904
|
+
* Google search tool, maps to Tool.google_search.search_types.web_search.
|
|
905
|
+
*/
|
|
906
|
+
ToolType["GOOGLE_SEARCH_WEB"] = "GOOGLE_SEARCH_WEB";
|
|
907
|
+
/**
|
|
908
|
+
* Image search tool, maps to Tool.google_search.search_types.image_search.
|
|
909
|
+
*/
|
|
910
|
+
ToolType["GOOGLE_SEARCH_IMAGE"] = "GOOGLE_SEARCH_IMAGE";
|
|
911
|
+
/**
|
|
912
|
+
* URL context tool, maps to Tool.url_context.
|
|
913
|
+
*/
|
|
914
|
+
ToolType["URL_CONTEXT"] = "URL_CONTEXT";
|
|
915
|
+
/**
|
|
916
|
+
* Google maps tool, maps to Tool.google_maps.
|
|
917
|
+
*/
|
|
918
|
+
ToolType["GOOGLE_MAPS"] = "GOOGLE_MAPS";
|
|
919
|
+
/**
|
|
920
|
+
* File search tool, maps to Tool.file_search.
|
|
921
|
+
*/
|
|
922
|
+
ToolType["FILE_SEARCH"] = "FILE_SEARCH";
|
|
923
|
+
})(ToolType || (ToolType = {}));
|
|
896
924
|
/** Resource scope. */
|
|
897
925
|
var ResourceScope;
|
|
898
926
|
(function (ResourceScope) {
|
package/dist/tokenizer/node.d.ts
CHANGED
|
@@ -142,12 +142,16 @@ declare interface Blob_2 {
|
|
|
142
142
|
mimeType?: string;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
/** Result of executing the
|
|
145
|
+
/** Result of executing the `ExecutableCode`.
|
|
146
|
+
|
|
147
|
+
Generated only when the `CodeExecution` tool is used. */
|
|
146
148
|
declare interface CodeExecutionResult {
|
|
147
149
|
/** Required. Outcome of the code execution. */
|
|
148
150
|
outcome?: Outcome;
|
|
149
151
|
/** Optional. Contains stdout when code execution is successful, stderr or other description otherwise. */
|
|
150
152
|
output?: string;
|
|
153
|
+
/** The identifier of the `ExecutableCode` part this result is for. Only populated if the corresponding `ExecutableCode` has an id. */
|
|
154
|
+
id?: string;
|
|
151
155
|
}
|
|
152
156
|
|
|
153
157
|
/** Tool to support computer use. */
|
|
@@ -251,12 +255,18 @@ declare enum Environment {
|
|
|
251
255
|
ENVIRONMENT_BROWSER = "ENVIRONMENT_BROWSER"
|
|
252
256
|
}
|
|
253
257
|
|
|
254
|
-
/**
|
|
258
|
+
/** Model-generated code executed server-side, results returned to the model.
|
|
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. */
|
|
255
263
|
declare interface ExecutableCode {
|
|
256
264
|
/** Required. The code to be executed. */
|
|
257
265
|
code?: string;
|
|
258
266
|
/** Required. Programming language of the `code`. */
|
|
259
267
|
language?: Language;
|
|
268
|
+
/** Unique identifier of the `ExecutableCode` part. The server returns the `CodeExecutionResult` with the matching `id`. */
|
|
269
|
+
id?: string;
|
|
260
270
|
}
|
|
261
271
|
|
|
262
272
|
/** Retrieve from data source powered by external API for grounding. The external API is not owned by Google, but need to follow the pre-defined API spec. This data type is not supported in Gemini API. */
|
|
@@ -757,6 +767,10 @@ declare interface Part {
|
|
|
757
767
|
thoughtSignature?: string;
|
|
758
768
|
/** Optional. Video metadata. The metadata should only be specified while the video data is presented in inline_data or file_data. */
|
|
759
769
|
videoMetadata?: VideoMetadata;
|
|
770
|
+
/** Server-side tool call. This field is populated when the model predicts a tool invocation that should be executed on the server. The client is expected to echo this message back to the API. */
|
|
771
|
+
toolCall?: ToolCall;
|
|
772
|
+
/** The output from a server-side ToolCall execution. This field is populated by the client with the results of executing the corresponding ToolCall. */
|
|
773
|
+
toolResponse?: ToolResponse;
|
|
760
774
|
}
|
|
761
775
|
|
|
762
776
|
/** Partial argument value of the function call. This data type is not supported in Gemini API. */
|
|
@@ -1102,6 +1116,21 @@ declare interface Tool {
|
|
|
1102
1116
|
mcpServers?: McpServer[];
|
|
1103
1117
|
}
|
|
1104
1118
|
|
|
1119
|
+
/** A predicted server-side `ToolCall` returned from the model.
|
|
1120
|
+
|
|
1121
|
+
This message contains information about a tool that the model wants to invoke.
|
|
1122
|
+
The client is NOT expected to execute this `ToolCall`. Instead, the
|
|
1123
|
+
client should pass this `ToolCall` back to the API in a subsequent turn
|
|
1124
|
+
within a `Content` message, along with the corresponding `ToolResponse`. */
|
|
1125
|
+
declare interface ToolCall {
|
|
1126
|
+
/** Unique identifier of the tool call. The server returns the tool response with the matching `id`. */
|
|
1127
|
+
id?: string;
|
|
1128
|
+
/** The type of tool that was called. */
|
|
1129
|
+
toolType?: ToolType;
|
|
1130
|
+
/** The tool call arguments. Example: {"arg1": "value1", "arg2": "value2"}. */
|
|
1131
|
+
args?: Record<string, unknown>;
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1105
1134
|
/** 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. */
|
|
1106
1135
|
declare interface ToolCodeExecution {
|
|
1107
1136
|
}
|
|
@@ -1114,6 +1143,49 @@ declare interface ToolParallelAiSearch {
|
|
|
1114
1143
|
customConfigs?: Record<string, unknown>;
|
|
1115
1144
|
}
|
|
1116
1145
|
|
|
1146
|
+
/** The output from a server-side `ToolCall` execution.
|
|
1147
|
+
|
|
1148
|
+
This message contains the results of a tool invocation that was initiated by a
|
|
1149
|
+
`ToolCall` from the model. The client should pass this `ToolResponse` back to
|
|
1150
|
+
the API in a subsequent turn within a `Content` message, along with the
|
|
1151
|
+
corresponding `ToolCall`. */
|
|
1152
|
+
declare class ToolResponse {
|
|
1153
|
+
/** The identifier of the tool call this response is for. */
|
|
1154
|
+
id?: string;
|
|
1155
|
+
/** The type of tool that was called, matching the tool_type in the corresponding ToolCall. */
|
|
1156
|
+
toolType?: ToolType;
|
|
1157
|
+
/** The tool response. */
|
|
1158
|
+
response?: Record<string, unknown>;
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
/** The type of tool in the function call. */
|
|
1162
|
+
declare enum ToolType {
|
|
1163
|
+
/**
|
|
1164
|
+
* Unspecified tool type.
|
|
1165
|
+
*/
|
|
1166
|
+
TOOL_TYPE_UNSPECIFIED = "TOOL_TYPE_UNSPECIFIED",
|
|
1167
|
+
/**
|
|
1168
|
+
* Google search tool, maps to Tool.google_search.search_types.web_search.
|
|
1169
|
+
*/
|
|
1170
|
+
GOOGLE_SEARCH_WEB = "GOOGLE_SEARCH_WEB",
|
|
1171
|
+
/**
|
|
1172
|
+
* Image search tool, maps to Tool.google_search.search_types.image_search.
|
|
1173
|
+
*/
|
|
1174
|
+
GOOGLE_SEARCH_IMAGE = "GOOGLE_SEARCH_IMAGE",
|
|
1175
|
+
/**
|
|
1176
|
+
* URL context tool, maps to Tool.url_context.
|
|
1177
|
+
*/
|
|
1178
|
+
URL_CONTEXT = "URL_CONTEXT",
|
|
1179
|
+
/**
|
|
1180
|
+
* Google maps tool, maps to Tool.google_maps.
|
|
1181
|
+
*/
|
|
1182
|
+
GOOGLE_MAPS = "GOOGLE_MAPS",
|
|
1183
|
+
/**
|
|
1184
|
+
* File search tool, maps to Tool.file_search.
|
|
1185
|
+
*/
|
|
1186
|
+
FILE_SEARCH = "FILE_SEARCH"
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1117
1189
|
/** Data type of the schema field. */
|
|
1118
1190
|
declare enum Type {
|
|
1119
1191
|
/**
|
package/dist/tokenizer/node.mjs
CHANGED
|
@@ -9,6 +9,18 @@ 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 = {}));
|
|
12
24
|
/** Outcome of the code execution. */
|
|
13
25
|
var Outcome;
|
|
14
26
|
(function (Outcome) {
|
|
@@ -29,18 +41,6 @@ var Outcome;
|
|
|
29
41
|
*/
|
|
30
42
|
Outcome["OUTCOME_DEADLINE_EXCEEDED"] = "OUTCOME_DEADLINE_EXCEEDED";
|
|
31
43
|
})(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) {
|
|
@@ -869,6 +869,34 @@ var PartMediaResolutionLevel;
|
|
|
869
869
|
*/
|
|
870
870
|
PartMediaResolutionLevel["MEDIA_RESOLUTION_ULTRA_HIGH"] = "MEDIA_RESOLUTION_ULTRA_HIGH";
|
|
871
871
|
})(PartMediaResolutionLevel || (PartMediaResolutionLevel = {}));
|
|
872
|
+
/** The type of tool in the function call. */
|
|
873
|
+
var ToolType;
|
|
874
|
+
(function (ToolType) {
|
|
875
|
+
/**
|
|
876
|
+
* Unspecified tool type.
|
|
877
|
+
*/
|
|
878
|
+
ToolType["TOOL_TYPE_UNSPECIFIED"] = "TOOL_TYPE_UNSPECIFIED";
|
|
879
|
+
/**
|
|
880
|
+
* Google search tool, maps to Tool.google_search.search_types.web_search.
|
|
881
|
+
*/
|
|
882
|
+
ToolType["GOOGLE_SEARCH_WEB"] = "GOOGLE_SEARCH_WEB";
|
|
883
|
+
/**
|
|
884
|
+
* Image search tool, maps to Tool.google_search.search_types.image_search.
|
|
885
|
+
*/
|
|
886
|
+
ToolType["GOOGLE_SEARCH_IMAGE"] = "GOOGLE_SEARCH_IMAGE";
|
|
887
|
+
/**
|
|
888
|
+
* URL context tool, maps to Tool.url_context.
|
|
889
|
+
*/
|
|
890
|
+
ToolType["URL_CONTEXT"] = "URL_CONTEXT";
|
|
891
|
+
/**
|
|
892
|
+
* Google maps tool, maps to Tool.google_maps.
|
|
893
|
+
*/
|
|
894
|
+
ToolType["GOOGLE_MAPS"] = "GOOGLE_MAPS";
|
|
895
|
+
/**
|
|
896
|
+
* File search tool, maps to Tool.file_search.
|
|
897
|
+
*/
|
|
898
|
+
ToolType["FILE_SEARCH"] = "FILE_SEARCH";
|
|
899
|
+
})(ToolType || (ToolType = {}));
|
|
872
900
|
/** Resource scope. */
|
|
873
901
|
var ResourceScope;
|
|
874
902
|
(function (ResourceScope) {
|