@google/genai 1.29.0 → 1.30.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 +116 -8
- package/dist/index.cjs +407 -33
- package/dist/index.mjs +408 -34
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +407 -33
- package/dist/node/index.mjs +408 -34
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +116 -8
- package/dist/web/index.mjs +408 -34
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +116 -8
- package/package.json +1 -1
package/dist/web/web.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// @ts-ignore
|
|
2
1
|
import type { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
3
2
|
import { GoogleAuthOptions } from 'google-auth-library';
|
|
4
3
|
|
|
@@ -1558,7 +1557,7 @@ export declare function createModelContent(partOrString: PartListUnion | string)
|
|
|
1558
1557
|
/**
|
|
1559
1558
|
* Creates a `Part` object from a `base64` encoded `string`.
|
|
1560
1559
|
*/
|
|
1561
|
-
export declare function createPartFromBase64(data: string, mimeType: string): Part;
|
|
1560
|
+
export declare function createPartFromBase64(data: string, mimeType: string, mediaResolution?: PartMediaResolutionLevel): Part;
|
|
1562
1561
|
|
|
1563
1562
|
/**
|
|
1564
1563
|
* Creates a `Part` object from the `outcome` and `output` of a `CodeExecutionResult` object.
|
|
@@ -1588,7 +1587,7 @@ export declare function createPartFromText(text: string): Part;
|
|
|
1588
1587
|
/**
|
|
1589
1588
|
* Creates a `Part` object from a `URI` string.
|
|
1590
1589
|
*/
|
|
1591
|
-
export declare function createPartFromUri(uri: string, mimeType: string): Part;
|
|
1590
|
+
export declare function createPartFromUri(uri: string, mimeType: string, mediaResolution?: PartMediaResolutionLevel): Part;
|
|
1592
1591
|
|
|
1593
1592
|
/** Fine-tuning job creation request - optional fields. */
|
|
1594
1593
|
export declare interface CreateTuningJobConfig {
|
|
@@ -2719,6 +2718,10 @@ export declare interface FunctionCall {
|
|
|
2719
2718
|
args?: Record<string, unknown>;
|
|
2720
2719
|
/** Optional. The name of the function to call. Matches [FunctionDeclaration.name]. */
|
|
2721
2720
|
name?: string;
|
|
2721
|
+
/** 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. */
|
|
2722
|
+
partialArgs?: PartialArg[];
|
|
2723
|
+
/** Optional. Whether this is the last part of the FunctionCall. If true, another partial message for the current FunctionCall is expected to follow. This field is not supported in Gemini API. */
|
|
2724
|
+
willContinue?: boolean;
|
|
2722
2725
|
}
|
|
2723
2726
|
|
|
2724
2727
|
/** Function calling config. */
|
|
@@ -2727,6 +2730,8 @@ export declare interface FunctionCallingConfig {
|
|
|
2727
2730
|
mode?: FunctionCallingConfigMode;
|
|
2728
2731
|
/** Optional. Function names to call. Only set when the Mode is ANY. Function names should match [FunctionDeclaration.name]. With mode set to ANY, model will predict a function call from the set of function names provided. */
|
|
2729
2732
|
allowedFunctionNames?: string[];
|
|
2733
|
+
/** Optional. When set to true, arguments of a single function call will be streamed out in multiple parts/contents/responses. Partial parameter results will be returned in the [FunctionCall.partial_args] field. This field is not supported in Gemini API. */
|
|
2734
|
+
streamFunctionCallArguments?: boolean;
|
|
2730
2735
|
}
|
|
2731
2736
|
|
|
2732
2737
|
/** Config for the function calling config mode. */
|
|
@@ -2801,6 +2806,9 @@ export declare class FunctionResponseBlob {
|
|
|
2801
2806
|
/** Required. Inline media bytes.
|
|
2802
2807
|
* @remarks Encoded as base64 string. */
|
|
2803
2808
|
data?: string;
|
|
2809
|
+
/** Optional. Display name of the blob.
|
|
2810
|
+
Used to provide a label or filename to distinguish blobs. */
|
|
2811
|
+
displayName?: string;
|
|
2804
2812
|
}
|
|
2805
2813
|
|
|
2806
2814
|
/** URI based data for function response. */
|
|
@@ -2809,6 +2817,9 @@ export declare class FunctionResponseFileData {
|
|
|
2809
2817
|
fileUri?: string;
|
|
2810
2818
|
/** Required. The IANA standard MIME type of the source data. */
|
|
2811
2819
|
mimeType?: string;
|
|
2820
|
+
/** Optional. Display name of the file.
|
|
2821
|
+
Used to provide a label or filename to distinguish files. */
|
|
2822
|
+
displayName?: string;
|
|
2812
2823
|
}
|
|
2813
2824
|
|
|
2814
2825
|
/** A datatype containing media that is part of a `FunctionResponse` message.
|
|
@@ -4242,6 +4253,12 @@ export declare interface ImageConfig {
|
|
|
4242
4253
|
values are `1K`, `2K`, `4K`. If not specified, the model will use default
|
|
4243
4254
|
value `1K`. */
|
|
4244
4255
|
imageSize?: string;
|
|
4256
|
+
/** MIME type of the generated image. This field is not
|
|
4257
|
+
supported in Gemini API. */
|
|
4258
|
+
outputMimeType?: string;
|
|
4259
|
+
/** Compression quality of the generated image (for
|
|
4260
|
+
``image/jpeg`` only). This field is not supported in Gemini API. */
|
|
4261
|
+
outputCompressionQuality?: number;
|
|
4245
4262
|
}
|
|
4246
4263
|
|
|
4247
4264
|
/** Enum that specifies the language of the text in the prompt. */
|
|
@@ -5637,6 +5654,28 @@ export declare interface Model {
|
|
|
5637
5654
|
defaultCheckpointId?: string;
|
|
5638
5655
|
/** The checkpoints of the model. */
|
|
5639
5656
|
checkpoints?: Checkpoint[];
|
|
5657
|
+
/** Temperature value used for sampling set when the dataset was saved.
|
|
5658
|
+
This value is used to tune the degree of randomness. */
|
|
5659
|
+
temperature?: number;
|
|
5660
|
+
/** The maximum temperature value used for sampling set when the
|
|
5661
|
+
dataset was saved. This value is used to tune the degree of randomness. */
|
|
5662
|
+
maxTemperature?: number;
|
|
5663
|
+
/** Optional. Specifies the nucleus sampling threshold. The model
|
|
5664
|
+
considers only the smallest set of tokens whose cumulative probability is
|
|
5665
|
+
at least `top_p`. This helps generate more diverse and less repetitive
|
|
5666
|
+
responses. For example, a `top_p` of 0.9 means the model considers tokens
|
|
5667
|
+
until the cumulative probability of the tokens to select from reaches 0.9.
|
|
5668
|
+
It's recommended to adjust either temperature or `top_p`, but not both. */
|
|
5669
|
+
topP?: number;
|
|
5670
|
+
/** Optional. Specifies the top-k sampling threshold. The model
|
|
5671
|
+
considers only the top k most probable tokens for the next token. This can
|
|
5672
|
+
be useful for generating more coherent and less random text. For example,
|
|
5673
|
+
a `top_k` of 40 means the model will choose the next word from the 40 most
|
|
5674
|
+
likely words. */
|
|
5675
|
+
topK?: number;
|
|
5676
|
+
/** Whether the model supports thinking features. If true, thoughts are
|
|
5677
|
+
returned only if the model supports thought and thoughts are available. */
|
|
5678
|
+
thinking?: boolean;
|
|
5640
5679
|
}
|
|
5641
5680
|
|
|
5642
5681
|
export declare class Models extends BaseModule {
|
|
@@ -6254,16 +6293,17 @@ export declare class Pager<T> implements AsyncIterable<T> {
|
|
|
6254
6293
|
of content being conveyed. Using multiple fields within the same `Part`
|
|
6255
6294
|
instance is considered invalid. */
|
|
6256
6295
|
export declare interface Part {
|
|
6257
|
-
/**
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
functionCall?: FunctionCall;
|
|
6296
|
+
/** Media resolution for the input media.
|
|
6297
|
+
*/
|
|
6298
|
+
mediaResolution?: PartMediaResolution;
|
|
6261
6299
|
/** Optional. Result of executing the [ExecutableCode]. */
|
|
6262
6300
|
codeExecutionResult?: CodeExecutionResult;
|
|
6263
6301
|
/** Optional. Code generated by the model that is meant to be executed. */
|
|
6264
6302
|
executableCode?: ExecutableCode;
|
|
6265
6303
|
/** Optional. URI based data. */
|
|
6266
6304
|
fileData?: FileData;
|
|
6305
|
+
/** Optional. A predicted [FunctionCall] returned from the model that contains a string representing the [FunctionDeclaration.name] with the parameters and their values. */
|
|
6306
|
+
functionCall?: FunctionCall;
|
|
6267
6307
|
/** Optional. The result output of a [FunctionCall] that contains a string representing the [FunctionDeclaration.name] and a structured JSON object containing any output from the function call. It is used as context to the model. */
|
|
6268
6308
|
functionResponse?: FunctionResponse;
|
|
6269
6309
|
/** Optional. Inlined bytes data. */
|
|
@@ -6279,8 +6319,54 @@ export declare interface Part {
|
|
|
6279
6319
|
videoMetadata?: VideoMetadata;
|
|
6280
6320
|
}
|
|
6281
6321
|
|
|
6322
|
+
/** Partial argument value of the function call. This data type is not supported in Gemini API. */
|
|
6323
|
+
export declare interface PartialArg {
|
|
6324
|
+
/** Optional. Represents a null value. */
|
|
6325
|
+
nullValue?: 'NULL_VALUE';
|
|
6326
|
+
/** Optional. Represents a double value. */
|
|
6327
|
+
numberValue?: number;
|
|
6328
|
+
/** Optional. Represents a string value. */
|
|
6329
|
+
stringValue?: string;
|
|
6330
|
+
/** Optional. Represents a boolean value. */
|
|
6331
|
+
boolValue?: boolean;
|
|
6332
|
+
/** Required. A JSON Path (RFC 9535) to the argument being streamed. https://datatracker.ietf.org/doc/html/rfc9535. e.g. "$.foo.bar[0].data". */
|
|
6333
|
+
jsonPath?: string;
|
|
6334
|
+
/** Optional. Whether this is not the last part of the same json_path. If true, another PartialArg message for the current json_path is expected to follow. */
|
|
6335
|
+
willContinue?: boolean;
|
|
6336
|
+
}
|
|
6337
|
+
|
|
6282
6338
|
export declare type PartListUnion = PartUnion[] | PartUnion;
|
|
6283
6339
|
|
|
6340
|
+
/** Media resolution for the input media. */
|
|
6341
|
+
export declare interface PartMediaResolution {
|
|
6342
|
+
/** The tokenization quality used for given media.
|
|
6343
|
+
*/
|
|
6344
|
+
level?: PartMediaResolutionLevel;
|
|
6345
|
+
/** Specifies the required sequence length for media tokenization.
|
|
6346
|
+
*/
|
|
6347
|
+
numTokens?: number;
|
|
6348
|
+
}
|
|
6349
|
+
|
|
6350
|
+
/** The tokenization quality used for given media. */
|
|
6351
|
+
export declare enum PartMediaResolutionLevel {
|
|
6352
|
+
/**
|
|
6353
|
+
* Media resolution has not been set.
|
|
6354
|
+
*/
|
|
6355
|
+
MEDIA_RESOLUTION_UNSPECIFIED = "MEDIA_RESOLUTION_UNSPECIFIED",
|
|
6356
|
+
/**
|
|
6357
|
+
* Media resolution set to low.
|
|
6358
|
+
*/
|
|
6359
|
+
MEDIA_RESOLUTION_LOW = "MEDIA_RESOLUTION_LOW",
|
|
6360
|
+
/**
|
|
6361
|
+
* Media resolution set to medium.
|
|
6362
|
+
*/
|
|
6363
|
+
MEDIA_RESOLUTION_MEDIUM = "MEDIA_RESOLUTION_MEDIUM",
|
|
6364
|
+
/**
|
|
6365
|
+
* Media resolution set to high.
|
|
6366
|
+
*/
|
|
6367
|
+
MEDIA_RESOLUTION_HIGH = "MEDIA_RESOLUTION_HIGH"
|
|
6368
|
+
}
|
|
6369
|
+
|
|
6284
6370
|
/** Tuning spec for Partner models. This data type is not supported in Gemini API. */
|
|
6285
6371
|
export declare interface PartnerModelTuningSpec {
|
|
6286
6372
|
/** Hyperparameters for tuning. The accepted hyper_parameters and their valid range of values will differ depending on the base model. */
|
|
@@ -7330,6 +7416,24 @@ export declare interface ThinkingConfig {
|
|
|
7330
7416
|
/** Indicates the thinking budget in tokens. 0 is DISABLED. -1 is AUTOMATIC. The default values and allowed ranges are model dependent.
|
|
7331
7417
|
*/
|
|
7332
7418
|
thinkingBudget?: number;
|
|
7419
|
+
/** Optional. The level of thoughts tokens that the model should generate. */
|
|
7420
|
+
thinkingLevel?: ThinkingLevel;
|
|
7421
|
+
}
|
|
7422
|
+
|
|
7423
|
+
/** The level of thoughts tokens that the model should generate. */
|
|
7424
|
+
export declare enum ThinkingLevel {
|
|
7425
|
+
/**
|
|
7426
|
+
* Default value.
|
|
7427
|
+
*/
|
|
7428
|
+
THINKING_LEVEL_UNSPECIFIED = "THINKING_LEVEL_UNSPECIFIED",
|
|
7429
|
+
/**
|
|
7430
|
+
* Low thinking level.
|
|
7431
|
+
*/
|
|
7432
|
+
LOW = "LOW",
|
|
7433
|
+
/**
|
|
7434
|
+
* High thinking level.
|
|
7435
|
+
*/
|
|
7436
|
+
HIGH = "HIGH"
|
|
7333
7437
|
}
|
|
7334
7438
|
|
|
7335
7439
|
export declare class Tokens extends BaseModule {
|
|
@@ -7844,6 +7948,7 @@ declare namespace types {
|
|
|
7844
7948
|
AuthType,
|
|
7845
7949
|
HttpElementLocation,
|
|
7846
7950
|
PhishBlockThreshold,
|
|
7951
|
+
ThinkingLevel,
|
|
7847
7952
|
HarmCategory,
|
|
7848
7953
|
HarmBlockMethod,
|
|
7849
7954
|
HarmBlockThreshold,
|
|
@@ -7859,6 +7964,7 @@ declare namespace types {
|
|
|
7859
7964
|
AdapterSize,
|
|
7860
7965
|
JobState,
|
|
7861
7966
|
TuningTask,
|
|
7967
|
+
PartMediaResolutionLevel,
|
|
7862
7968
|
FeatureSelectionPreference,
|
|
7863
7969
|
Behavior,
|
|
7864
7970
|
DynamicRetrievalConfigMode,
|
|
@@ -7888,10 +7994,12 @@ declare namespace types {
|
|
|
7888
7994
|
Scale,
|
|
7889
7995
|
MusicGenerationMode,
|
|
7890
7996
|
LiveMusicPlaybackControl,
|
|
7891
|
-
|
|
7997
|
+
PartMediaResolution,
|
|
7892
7998
|
CodeExecutionResult,
|
|
7893
7999
|
ExecutableCode,
|
|
7894
8000
|
FileData,
|
|
8001
|
+
PartialArg,
|
|
8002
|
+
FunctionCall,
|
|
7895
8003
|
FunctionResponseBlob,
|
|
7896
8004
|
FunctionResponseFileData,
|
|
7897
8005
|
FunctionResponsePart,
|