@google/genai 2.8.0 → 2.9.0-rc.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/README.md +7 -0
- package/dist/genai.d.ts +3404 -2548
- package/dist/index.cjs +4058 -1901
- package/dist/index.mjs +4058 -1901
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +4060 -1903
- package/dist/node/index.mjs +4060 -1903
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +3404 -2548
- package/dist/tokenizer/node.cjs +64 -64
- package/dist/tokenizer/node.mjs +64 -64
- package/dist/tokenizer/node.mjs.map +1 -1
- package/dist/vertex_internal/index.cjs +65 -65
- package/dist/vertex_internal/index.cjs.map +1 -1
- package/dist/vertex_internal/index.d.ts +26 -37
- package/dist/vertex_internal/index.js +65 -65
- package/dist/vertex_internal/index.js.map +1 -1
- package/dist/web/index.mjs +4058 -1902
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +3404 -2548
- package/package.json +2 -2
|
@@ -157,7 +157,7 @@ declare interface ApiAuthApiKeyConfig {
|
|
|
157
157
|
* WARNING: This is an internal API and may change without notice. Direct usage
|
|
158
158
|
* is not supported and may break your application.
|
|
159
159
|
*/
|
|
160
|
-
export declare class ApiClient
|
|
160
|
+
export declare class ApiClient {
|
|
161
161
|
readonly clientOptions: ApiClientInitOptions;
|
|
162
162
|
private readonly customBaseUrl?;
|
|
163
163
|
constructor(opts: ApiClientInitOptions);
|
|
@@ -2181,7 +2181,7 @@ declare interface Endpoint {
|
|
|
2181
2181
|
/** End of speech sensitivity. */
|
|
2182
2182
|
declare enum EndSensitivity {
|
|
2183
2183
|
/**
|
|
2184
|
-
* The default is END_SENSITIVITY_LOW.
|
|
2184
|
+
* The default is END_SENSITIVITY_LOW for Gemini Enterprise Agent Platform and END_SENSITIVITY_HIGH for Gemini Live.
|
|
2185
2185
|
*/
|
|
2186
2186
|
END_SENSITIVITY_UNSPECIFIED = "END_SENSITIVITY_UNSPECIFIED",
|
|
2187
2187
|
/**
|
|
@@ -2675,18 +2675,6 @@ declare interface GcsSource {
|
|
|
2675
2675
|
uris?: string[];
|
|
2676
2676
|
}
|
|
2677
2677
|
|
|
2678
|
-
/**
|
|
2679
|
-
* @license
|
|
2680
|
-
* Copyright 2025 Google LLC
|
|
2681
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
2682
|
-
*/
|
|
2683
|
-
declare interface GeminiNextGenAPIClientAdapter {
|
|
2684
|
-
isVertexAI: () => boolean;
|
|
2685
|
-
getProject: () => string | undefined;
|
|
2686
|
-
getLocation: () => string | undefined;
|
|
2687
|
-
getAuthHeaders: () => Headers | Promise<Headers>;
|
|
2688
|
-
}
|
|
2689
|
-
|
|
2690
2678
|
/** Input example for preference optimization. This data type is not supported in Gemini API. */
|
|
2691
2679
|
declare interface GeminiPreferenceExample {
|
|
2692
2680
|
/** List of completions for a given prompt. */
|
|
@@ -5279,30 +5267,30 @@ declare interface McpServer {
|
|
|
5279
5267
|
streamableHttpTransport?: StreamableHttpTransport;
|
|
5280
5268
|
}
|
|
5281
5269
|
|
|
5282
|
-
/**
|
|
5270
|
+
/** The modality that this token count applies to. */
|
|
5283
5271
|
declare enum MediaModality {
|
|
5284
5272
|
/**
|
|
5285
|
-
*
|
|
5273
|
+
* When a modality is not specified, it is treated as `TEXT`.
|
|
5286
5274
|
*/
|
|
5287
5275
|
MODALITY_UNSPECIFIED = "MODALITY_UNSPECIFIED",
|
|
5288
5276
|
/**
|
|
5289
|
-
*
|
|
5277
|
+
* The `Part` contains plain text.
|
|
5290
5278
|
*/
|
|
5291
5279
|
TEXT = "TEXT",
|
|
5292
5280
|
/**
|
|
5293
|
-
*
|
|
5281
|
+
* The `Part` contains an image.
|
|
5294
5282
|
*/
|
|
5295
5283
|
IMAGE = "IMAGE",
|
|
5296
5284
|
/**
|
|
5297
|
-
*
|
|
5285
|
+
* The `Part` contains a video.
|
|
5298
5286
|
*/
|
|
5299
5287
|
VIDEO = "VIDEO",
|
|
5300
5288
|
/**
|
|
5301
|
-
*
|
|
5289
|
+
* The `Part` contains audio.
|
|
5302
5290
|
*/
|
|
5303
5291
|
AUDIO = "AUDIO",
|
|
5304
5292
|
/**
|
|
5305
|
-
*
|
|
5293
|
+
* The `Part` contains a document, such as a PDF.
|
|
5306
5294
|
*/
|
|
5307
5295
|
DOCUMENT = "DOCUMENT"
|
|
5308
5296
|
}
|
|
@@ -5351,9 +5339,9 @@ declare enum Modality {
|
|
|
5351
5339
|
VIDEO = "VIDEO"
|
|
5352
5340
|
}
|
|
5353
5341
|
|
|
5354
|
-
/** Represents token
|
|
5342
|
+
/** Represents a breakdown of token usage by modality. This message is used in CountTokensResponse and GenerateContentResponse.UsageMetadata to provide a detailed view of how many tokens are used by each modality (e.g., text, image, video) in a request. This is particularly useful for multimodal models, allowing you to track and manage token consumption for billing and quota purposes. */
|
|
5355
5343
|
declare interface ModalityTokenCount {
|
|
5356
|
-
/** The modality
|
|
5344
|
+
/** The modality that this token count applies to. */
|
|
5357
5345
|
modality?: MediaModality;
|
|
5358
5346
|
/** The number of tokens counted for this modality. */
|
|
5359
5347
|
tokenCount?: number;
|
|
@@ -6762,7 +6750,7 @@ declare type SpeechConfigUnion = SpeechConfig | string;
|
|
|
6762
6750
|
/** Start of speech sensitivity. */
|
|
6763
6751
|
declare enum StartSensitivity {
|
|
6764
6752
|
/**
|
|
6765
|
-
* The default is START_SENSITIVITY_LOW.
|
|
6753
|
+
* The default is START_SENSITIVITY_LOW for Gemini Enterprise Agent Platform and START_SENSITIVITY_HIGH for Gemini Live.
|
|
6766
6754
|
*/
|
|
6767
6755
|
START_SENSITIVITY_UNSPECIFIED = "START_SENSITIVITY_UNSPECIFIED",
|
|
6768
6756
|
/**
|
|
@@ -7657,9 +7645,10 @@ declare namespace types {
|
|
|
7657
7645
|
UrlRetrievalStatus,
|
|
7658
7646
|
BlockedReason,
|
|
7659
7647
|
TrafficType,
|
|
7660
|
-
|
|
7648
|
+
MediaModality,
|
|
7661
7649
|
ModelStage,
|
|
7662
7650
|
MediaResolution,
|
|
7651
|
+
Modality,
|
|
7663
7652
|
TuningMode,
|
|
7664
7653
|
AdapterSize,
|
|
7665
7654
|
JobState,
|
|
@@ -7670,10 +7659,10 @@ declare namespace types {
|
|
|
7670
7659
|
TuningTask,
|
|
7671
7660
|
VideoOrientation,
|
|
7672
7661
|
DocumentState,
|
|
7662
|
+
ServiceTier,
|
|
7673
7663
|
PartMediaResolutionLevel,
|
|
7674
7664
|
ToolType,
|
|
7675
7665
|
ResourceScope,
|
|
7676
|
-
ServiceTier,
|
|
7677
7666
|
FeatureSelectionPreference,
|
|
7678
7667
|
EmbeddingApiType,
|
|
7679
7668
|
SafetyFilterLevel,
|
|
@@ -7694,7 +7683,6 @@ declare namespace types {
|
|
|
7694
7683
|
FileState,
|
|
7695
7684
|
FileSource,
|
|
7696
7685
|
TurnCompleteReason,
|
|
7697
|
-
MediaModality,
|
|
7698
7686
|
VadSignalType,
|
|
7699
7687
|
VoiceActivityType,
|
|
7700
7688
|
StartSensitivity,
|
|
@@ -8447,29 +8435,30 @@ declare enum UrlRetrievalStatus {
|
|
|
8447
8435
|
|
|
8448
8436
|
/** Usage metadata about response(s). */
|
|
8449
8437
|
declare interface UsageMetadata {
|
|
8450
|
-
/**
|
|
8438
|
+
/** The total number of tokens in the prompt. This includes any text, images, or other media provided in the request. When `cached_content` is set, this also includes the number of tokens in the cached content. */
|
|
8451
8439
|
promptTokenCount?: number;
|
|
8452
|
-
/**
|
|
8440
|
+
/** Output only. The number of tokens in the cached content that was used for this request. */
|
|
8453
8441
|
cachedContentTokenCount?: number;
|
|
8454
8442
|
/** Total number of tokens across all the generated response candidates. */
|
|
8455
8443
|
responseTokenCount?: number;
|
|
8456
|
-
/**
|
|
8444
|
+
/** Output only. The number of tokens in the results from tool executions, which are provided back to the model as input, if applicable. */
|
|
8457
8445
|
toolUsePromptTokenCount?: number;
|
|
8458
|
-
/**
|
|
8446
|
+
/** Output only. The number of tokens that were part of the model's generated "thoughts" output, if applicable. */
|
|
8459
8447
|
thoughtsTokenCount?: number;
|
|
8460
|
-
/**
|
|
8448
|
+
/** The total number of tokens for the entire request. This is the sum of `prompt_token_count`, `candidates_token_count`, `tool_use_prompt_token_count`, and `thoughts_token_count`. */
|
|
8461
8449
|
totalTokenCount?: number;
|
|
8462
|
-
/**
|
|
8450
|
+
/** Output only. A detailed breakdown of the token count for each modality in the prompt. */
|
|
8463
8451
|
promptTokensDetails?: ModalityTokenCount[];
|
|
8464
|
-
/**
|
|
8452
|
+
/** Output only. A detailed breakdown of the token count for each modality in the cached content. */
|
|
8465
8453
|
cacheTokensDetails?: ModalityTokenCount[];
|
|
8466
8454
|
/** List of modalities that were returned in the response. */
|
|
8467
8455
|
responseTokensDetails?: ModalityTokenCount[];
|
|
8468
|
-
/**
|
|
8456
|
+
/** Output only. A detailed breakdown by modality of the token counts from the results of tool executions, which are provided back to the model as input. */
|
|
8469
8457
|
toolUsePromptTokensDetails?: ModalityTokenCount[];
|
|
8470
|
-
/**
|
|
8471
|
-
or Provisioned Throughput quota. */
|
|
8458
|
+
/** Output only. The traffic type for this request. This field is not supported in Gemini API. */
|
|
8472
8459
|
trafficType?: TrafficType;
|
|
8460
|
+
/** Output only. Service tier of the request. This field is not supported in Vertex AI. */
|
|
8461
|
+
serviceTier?: ServiceTier;
|
|
8473
8462
|
}
|
|
8474
8463
|
|
|
8475
8464
|
/** The type of the VAD signal. */
|
|
@@ -944,30 +944,34 @@ var TrafficType;
|
|
|
944
944
|
*/
|
|
945
945
|
TrafficType["PROVISIONED_THROUGHPUT"] = "PROVISIONED_THROUGHPUT";
|
|
946
946
|
})(TrafficType || (TrafficType = {}));
|
|
947
|
-
/**
|
|
948
|
-
var
|
|
949
|
-
(function (
|
|
947
|
+
/** The modality that this token count applies to. */
|
|
948
|
+
var MediaModality;
|
|
949
|
+
(function (MediaModality) {
|
|
950
950
|
/**
|
|
951
|
-
*
|
|
951
|
+
* When a modality is not specified, it is treated as `TEXT`.
|
|
952
952
|
*/
|
|
953
|
-
|
|
953
|
+
MediaModality["MODALITY_UNSPECIFIED"] = "MODALITY_UNSPECIFIED";
|
|
954
954
|
/**
|
|
955
|
-
*
|
|
955
|
+
* The `Part` contains plain text.
|
|
956
956
|
*/
|
|
957
|
-
|
|
957
|
+
MediaModality["TEXT"] = "TEXT";
|
|
958
958
|
/**
|
|
959
|
-
*
|
|
959
|
+
* The `Part` contains an image.
|
|
960
960
|
*/
|
|
961
|
-
|
|
961
|
+
MediaModality["IMAGE"] = "IMAGE";
|
|
962
962
|
/**
|
|
963
|
-
*
|
|
963
|
+
* The `Part` contains a video.
|
|
964
964
|
*/
|
|
965
|
-
|
|
965
|
+
MediaModality["VIDEO"] = "VIDEO";
|
|
966
966
|
/**
|
|
967
|
-
*
|
|
967
|
+
* The `Part` contains audio.
|
|
968
968
|
*/
|
|
969
|
-
|
|
970
|
-
|
|
969
|
+
MediaModality["AUDIO"] = "AUDIO";
|
|
970
|
+
/**
|
|
971
|
+
* The `Part` contains a document, such as a PDF.
|
|
972
|
+
*/
|
|
973
|
+
MediaModality["DOCUMENT"] = "DOCUMENT";
|
|
974
|
+
})(MediaModality || (MediaModality = {}));
|
|
971
975
|
/** The stage of the underlying model. This enum is not supported in Vertex AI. */
|
|
972
976
|
var ModelStage;
|
|
973
977
|
(function (ModelStage) {
|
|
@@ -1024,6 +1028,30 @@ var MediaResolution;
|
|
|
1024
1028
|
*/
|
|
1025
1029
|
MediaResolution["MEDIA_RESOLUTION_HIGH"] = "MEDIA_RESOLUTION_HIGH";
|
|
1026
1030
|
})(MediaResolution || (MediaResolution = {}));
|
|
1031
|
+
/** Server content modalities. */
|
|
1032
|
+
var Modality;
|
|
1033
|
+
(function (Modality) {
|
|
1034
|
+
/**
|
|
1035
|
+
* The modality is unspecified.
|
|
1036
|
+
*/
|
|
1037
|
+
Modality["MODALITY_UNSPECIFIED"] = "MODALITY_UNSPECIFIED";
|
|
1038
|
+
/**
|
|
1039
|
+
* Indicates the model should return text
|
|
1040
|
+
*/
|
|
1041
|
+
Modality["TEXT"] = "TEXT";
|
|
1042
|
+
/**
|
|
1043
|
+
* Indicates the model should return images.
|
|
1044
|
+
*/
|
|
1045
|
+
Modality["IMAGE"] = "IMAGE";
|
|
1046
|
+
/**
|
|
1047
|
+
* Indicates the model should return audio.
|
|
1048
|
+
*/
|
|
1049
|
+
Modality["AUDIO"] = "AUDIO";
|
|
1050
|
+
/**
|
|
1051
|
+
* Indicates the model should return video.
|
|
1052
|
+
*/
|
|
1053
|
+
Modality["VIDEO"] = "VIDEO";
|
|
1054
|
+
})(Modality || (Modality = {}));
|
|
1027
1055
|
/** Tuning mode. This enum is not supported in Gemini API. */
|
|
1028
1056
|
var TuningMode;
|
|
1029
1057
|
(function (TuningMode) {
|
|
@@ -1292,6 +1320,26 @@ var DocumentState;
|
|
|
1292
1320
|
*/
|
|
1293
1321
|
DocumentState["STATE_FAILED"] = "STATE_FAILED";
|
|
1294
1322
|
})(DocumentState || (DocumentState = {}));
|
|
1323
|
+
/** Pricing and performance service tier. */
|
|
1324
|
+
var ServiceTier;
|
|
1325
|
+
(function (ServiceTier) {
|
|
1326
|
+
/**
|
|
1327
|
+
* Default service tier, which is standard.
|
|
1328
|
+
*/
|
|
1329
|
+
ServiceTier["UNSPECIFIED"] = "unspecified";
|
|
1330
|
+
/**
|
|
1331
|
+
* Flex service tier.
|
|
1332
|
+
*/
|
|
1333
|
+
ServiceTier["FLEX"] = "flex";
|
|
1334
|
+
/**
|
|
1335
|
+
* Standard service tier.
|
|
1336
|
+
*/
|
|
1337
|
+
ServiceTier["STANDARD"] = "standard";
|
|
1338
|
+
/**
|
|
1339
|
+
* Priority service tier.
|
|
1340
|
+
*/
|
|
1341
|
+
ServiceTier["PRIORITY"] = "priority";
|
|
1342
|
+
})(ServiceTier || (ServiceTier = {}));
|
|
1295
1343
|
/** The tokenization quality used for given media. */
|
|
1296
1344
|
var PartMediaResolutionLevel;
|
|
1297
1345
|
(function (PartMediaResolutionLevel) {
|
|
@@ -1356,26 +1404,6 @@ var ResourceScope;
|
|
|
1356
1404
|
*/
|
|
1357
1405
|
ResourceScope["COLLECTION"] = "COLLECTION";
|
|
1358
1406
|
})(ResourceScope || (ResourceScope = {}));
|
|
1359
|
-
/** Pricing and performance service tier. */
|
|
1360
|
-
var ServiceTier;
|
|
1361
|
-
(function (ServiceTier) {
|
|
1362
|
-
/**
|
|
1363
|
-
* Default service tier, which is standard.
|
|
1364
|
-
*/
|
|
1365
|
-
ServiceTier["UNSPECIFIED"] = "unspecified";
|
|
1366
|
-
/**
|
|
1367
|
-
* Flex service tier.
|
|
1368
|
-
*/
|
|
1369
|
-
ServiceTier["FLEX"] = "flex";
|
|
1370
|
-
/**
|
|
1371
|
-
* Standard service tier.
|
|
1372
|
-
*/
|
|
1373
|
-
ServiceTier["STANDARD"] = "standard";
|
|
1374
|
-
/**
|
|
1375
|
-
* Priority service tier.
|
|
1376
|
-
*/
|
|
1377
|
-
ServiceTier["PRIORITY"] = "priority";
|
|
1378
|
-
})(ServiceTier || (ServiceTier = {}));
|
|
1379
1407
|
/** Options for feature selection preference. */
|
|
1380
1408
|
var FeatureSelectionPreference;
|
|
1381
1409
|
(function (FeatureSelectionPreference) {
|
|
@@ -1760,34 +1788,6 @@ var TurnCompleteReason;
|
|
|
1760
1788
|
*/
|
|
1761
1789
|
TurnCompleteReason["MAX_REGENERATION_REACHED"] = "MAX_REGENERATION_REACHED";
|
|
1762
1790
|
})(TurnCompleteReason || (TurnCompleteReason = {}));
|
|
1763
|
-
/** Server content modalities. */
|
|
1764
|
-
var MediaModality;
|
|
1765
|
-
(function (MediaModality) {
|
|
1766
|
-
/**
|
|
1767
|
-
* The modality is unspecified.
|
|
1768
|
-
*/
|
|
1769
|
-
MediaModality["MODALITY_UNSPECIFIED"] = "MODALITY_UNSPECIFIED";
|
|
1770
|
-
/**
|
|
1771
|
-
* Plain text.
|
|
1772
|
-
*/
|
|
1773
|
-
MediaModality["TEXT"] = "TEXT";
|
|
1774
|
-
/**
|
|
1775
|
-
* Images.
|
|
1776
|
-
*/
|
|
1777
|
-
MediaModality["IMAGE"] = "IMAGE";
|
|
1778
|
-
/**
|
|
1779
|
-
* Video.
|
|
1780
|
-
*/
|
|
1781
|
-
MediaModality["VIDEO"] = "VIDEO";
|
|
1782
|
-
/**
|
|
1783
|
-
* Audio.
|
|
1784
|
-
*/
|
|
1785
|
-
MediaModality["AUDIO"] = "AUDIO";
|
|
1786
|
-
/**
|
|
1787
|
-
* Document, e.g. PDF.
|
|
1788
|
-
*/
|
|
1789
|
-
MediaModality["DOCUMENT"] = "DOCUMENT";
|
|
1790
|
-
})(MediaModality || (MediaModality = {}));
|
|
1791
1791
|
/** The type of the VAD signal. */
|
|
1792
1792
|
var VadSignalType;
|
|
1793
1793
|
(function (VadSignalType) {
|
|
@@ -1824,7 +1824,7 @@ var VoiceActivityType;
|
|
|
1824
1824
|
var StartSensitivity;
|
|
1825
1825
|
(function (StartSensitivity) {
|
|
1826
1826
|
/**
|
|
1827
|
-
* The default is START_SENSITIVITY_LOW.
|
|
1827
|
+
* The default is START_SENSITIVITY_LOW for Gemini Enterprise Agent Platform and START_SENSITIVITY_HIGH for Gemini Live.
|
|
1828
1828
|
*/
|
|
1829
1829
|
StartSensitivity["START_SENSITIVITY_UNSPECIFIED"] = "START_SENSITIVITY_UNSPECIFIED";
|
|
1830
1830
|
/**
|
|
@@ -1840,7 +1840,7 @@ var StartSensitivity;
|
|
|
1840
1840
|
var EndSensitivity;
|
|
1841
1841
|
(function (EndSensitivity) {
|
|
1842
1842
|
/**
|
|
1843
|
-
* The default is END_SENSITIVITY_LOW.
|
|
1843
|
+
* The default is END_SENSITIVITY_LOW for Gemini Enterprise Agent Platform and END_SENSITIVITY_HIGH for Gemini Live.
|
|
1844
1844
|
*/
|
|
1845
1845
|
EndSensitivity["END_SENSITIVITY_UNSPECIFIED"] = "END_SENSITIVITY_UNSPECIFIED";
|
|
1846
1846
|
/**
|
|
@@ -2146,7 +2146,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
2146
2146
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
2147
2147
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
2148
2148
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
2149
|
-
const SDK_VERSION = '2.
|
|
2149
|
+
const SDK_VERSION = '2.9.0-rc.0'; // x-release-please-version
|
|
2150
2150
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
2151
2151
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
2152
2152
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|