@google/genai 1.24.0 → 1.26.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/web/web.d.ts CHANGED
@@ -467,7 +467,6 @@ export declare class Batches extends BaseModule {
467
467
  */
468
468
  list: (params?: types.ListBatchJobsParameters) => Promise<Pager<types.BatchJob>>;
469
469
  private createInlinedGenerateContentRequest;
470
- private createInlinedEmbedContentRequest;
471
470
  private getGcsUri;
472
471
  private getBigqueryUri;
473
472
  private formatDestination;
@@ -647,32 +646,40 @@ export { Blob_2 as Blob }
647
646
 
648
647
  export declare type BlobImageUnion = Blob_2;
649
648
 
650
- /** Output only. Blocked reason. */
649
+ /** Output only. The reason why the prompt was blocked. */
651
650
  export declare enum BlockedReason {
652
651
  /**
653
- * Unspecified blocked reason.
652
+ * The blocked reason is unspecified.
654
653
  */
655
654
  BLOCKED_REASON_UNSPECIFIED = "BLOCKED_REASON_UNSPECIFIED",
656
655
  /**
657
- * Candidates blocked due to safety.
656
+ * The prompt was blocked for safety reasons.
658
657
  */
659
658
  SAFETY = "SAFETY",
660
659
  /**
661
- * Candidates blocked due to other reason.
660
+ * The prompt was blocked for other reasons. For example, it may be due to the prompt's language, or because it contains other harmful content.
662
661
  */
663
662
  OTHER = "OTHER",
664
663
  /**
665
- * Candidates blocked due to the terms which are included from the terminology blocklist.
664
+ * The prompt was blocked because it contains a term from the terminology blocklist.
666
665
  */
667
666
  BLOCKLIST = "BLOCKLIST",
668
667
  /**
669
- * Candidates blocked due to prohibited content.
668
+ * The prompt was blocked because it contains prohibited content.
670
669
  */
671
670
  PROHIBITED_CONTENT = "PROHIBITED_CONTENT",
672
671
  /**
673
- * Candidates blocked due to unsafe image generation content.
672
+ * The prompt was blocked because it contains content that is unsafe for image generation.
674
673
  */
675
- IMAGE_SAFETY = "IMAGE_SAFETY"
674
+ IMAGE_SAFETY = "IMAGE_SAFETY",
675
+ /**
676
+ * The prompt was blocked by Model Armor.
677
+ */
678
+ MODEL_ARMOR = "MODEL_ARMOR",
679
+ /**
680
+ * The prompt was blocked as a jailbreak attempt.
681
+ */
682
+ JAILBREAK = "JAILBREAK"
676
683
  }
677
684
 
678
685
  /** A resource used in LLM queries for users to explicitly specify what to cache. */
@@ -2840,13 +2847,13 @@ export declare class GenerateContentResponse {
2840
2847
  get codeExecutionResult(): string | undefined;
2841
2848
  }
2842
2849
 
2843
- /** Content filter results for a prompt sent in the request. */
2850
+ /** Content filter results for a prompt sent in the request. Note: This is sent only in the first stream chunk and only if no candidates were generated due to content violations. */
2844
2851
  export declare class GenerateContentResponsePromptFeedback {
2845
- /** Output only. Blocked reason. */
2852
+ /** Output only. The reason why the prompt was blocked. */
2846
2853
  blockReason?: BlockedReason;
2847
- /** Output only. A readable block reason message. */
2854
+ /** Output only. A readable message that explains the reason why the prompt was blocked. */
2848
2855
  blockReasonMessage?: string;
2849
- /** Output only. Safety ratings. */
2856
+ /** Output only. A list of safety ratings for the prompt. There is one rating per category. */
2850
2857
  safetyRatings?: SafetyRating[];
2851
2858
  }
2852
2859
 
@@ -3147,11 +3154,13 @@ export declare interface GenerationConfig {
3147
3154
  /** Optional. Controls the randomness of predictions. */
3148
3155
  temperature?: number;
3149
3156
  /** Optional. Config for thinking features. An error will be returned if this field is set for models that don't support thinking. */
3150
- thinkingConfig?: GenerationConfigThinkingConfig;
3157
+ thinkingConfig?: ThinkingConfig;
3151
3158
  /** Optional. If specified, top-k sampling will be used. */
3152
3159
  topK?: number;
3153
3160
  /** Optional. If specified, nucleus sampling will be used. */
3154
3161
  topP?: number;
3162
+ /** Optional. Enables enhanced civic answers. It may not be available for all models. */
3163
+ enableEnhancedCivicAnswers?: boolean;
3155
3164
  }
3156
3165
 
3157
3166
  /** The configuration for routing the request to a specific model. */
@@ -3174,12 +3183,12 @@ export declare interface GenerationConfigRoutingConfigManualRoutingMode {
3174
3183
  modelName?: string;
3175
3184
  }
3176
3185
 
3177
- /** Config for thinking features. */
3178
- export declare interface GenerationConfigThinkingConfig {
3179
- /** Optional. Indicates whether to include thoughts in the response. If true, thoughts are returned only when available. */
3180
- includeThoughts?: boolean;
3181
- /** Optional. Indicates the thinking budget in tokens. */
3182
- thinkingBudget?: number;
3186
+ /**
3187
+ * Config for thinking feature.
3188
+ *
3189
+ * @deprecated This interface will be deprecated. Please use `ThinkingConfig` instead.
3190
+ */
3191
+ export declare interface GenerationConfigThinkingConfig extends ThinkingConfig {
3183
3192
  }
3184
3193
 
3185
3194
  /** Optional parameters. */
@@ -3448,8 +3457,7 @@ export declare interface GoogleSearch {
3448
3457
  If customers set a start time, they must set an end time (and vice versa).
3449
3458
  */
3450
3459
  timeRangeFilter?: Interval;
3451
- /** Optional. List of domains to be excluded from the search results.
3452
- The default limit is 2000 domains. */
3460
+ /** Optional. List of domains to be excluded from the search results. The default limit is 2000 domains. Example: ["amazon.com", "facebook.com"]. */
3453
3461
  excludeDomains?: string[];
3454
3462
  }
3455
3463
 
@@ -3641,22 +3649,22 @@ export declare enum HarmCategory {
3641
3649
  * The harm category is unspecified.
3642
3650
  */
3643
3651
  HARM_CATEGORY_UNSPECIFIED = "HARM_CATEGORY_UNSPECIFIED",
3644
- /**
3645
- * The harm category is hate speech.
3646
- */
3647
- HARM_CATEGORY_HATE_SPEECH = "HARM_CATEGORY_HATE_SPEECH",
3648
- /**
3649
- * The harm category is dangerous content.
3650
- */
3651
- HARM_CATEGORY_DANGEROUS_CONTENT = "HARM_CATEGORY_DANGEROUS_CONTENT",
3652
3652
  /**
3653
3653
  * The harm category is harassment.
3654
3654
  */
3655
3655
  HARM_CATEGORY_HARASSMENT = "HARM_CATEGORY_HARASSMENT",
3656
+ /**
3657
+ * The harm category is hate speech.
3658
+ */
3659
+ HARM_CATEGORY_HATE_SPEECH = "HARM_CATEGORY_HATE_SPEECH",
3656
3660
  /**
3657
3661
  * The harm category is sexually explicit content.
3658
3662
  */
3659
3663
  HARM_CATEGORY_SEXUALLY_EXPLICIT = "HARM_CATEGORY_SEXUALLY_EXPLICIT",
3664
+ /**
3665
+ * The harm category is dangerous content.
3666
+ */
3667
+ HARM_CATEGORY_DANGEROUS_CONTENT = "HARM_CATEGORY_DANGEROUS_CONTENT",
3660
3668
  /**
3661
3669
  * Deprecated: Election filter is not longer supported. The harm category is civic integrity.
3662
3670
  */
@@ -3676,7 +3684,11 @@ export declare enum HarmCategory {
3676
3684
  /**
3677
3685
  * The harm category is image sexually explicit content.
3678
3686
  */
3679
- HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT = "HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT"
3687
+ HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT = "HARM_CATEGORY_IMAGE_SEXUALLY_EXPLICIT",
3688
+ /**
3689
+ * The harm category is for jailbreak prompts.
3690
+ */
3691
+ HARM_CATEGORY_JAILBREAK = "HARM_CATEGORY_JAILBREAK"
3680
3692
  }
3681
3693
 
3682
3694
  /** Output only. Harm probability levels in the content. */
@@ -4082,9 +4094,9 @@ export declare interface ListFilesParameters {
4082
4094
  export declare class ListFilesResponse {
4083
4095
  /** Used to retain the full HTTP response. */
4084
4096
  sdkHttpResponse?: HttpResponse;
4085
- /** A token to retrieve next page of results. */
4097
+ /** A token that can be sent as a `page_token` into a subsequent `ListFiles` call. */
4086
4098
  nextPageToken?: string;
4087
- /** The list of files. */
4099
+ /** The list of `File`s. */
4088
4100
  files?: File_2[];
4089
4101
  }
4090
4102
 
@@ -6911,10 +6923,18 @@ export declare interface Transcription {
6911
6923
  finished?: boolean;
6912
6924
  }
6913
6925
 
6926
+ /** TunedModel for the Tuned Model of a Tuning Job. */
6914
6927
  export declare interface TunedModel {
6915
- /** Output only. The resource name of the TunedModel. Format: `projects/{project}/locations/{location}/models/{model}@{version_id}` When tuning from a base model, the version_id will be 1. For continuous tuning, the version id will be incremented by 1 from the last version id in the parent model. E.g., `projects/{project}/locations/{location}/models/{model}@{last_version_id + 1}` */
6928
+ /** Output only. The resource name of the TunedModel.
6929
+ Format: `projects/{project}/locations/{location}/models/{model}@{version_id}`
6930
+ When tuning from a base model, the version_id will be 1.
6931
+ For continuous tuning, the version id will be incremented by 1 from the
6932
+ last version id in the parent model. E.g., `projects/{project}/locations/{location}/models/{model}@{last_version_id + 1}`
6933
+ */
6916
6934
  model?: string;
6917
- /** Output only. A resource name of an Endpoint. Format: `projects/{project}/locations/{location}/endpoints/{endpoint}`. */
6935
+ /** Output only. A resource name of an Endpoint.
6936
+ Format: `projects/{project}/locations/{location}/endpoints/{endpoint}`.
6937
+ */
6918
6938
  endpoint?: string;
6919
6939
  /** The checkpoints associated with this TunedModel.
6920
6940
  This field is only populated for tuning jobs that enable intermediate
@@ -6969,11 +6989,12 @@ export declare interface TuningDataStats {
6969
6989
  supervisedTuningDataStats?: SupervisedTuningDataStats;
6970
6990
  }
6971
6991
 
6992
+ /** A single example for tuning. */
6972
6993
  export declare interface TuningExample {
6973
- /** Text model input. */
6974
- textInput?: string;
6975
- /** The expected model output. */
6994
+ /** Required. The expected model output. */
6976
6995
  output?: string;
6996
+ /** Optional. Text model input. */
6997
+ textInput?: string;
6977
6998
  }
6978
6999
 
6979
7000
  /** A tuning job. */
@@ -7219,6 +7240,7 @@ declare namespace types {
7219
7240
  createModelContent,
7220
7241
  Outcome,
7221
7242
  Language,
7243
+ FunctionResponseScheduling,
7222
7244
  Type,
7223
7245
  HarmCategory,
7224
7246
  HarmBlockMethod,
@@ -7262,7 +7284,6 @@ declare namespace types {
7262
7284
  EndSensitivity,
7263
7285
  ActivityHandling,
7264
7286
  TurnCoverage,
7265
- FunctionResponseScheduling,
7266
7287
  Scale,
7267
7288
  MusicGenerationMode,
7268
7289
  LiveMusicPlaybackControl,
@@ -7410,7 +7431,6 @@ declare namespace types {
7410
7431
  DeleteModelConfig,
7411
7432
  DeleteModelParameters,
7412
7433
  DeleteModelResponse,
7413
- GenerationConfigThinkingConfig,
7414
7434
  GenerationConfig,
7415
7435
  CountTokensConfig,
7416
7436
  CountTokensParameters,
@@ -7546,6 +7566,7 @@ declare namespace types {
7546
7566
  LiveServerSessionResumptionUpdate,
7547
7567
  LiveServerMessage,
7548
7568
  OperationFromAPIResponseParameters,
7569
+ GenerationConfigThinkingConfig,
7549
7570
  AutomaticActivityDetection,
7550
7571
  RealtimeInputConfig,
7551
7572
  SessionResumptionConfig,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google/genai",
3
- "version": "1.24.0",
3
+ "version": "1.26.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/node/index.mjs",
@@ -82,9 +82,11 @@
82
82
  "devDependencies": {
83
83
  "@eslint/js": "9.20.0",
84
84
  "@microsoft/api-extractor": "^7.52.9",
85
+ "@modelcontextprotocol/sdk": "^1.20.1",
85
86
  "@rollup/plugin-json": "^6.1.0",
86
87
  "@types/jasmine": "^5.1.2",
87
88
  "@types/node": "^20.9.0",
89
+ "@types/node-fetch": "^2.6.13",
88
90
  "@types/unist": "^3.0.3",
89
91
  "@types/ws": "^8.5.14",
90
92
  "c8": "^10.1.3",
@@ -92,6 +94,7 @@
92
94
  "gts": "^5.2.0",
93
95
  "jasmine": "^5.5.0",
94
96
  "jasmine-reporters": "^2.4.0",
97
+ "node-fetch": "^3.3.2",
95
98
  "npm-run-all": "^4.1.5",
96
99
  "nyc": "^17.1.0",
97
100
  "prettier": "3.3.3",
@@ -104,15 +107,17 @@
104
107
  "typedoc": "^0.27.0",
105
108
  "typescript": "~5.2.0",
106
109
  "typescript-eslint": "8.24.1",
110
+ "undici": "^7.16.0",
111
+ "undici-types": "^7.16.0",
107
112
  "zod": "^3.22.4",
108
113
  "zod-to-json-schema": "^3.22.4"
109
114
  },
110
115
  "dependencies": {
111
- "google-auth-library": "^9.14.2",
116
+ "google-auth-library": "^10.3.0",
112
117
  "ws": "^8.18.0"
113
118
  },
114
119
  "peerDependencies": {
115
- "@modelcontextprotocol/sdk": "^1.11.4"
120
+ "@modelcontextprotocol/sdk": "^1.20.1"
116
121
  },
117
122
  "peerDependenciesMeta": {
118
123
  "@modelcontextprotocol/sdk": {