@google/genai 1.25.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
@@ -646,32 +646,40 @@ export { Blob_2 as Blob }
646
646
 
647
647
  export declare type BlobImageUnion = Blob_2;
648
648
 
649
- /** Output only. Blocked reason. */
649
+ /** Output only. The reason why the prompt was blocked. */
650
650
  export declare enum BlockedReason {
651
651
  /**
652
- * Unspecified blocked reason.
652
+ * The blocked reason is unspecified.
653
653
  */
654
654
  BLOCKED_REASON_UNSPECIFIED = "BLOCKED_REASON_UNSPECIFIED",
655
655
  /**
656
- * Candidates blocked due to safety.
656
+ * The prompt was blocked for safety reasons.
657
657
  */
658
658
  SAFETY = "SAFETY",
659
659
  /**
660
- * 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.
661
661
  */
662
662
  OTHER = "OTHER",
663
663
  /**
664
- * 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.
665
665
  */
666
666
  BLOCKLIST = "BLOCKLIST",
667
667
  /**
668
- * Candidates blocked due to prohibited content.
668
+ * The prompt was blocked because it contains prohibited content.
669
669
  */
670
670
  PROHIBITED_CONTENT = "PROHIBITED_CONTENT",
671
671
  /**
672
- * Candidates blocked due to unsafe image generation content.
672
+ * The prompt was blocked because it contains content that is unsafe for image generation.
673
673
  */
674
- 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"
675
683
  }
676
684
 
677
685
  /** A resource used in LLM queries for users to explicitly specify what to cache. */
@@ -2839,13 +2847,13 @@ export declare class GenerateContentResponse {
2839
2847
  get codeExecutionResult(): string | undefined;
2840
2848
  }
2841
2849
 
2842
- /** 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. */
2843
2851
  export declare class GenerateContentResponsePromptFeedback {
2844
- /** Output only. Blocked reason. */
2852
+ /** Output only. The reason why the prompt was blocked. */
2845
2853
  blockReason?: BlockedReason;
2846
- /** Output only. A readable block reason message. */
2854
+ /** Output only. A readable message that explains the reason why the prompt was blocked. */
2847
2855
  blockReasonMessage?: string;
2848
- /** Output only. Safety ratings. */
2856
+ /** Output only. A list of safety ratings for the prompt. There is one rating per category. */
2849
2857
  safetyRatings?: SafetyRating[];
2850
2858
  }
2851
2859
 
@@ -3146,11 +3154,13 @@ export declare interface GenerationConfig {
3146
3154
  /** Optional. Controls the randomness of predictions. */
3147
3155
  temperature?: number;
3148
3156
  /** Optional. Config for thinking features. An error will be returned if this field is set for models that don't support thinking. */
3149
- thinkingConfig?: GenerationConfigThinkingConfig;
3157
+ thinkingConfig?: ThinkingConfig;
3150
3158
  /** Optional. If specified, top-k sampling will be used. */
3151
3159
  topK?: number;
3152
3160
  /** Optional. If specified, nucleus sampling will be used. */
3153
3161
  topP?: number;
3162
+ /** Optional. Enables enhanced civic answers. It may not be available for all models. */
3163
+ enableEnhancedCivicAnswers?: boolean;
3154
3164
  }
3155
3165
 
3156
3166
  /** The configuration for routing the request to a specific model. */
@@ -3173,12 +3183,12 @@ export declare interface GenerationConfigRoutingConfigManualRoutingMode {
3173
3183
  modelName?: string;
3174
3184
  }
3175
3185
 
