@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.
@@ -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?: 'dynamic';
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 {
@@ -5773,11 +5804,11 @@ declare interface InteractionCancelParams {
5773
5804
  }
5774
5805
 
5775
5806
  declare interface InteractionCompleteEvent {
5807
+ event_type: 'interaction.complete';
5776
5808
  /**
5777
5809
  * The event_id token to be used to resume the interaction stream, from this event.
5778
5810
  */
5779
5811
  event_id?: string;
5780
- event_type?: 'interaction.complete';
5781
5812
  /**
5782
5813
  * The Interaction resource.
5783
5814
  */
@@ -5919,11 +5950,11 @@ declare namespace InteractionsAPI {
5919
5950
  declare type InteractionSSEEvent = InteractionStartEvent | InteractionCompleteEvent | InteractionStatusUpdate | ContentStart | ContentDelta | ContentStop | ErrorEvent_2;
5920
5951
 
5921
5952
  declare interface InteractionStartEvent {
5953
+ event_type: 'interaction.start';
5922
5954
  /**
5923
5955
  * The event_id token to be used to resume the interaction stream, from this event.
5924
5956
  */
5925
5957
  event_id?: string;
5926
- event_type?: 'interaction.start';
5927
5958
  /**
5928
5959
  * The Interaction resource.
5929
5960
  */
@@ -5931,11 +5962,11 @@ declare interface InteractionStartEvent {
5931
5962
  }
5932
5963
 
5933
5964
  declare interface InteractionStatusUpdate {
5965
+ event_type: 'interaction.status_update';
5934
5966
  /**
5935
5967
  * The event_id token to be used to resume the interaction stream, from this event.
5936
5968
  */
5937
5969
  event_id?: string;
5938
- event_type?: 'interaction.status_update';
5939
5970
  interaction_id?: string;
5940
5971
  status?: 'in_progress' | 'requires_action' | 'completed' | 'failed' | 'cancelled' | 'incomplete';
5941
5972
  }
@@ -7328,6 +7359,28 @@ export declare interface ModelArmorConfig {
7328
7359
  export declare class Models extends BaseModule {
7329
7360
  private readonly apiClient;
7330
7361
  constructor(apiClient: ApiClient);
7362
+ /**
7363
+ * Calculates embeddings for the given contents.
7364
+ *
7365
+ * @param params - The parameters for embedding contents.
7366
+ * @return The response from the API.
7367
+ *
7368
+ * @example
7369
+ * ```ts
7370
+ * const response = await ai.models.embedContent({
7371
+ * model: 'text-embedding-004',
7372
+ * contents: [
7373
+ * 'What is your name?',
7374
+ * 'What is your favorite color?',
7375
+ * ],
7376
+ * config: {
7377
+ * outputDimensionality: 64,
7378
+ * },
7379
+ * });
7380
+ * console.log(response);
7381
+ * ```
7382
+ */
7383
+ embedContent: (params: types.EmbedContentParameters) => Promise<types.EmbedContentResponse>;
7331
7384
  /**
7332
7385
  * Makes an API request to generate content with a given model.
7333
7386
  *
@@ -7538,7 +7591,7 @@ export declare class Models extends BaseModule {
7538
7591
  * console.log(response);
7539
7592
  * ```
7540
7593
  */
7541
- embedContent(params: types.EmbedContentParameters): Promise<types.EmbedContentResponse>;
7594
+ private embedContentInternal;
7542
7595
  /**
7543
7596
  * Private method for generating images.
7544
7597
  */
@@ -10031,6 +10084,7 @@ declare namespace types {
10031
10084
  ResourceScope,
10032
10085
  FeatureSelectionPreference,
10033
10086
  Environment,
10087
+ EmbeddingApiType,
10034
10088
  SafetyFilterLevel,
10035
10089
  PersonGeneration,
10036
10090
  ImagePromptLanguage,
@@ -10163,7 +10217,7 @@ declare namespace types {
10163
10217
  ReferenceImage,
10164
10218
  EditImageParameters,
10165
10219
  EmbedContentConfig,
10166
- EmbedContentParameters,
10220
+ EmbedContentParametersPrivate,
10167
10221
  ContentEmbeddingStatistics,
10168
10222
  ContentEmbedding,
10169
10223
  EmbedContentMetadata,
@@ -10431,6 +10485,7 @@ declare namespace types {
10431
10485
  CountTokensResult,
10432
10486
  ComputeTokensResult,
10433
10487
  CreateTuningJobParameters,
10488
+ EmbedContentParameters,
10434
10489
  UploadToFileSearchStoreResponse,
10435
10490
  UploadToFileSearchStoreOperation,
10436
10491
  BlobImageUnion,
@@ -805,6 +805,18 @@ var Environment;
805
805
  */
806
806
  Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
807
807
  })(Environment || (Environment = {}));
808
+ /** Enum representing the Vertex embedding API to use. */
809
+ var EmbeddingApiType;
810
+ (function (EmbeddingApiType) {
811
+ /**
812
+ * predict API endpoint (default)
813
+ */
814
+ EmbeddingApiType["PREDICT"] = "PREDICT";
815
+ /**
816
+ * embedContent API Endpoint
817
+ */
818
+ EmbeddingApiType["EMBED_CONTENT"] = "EMBED_CONTENT";
819
+ })(EmbeddingApiType || (EmbeddingApiType = {}));
808
820
  /** Enum that controls the safety filter level for objectionable content. */
809
821
  var SafetyFilterLevel;
810
822
  (function (SafetyFilterLevel) {
@@ -781,6 +781,18 @@ var Environment;
781
781
  */
782
782
  Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
783
783
  })(Environment || (Environment = {}));
784
+ /** Enum representing the Vertex embedding API to use. */
785
+ var EmbeddingApiType;
786
+ (function (EmbeddingApiType) {
787
+ /**
788
+ * predict API endpoint (default)
789
+ */
790
+ EmbeddingApiType["PREDICT"] = "PREDICT";
791
+ /**
792
+ * embedContent API Endpoint
793
+ */
794
+ EmbeddingApiType["EMBED_CONTENT"] = "EMBED_CONTENT";
795
+ })(EmbeddingApiType || (EmbeddingApiType = {}));
784
796
  /** Enum that controls the safety filter level for objectionable content. */
785
797
  var SafetyFilterLevel;
786
798
  (function (SafetyFilterLevel) {