@google/genai 1.41.0 → 1.42.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 +66 -11
- package/dist/index.cjs +213 -34
- package/dist/index.mjs +214 -35
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +213 -34
- package/dist/node/index.mjs +214 -35
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +66 -11
- package/dist/tokenizer/node.cjs +12 -0
- package/dist/tokenizer/node.mjs +12 -0
- package/dist/tokenizer/node.mjs.map +1 -1
- package/dist/web/index.mjs +214 -35
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +66 -11
- package/package.json +2 -2
package/dist/web/web.d.ts
CHANGED
|
@@ -1730,12 +1730,12 @@ export declare interface Content {
|
|
|
1730
1730
|
declare type Content_2 = TextContent | ImageContent | AudioContent | DocumentContent | VideoContent | ThoughtContent | FunctionCallContent | FunctionResultContent | CodeExecutionCallContent | CodeExecutionResultContent | URLContextCallContent | URLContextResultContent | GoogleSearchCallContent | GoogleSearchResultContent | MCPServerToolCallContent | MCPServerToolResultContent | FileSearchCallContent | FileSearchResultContent;
|
|
1731
1731
|
|
|
1732
1732
|
declare interface ContentDelta {
|
|
1733
|
+
event_type: 'content.delta';
|
|
1733
1734
|
delta?: ContentDelta.TextDelta | ContentDelta.ImageDelta | ContentDelta.AudioDelta | ContentDelta.DocumentDelta | ContentDelta.VideoDelta | ContentDelta.ThoughtSummaryDelta | ContentDelta.ThoughtSignatureDelta | ContentDelta.FunctionCallDelta | ContentDelta.FunctionResultDelta | ContentDelta.CodeExecutionCallDelta | ContentDelta.CodeExecutionResultDelta | ContentDelta.URLContextCallDelta | ContentDelta.URLContextResultDelta | ContentDelta.GoogleSearchCallDelta | ContentDelta.GoogleSearchResultDelta | ContentDelta.MCPServerToolCallDelta | ContentDelta.MCPServerToolResultDelta | ContentDelta.FileSearchCallDelta | ContentDelta.FileSearchResultDelta;
|
|
1734
1735
|
/**
|
|
1735
1736
|
* The event_id token to be used to resume the interaction stream, from this event.
|
|
1736
1737
|
*/
|
|
1737
1738
|
event_id?: string;
|
|
1738
|
-
event_type?: 'content.delta';
|
|
1739
1739
|
index?: number;
|
|
1740
1740
|
}
|
|
1741
1741
|
|
|
@@ -2001,6 +2001,7 @@ export declare class ContentReferenceImage {
|
|
|
2001
2001
|
}
|
|
2002
2002
|
|
|
2003
2003
|
declare interface ContentStart {
|
|
2004
|
+
event_type: 'content.start';
|
|
2004
2005
|
/**
|
|
2005
2006
|
* The content of the response.
|
|
2006
2007
|
*/
|
|
@@ -2009,16 +2010,15 @@ declare interface ContentStart {
|
|
|
2009
2010
|
* The event_id token to be used to resume the interaction stream, from this event.
|
|
2010
2011
|
*/
|
|
2011
2012
|
event_id?: string;
|
|
2012
|
-
event_type?: 'content.start';
|
|
2013
2013
|
index?: number;
|
|
2014
2014
|
}
|
|
2015
2015
|
|
|
2016
2016
|
declare interface ContentStop {
|
|
2017
|
+
event_type: 'content.stop';
|
|
2017
2018
|
/**
|
|
2018
2019
|
* The event_id token to be used to resume the interaction stream, from this event.
|
|
2019
2020
|
*/
|
|
2020
2021
|
event_id?: string;
|
|
2021
|
-
event_type?: 'content.stop';
|
|
2022
2022
|
index?: number;
|
|
2023
2023
|
}
|
|
2024
2024
|
|
|
@@ -2582,11 +2582,11 @@ export declare interface DatasetStats {
|
|
|
2582
2582
|
* Configuration for the Deep Research agent.
|
|
2583
2583
|
*/
|
|
2584
2584
|
declare interface DeepResearchAgentConfig {
|
|
2585
|
+
type: 'deep-research';
|
|
2585
2586
|
/**
|
|
2586
2587
|
* Whether to include thought summaries in the response.
|
|
2587
2588
|
*/
|
|
2588
2589
|
thinking_summaries?: 'auto' | 'none';
|
|
2589
|
-
type?: 'deep-research';
|
|
2590
2590
|
}
|
|
2591
2591
|
|
|
2592
2592
|
/** Optional parameters for models.get method. */
|
|
@@ -2922,7 +2922,7 @@ export declare interface DownloadFileParameters {
|
|
|
2922
2922
|
* Configuration for dynamic agents.
|
|
2923
2923
|
*/
|
|
2924
2924
|
declare interface DynamicAgentConfig {
|
|
2925
|
-
type
|
|
2925
|
+
type: 'dynamic';
|
|
2926
2926
|
[k: string]: unknown;
|
|
2927
2927
|
}
|
|
2928
2928
|
|
|
@@ -3098,6 +3098,25 @@ export declare interface EmbedContentParameters {
|
|
|
3098
3098
|
config?: EmbedContentConfig;
|
|
3099
3099
|
}
|
|
3100
3100
|
|
|
3101
|
+
/** Parameters for the _embed_content method. */
|
|
3102
|
+
export declare interface EmbedContentParametersPrivate {
|
|
3103
|
+
/** ID of the model to use. For a list of models, see `Google models
|
|
3104
|
+
<https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models>`_. */
|
|
3105
|
+
model: string;
|
|
3106
|
+
/** The content to embed. Only the `parts.text` fields will be counted.
|
|
3107
|
+
*/
|
|
3108
|
+
contents?: ContentListUnion;
|
|
3109
|
+
/** The single content to embed. Only the `parts.text` fields will be counted.
|
|
3110
|
+
*/
|
|
3111
|
+
content?: ContentUnion;
|
|
3112
|
+
/** The Vertex embedding API to use.
|
|
3113
|
+
*/
|
|
3114
|
+
embeddingApiType?: EmbeddingApiType;
|
|
3115
|
+
/** Configuration that contains optional parameters.
|
|
3116
|
+
*/
|
|
3117
|
+
config?: EmbedContentConfig;
|
|
3118
|
+
}
|
|
3119
|
+
|
|
3101
3120
|
/** Response for the embed_content method. */
|
|
3102
3121
|
export declare class EmbedContentResponse {
|
|
3103
3122
|
/** Used to retain the full HTTP response. */
|
|
@@ -3111,6 +3130,18 @@ export declare class EmbedContentResponse {
|
|
|
3111
3130
|
metadata?: EmbedContentMetadata;
|
|
3112
3131
|
}
|
|
3113
3132
|
|
|
3133
|
+
/** Enum representing the Vertex embedding API to use. */
|
|
3134
|
+
export declare enum EmbeddingApiType {
|
|
3135
|
+
/**
|
|
3136
|
+
* predict API endpoint (default)
|
|
3137
|
+
*/
|
|
3138
|
+
PREDICT = "PREDICT",
|
|
3139
|
+
/**
|
|
3140
|
+
* embedContent API Endpoint
|
|
3141
|
+
*/
|
|
3142
|
+
EMBED_CONTENT = "EMBED_CONTENT"
|
|
3143
|
+
}
|
|
3144
|
+
|
|
3114
3145
|
export declare interface EmbeddingsBatchJobSource {
|
|
3115
3146
|
/** The Gemini Developer API's file resource name of the input data
|
|
3116
3147
|
(e.g. "files/12345").
|
|
@@ -3180,6 +3211,7 @@ export declare enum Environment {
|
|
|
3180
3211
|
}
|
|
3181
3212
|
|
|
3182
3213
|
declare interface ErrorEvent_2 {
|
|
3214
|
+
event_type: 'error';
|
|
3183
3215
|
/**
|
|
3184
3216
|
* Error message from an interaction.
|
|
3185
3217
|
*/
|
|
@@ -3188,7 +3220,6 @@ declare interface ErrorEvent_2 {
|
|
|
3188
3220
|
* The event_id token to be used to resume the interaction stream, from this event.
|
|
3189
3221
|
*/
|
|
3190
3222
|
event_id?: string;
|
|
3191
|
-
event_type?: 'error';
|
|
3192
3223
|
}
|
|
3193
3224
|
|
|
3194
3225
|
declare namespace ErrorEvent_2 {
|
|
@@ -5766,11 +5797,11 @@ declare interface InteractionCancelParams {
|
|
|
5766
5797
|
}
|
|
5767
5798
|
|
|
5768
5799
|
declare interface InteractionCompleteEvent {
|
|
5800
|
+
event_type: 'interaction.complete';
|
|
5769
5801
|
/**
|
|
5770
5802
|
* The event_id token to be used to resume the interaction stream, from this event.
|
|
5771
5803
|
*/
|
|
5772
5804
|
event_id?: string;
|
|
5773
|
-
event_type?: 'interaction.complete';
|
|
5774
5805
|
/**
|
|
5775
5806
|
* The Interaction resource.
|
|
5776
5807
|
*/
|
|
@@ -5912,11 +5943,11 @@ declare namespace InteractionsAPI {
|
|
|
5912
5943
|
declare type InteractionSSEEvent = InteractionStartEvent | InteractionCompleteEvent | InteractionStatusUpdate | ContentStart | ContentDelta | ContentStop | ErrorEvent_2;
|
|
5913
5944
|
|
|
5914
5945
|
declare interface InteractionStartEvent {
|
|
5946
|
+
event_type: 'interaction.start';
|
|
5915
5947
|
/**
|
|
5916
5948
|
* The event_id token to be used to resume the interaction stream, from this event.
|
|
5917
5949
|
*/
|
|
5918
5950
|
event_id?: string;
|
|
5919
|
-
event_type?: 'interaction.start';
|
|
5920
5951
|
/**
|
|
5921
5952
|
* The Interaction resource.
|
|
5922
5953
|
*/
|
|
@@ -5924,11 +5955,11 @@ declare interface InteractionStartEvent {
|
|
|
5924
5955
|
}
|
|
5925
5956
|
|
|
5926
5957
|
declare interface InteractionStatusUpdate {
|
|
5958
|
+
event_type: 'interaction.status_update';
|
|
5927
5959
|
/**
|
|
5928
5960
|
* The event_id token to be used to resume the interaction stream, from this event.
|
|
5929
5961
|
*/
|
|
5930
5962
|
event_id?: string;
|
|
5931
|
-
event_type?: 'interaction.status_update';
|
|
5932
5963
|
interaction_id?: string;
|
|
5933
5964
|
status?: 'in_progress' | 'requires_action' | 'completed' | 'failed' | 'cancelled' | 'incomplete';
|
|
5934
5965
|
}
|
|
@@ -7321,6 +7352,28 @@ export declare interface ModelArmorConfig {
|
|
|
7321
7352
|
export declare class Models extends BaseModule {
|
|
7322
7353
|
private readonly apiClient;
|
|
7323
7354
|
constructor(apiClient: ApiClient);
|
|
7355
|
+
/**
|
|
7356
|
+
* Calculates embeddings for the given contents.
|
|
7357
|
+
*
|
|
7358
|
+
* @param params - The parameters for embedding contents.
|
|
7359
|
+
* @return The response from the API.
|
|
7360
|
+
*
|
|
7361
|
+
* @example
|
|
7362
|
+
* ```ts
|
|
7363
|
+
* const response = await ai.models.embedContent({
|
|
7364
|
+
* model: 'text-embedding-004',
|
|
7365
|
+
* contents: [
|
|
7366
|
+
* 'What is your name?',
|
|
7367
|
+
* 'What is your favorite color?',
|
|
7368
|
+
* ],
|
|
7369
|
+
* config: {
|
|
7370
|
+
* outputDimensionality: 64,
|
|
7371
|
+
* },
|
|
7372
|
+
* });
|
|
7373
|
+
* console.log(response);
|
|
7374
|
+
* ```
|
|
7375
|
+
*/
|
|
7376
|
+
embedContent: (params: types.EmbedContentParameters) => Promise<types.EmbedContentResponse>;
|
|
7324
7377
|
/**
|
|
7325
7378
|
* Makes an API request to generate content with a given model.
|
|
7326
7379
|
*
|
|
@@ -7531,7 +7584,7 @@ export declare class Models extends BaseModule {
|
|
|
7531
7584
|
* console.log(response);
|
|
7532
7585
|
* ```
|
|
7533
7586
|
*/
|
|
7534
|
-
|
|
7587
|
+
private embedContentInternal;
|
|
7535
7588
|
/**
|
|
7536
7589
|
* Private method for generating images.
|
|
7537
7590
|
*/
|
|
@@ -10024,6 +10077,7 @@ declare namespace types {
|
|
|
10024
10077
|
ResourceScope,
|
|
10025
10078
|
FeatureSelectionPreference,
|
|
10026
10079
|
Environment,
|
|
10080
|
+
EmbeddingApiType,
|
|
10027
10081
|
SafetyFilterLevel,
|
|
10028
10082
|
PersonGeneration,
|
|
10029
10083
|
ImagePromptLanguage,
|
|
@@ -10156,7 +10210,7 @@ declare namespace types {
|
|
|
10156
10210
|
ReferenceImage,
|
|
10157
10211
|
EditImageParameters,
|
|
10158
10212
|
EmbedContentConfig,
|
|
10159
|
-
|
|
10213
|
+
EmbedContentParametersPrivate,
|
|
10160
10214
|
ContentEmbeddingStatistics,
|
|
10161
10215
|
ContentEmbedding,
|
|
10162
10216
|
EmbedContentMetadata,
|
|
@@ -10424,6 +10478,7 @@ declare namespace types {
|
|
|
10424
10478
|
CountTokensResult,
|
|
10425
10479
|
ComputeTokensResult,
|
|
10426
10480
|
CreateTuningJobParameters,
|
|
10481
|
+
EmbedContentParameters,
|
|
10427
10482
|
UploadToFileSearchStoreResponse,
|
|
10428
10483
|
UploadToFileSearchStoreOperation,
|
|
10429
10484
|
BlobImageUnion,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@google/genai",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.42.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/node/index.mjs",
|
|
@@ -142,7 +142,7 @@
|
|
|
142
142
|
},
|
|
143
143
|
"dependencies": {
|
|
144
144
|
"google-auth-library": "^10.3.0",
|
|
145
|
-
"p-retry": "^
|
|
145
|
+
"p-retry": "^4.6.2",
|
|
146
146
|
"protobufjs": "^7.5.4",
|
|
147
147
|
"ws": "^8.18.0"
|
|
148
148
|
},
|