3176
- /** Config for thinking features. */
3177
- export declare interface GenerationConfigThinkingConfig {
3178
- /** Optional. Indicates whether to include thoughts in the response. If true, thoughts are returned only when available. */
3179
- includeThoughts?: boolean;
3180
- /** Optional. Indicates the thinking budget in tokens. */
3181
- 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 {
3182
3192
  }
3183
3193
 
3184
3194
  /** Optional parameters. */
@@ -3447,8 +3457,7 @@ export declare interface GoogleSearch {
3447
3457
  If customers set a start time, they must set an end time (and vice versa).
3448
3458
  */
3449
3459
  timeRangeFilter?: Interval;
3450
- /** Optional. List of domains to be excluded from the search results.
3451
- 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"]. */
3452
3461
  excludeDomains?: string[];
3453
3462
  }
3454
3463
 
@@ -3640,22 +3649,22 @@ export declare enum HarmCategory {
3640
3649
  * The harm category is unspecified.
3641
3650
  */
3642
3651
  HARM_CATEGORY_UNSPECIFIED = "HARM_CATEGORY_UNSPECIFIED",
3643
- /**
3644
- * The harm category is hate speech.
3645
- */
3646
- HARM_CATEGORY_HATE_SPEECH = "HARM_CATEGORY_HATE_SPEECH",
3647
- /**
3648
- * The harm category is dangerous content.
3649
- */
3650
- HARM_CATEGORY_DANGEROUS_CONTENT = "HARM_CATEGORY_DANGEROUS_CONTENT",
3651
3652
  /**
3652
3653
  * The harm category is harassment.
3653
3654
  */
3654
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",
3655
3660
  /**
3656
3661
  * The harm category is sexually explicit content.
3657
3662
  */
3658
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",
3659
3668
  /**
3660
3669
  * Deprecated: Election filter is not longer supported. The harm category is civic integrity.
3661
3670
  */
@@ -3675,7 +3684,11 @@ export declare enum HarmCategory {
3675
3684
  /**
3676
3685
  * The harm category is image sexually explicit content.
3677
3686
  */
3678
- 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"
3679
3692
  }
3680
3693
 
3681
3694
  /** Output only. Harm probability levels in the content. */
@@ -4081,9 +4094,9 @@ export declare interface ListFilesParameters {
4081
4094
  export declare class ListFilesResponse {
4082
4095
  /** Used to retain the full HTTP response. */
4083
4096
  sdkHttpResponse?: HttpResponse;
4084
- /** A token to retrieve next page of results. */
4097
+ /** A token that can be sent as a `page_token` into a subsequent `ListFiles` call. */
4085
4098
  nextPageToken?: string;
4086
- /** The list of files. */
4099
+ /** The list of `File`s. */
4087
4100
  files?: File_2[];
4088
4101
  }
4089
4102
 
@@ -6910,10 +6923,18 @@ export declare interface Transcription {
6910
6923
  finished?: boolean;
6911
6924
  }
6912
6925
 
6926
+ /** TunedModel for the Tuned Model of a Tuning Job. */
6913
6927
  export declare interface TunedModel {
6914
- /** 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
+ */
6915
6934
  model?: string;
6916
- /** 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
+ */
6917
6938
  endpoint?: string;
6918
6939
  /** The checkpoints associated with this TunedModel.
6919
6940
  This field is only populated for tuning jobs that enable intermediate
@@ -6968,11 +6989,12 @@ export declare interface TuningDataStats {
6968
6989
  supervisedTuningDataStats?: SupervisedTuningDataStats;
6969
6990
  }
6970
6991
 
6992
+ /** A single example for tuning. */
6971
6993
  export declare interface TuningExample {
6972
- /** Text model input. */
6973
- textInput?: string;
6974
- /** The expected model output. */
6994
+ /** Required. The expected model output. */
6975
6995
  output?: string;
6996
+ /** Optional. Text model input. */
6997
+ textInput?: string;
6976
6998
  }
6977
6999
 
6978
7000
  /** A tuning job. */
@@ -7218,6 +7240,7 @@ declare namespace types {
7218
7240
  createModelContent,
7219
7241
  Outcome,
7220
7242
  Language,
7243
+ FunctionResponseScheduling,
7221
7244
  Type,
7222
7245
  HarmCategory,
7223
7246
  HarmBlockMethod,
@@ -7261,7 +7284,6 @@ declare namespace types {
7261
7284
  EndSensitivity,
7262
7285
  ActivityHandling,
7263
7286
  TurnCoverage,
7264
- FunctionResponseScheduling,
7265
7287
  Scale,
7266
7288
  MusicGenerationMode,
7267
7289
  LiveMusicPlaybackControl,
@@ -7409,7 +7431,6 @@ declare namespace types {
7409
7431
  DeleteModelConfig,
7410
7432
  DeleteModelParameters,
7411
7433
  DeleteModelResponse,
7412
- GenerationConfigThinkingConfig,
7413
7434
  GenerationConfig,
7414
7435
  CountTokensConfig,
7415
7436
  CountTokensParameters,
@@ -7545,6 +7566,7 @@ declare namespace types {
7545
7566
  LiveServerSessionResumptionUpdate,
7546
7567
  LiveServerMessage,
7547
7568
  OperationFromAPIResponseParameters,
7569
+ GenerationConfigThinkingConfig,
7548
7570
  AutomaticActivityDetection,
7549
7571
  RealtimeInputConfig,
7550
7572
  SessionResumptionConfig,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google/genai",
3
- "version": "1.25.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": {