@google/genai 1.30.0 → 1.32.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
@@ -436,6 +436,21 @@ export declare interface BaseUrlParameters {
436
436
  export declare class Batches extends BaseModule {
437
437
  private readonly apiClient;
438
438
  constructor(apiClient: ApiClient);
439
+ /**
440
+ * Lists batch jobs.
441
+ *
442
+ * @param params - The parameters for the list request.
443
+ * @return - A pager of batch jobs.
444
+ *
445
+ * @example
446
+ * ```ts
447
+ * const batchJobs = await ai.batches.list({config: {'pageSize': 2}});
448
+ * for await (const batchJob of batchJobs) {
449
+ * console.log(batchJob);
450
+ * }
451
+ * ```
452
+ */
453
+ list: (params?: types.ListBatchJobsParameters) => Promise<Pager<types.BatchJob>>;
439
454
  /**
440
455
  * Create batch job.
441
456
  *
@@ -471,21 +486,6 @@ export declare class Batches extends BaseModule {
471
486
  * ```
472
487
  */
473
488
  createEmbeddings: (params: types.CreateEmbeddingsBatchJobParameters) => Promise<types.BatchJob>;
474
- /**
475
- * Lists batch job configurations.
476
- *
477
- * @param params - The parameters for the list request.
478
- * @return The paginated results of the list of batch jobs.
479
- *
480
- * @example
481
- * ```ts
482
- * const batchJobs = await ai.batches.list({config: {'pageSize': 2}});
483
- * for await (const batchJob of batchJobs) {
484
- * console.log(batchJob);
485
- * }
486
- * ```
487
- */
488
- list: (params?: types.ListBatchJobsParameters) => Promise<Pager<types.BatchJob>>;
489
489
  private createInlinedGenerateContentRequest;
490
490
  private getGcsUri;
491
491
  private getBigqueryUri;
@@ -741,10 +741,10 @@ export declare class Caches extends BaseModule {
741
741
  private readonly apiClient;
742
742
  constructor(apiClient: ApiClient);
743
743
  /**
744
- * Lists cached content configurations.
744
+ * Lists cached contents.
745
745
  *
746
746
  * @param params - The parameters for the list request.
747
- * @return The paginated results of the list of cached contents.
747
+ * @return - A pager of cached contents.
748
748
  *
749
749
  * @example
750
750
  * ```ts
@@ -900,6 +900,12 @@ export declare interface CancelTuningJobParameters {
900
900
  config?: CancelTuningJobConfig;
901
901
  }
902
902
 
903
+ /** Empty response for tunings.cancel method. */
904
+ export declare class CancelTuningJobResponse {
905
+ /** Used to retain the full HTTP response. */
906
+ sdkHttpResponse?: HttpResponse;
907
+ }
908
+
903
909
  /** A response candidate generated from the model. */
904
910
  export declare interface Candidate {
905
911
  /** Contains the multi-part content of the response.
@@ -1922,7 +1928,7 @@ declare class Documents extends BaseModule {
1922
1928
  *
1923
1929
  * @example
1924
1930
  * ```ts
1925
- * const documents = await ai.documents.list({config: {'pageSize': 2}});
1931
+ * const documents = await ai.documents.list({parent:'rag_store_name', config: {'pageSize': 2}});
1926
1932
  * for await (const document of documents) {
1927
1933
  * console.log(document);
1928
1934
  * }
@@ -1942,12 +1948,6 @@ declare class Documents extends BaseModule {
1942
1948
  * @param params - The parameters for deleting a document.
1943
1949
  */
1944
1950
  delete(params: types.DeleteDocumentParameters): Promise<void>;
1945
- /**
1946
- * Lists all Documents in a FileSearchStore.
1947
- *
1948
- * @param params - The parameters for listing documents.
1949
- * @return ListDocumentsResponse.
1950
- */
1951
1951
  private listInternal;
1952
1952
  }
1953
1953
 
@@ -2362,19 +2362,16 @@ export declare class Files extends BaseModule {
2362
2362
  private readonly apiClient;
2363
2363
  constructor(apiClient: ApiClient);
2364
2364
  /**
2365
- * Lists all current project files from the service.
2365
+ * Lists files.
2366
2366
  *
2367
- * @param params - The parameters for the list request
2368
- * @return The paginated results of the list of files
2367
+ * @param params - The parameters for the list request.
2368
+ * @return - A pager of files.
2369
2369
  *
2370
2370
  * @example
2371
- * The following code prints the names of all files from the service, the
2372
- * size of each page is 10.
2373
- *
2374
2371
  * ```ts
2375
- * const listResponse = await ai.files.list({config: {'pageSize': 10}});
2376
- * for await (const file of listResponse) {
2377
- * console.log(file.name);
2372
+ * const files = await ai.files.list({config: {'pageSize': 2}});
2373
+ * for await (const file of files) {
2374
+ * console.log(file);
2378
2375
  * }
2379
2376
  * ```
2380
2377
  */
@@ -2510,6 +2507,21 @@ declare class FileSearchStores extends BaseModule {
2510
2507
  private readonly apiClient;
2511
2508
  readonly documents: Documents;
2512
2509
  constructor(apiClient: ApiClient, documents?: Documents);
2510
+ /**
2511
+ * Lists file search stores.
2512
+ *
2513
+ * @param params - The parameters for the list request.
2514
+ * @return - A pager of file search stores.
2515
+ *
2516
+ * @example
2517
+ * ```ts
2518
+ * const fileSearchStores = await ai.fileSearchStores.list({config: {'pageSize': 2}});
2519
+ * for await (const fileSearchStore of fileSearchStores) {
2520
+ * console.log(fileSearchStore);
2521
+ * }
2522
+ * ```
2523
+ */
2524
+ list: (params?: types.ListFileSearchStoresParameters) => Promise<Pager<types.FileSearchStore>>;
2513
2525
  /**
2514
2526
  * Uploads a file asynchronously to a given File Search Store.
2515
2527
  * This method is not available in Vertex AI.
@@ -2547,21 +2559,6 @@ declare class FileSearchStores extends BaseModule {
2547
2559
  * ```
2548
2560
  */
2549
2561
  uploadToFileSearchStore(params: types.UploadToFileSearchStoreParameters): Promise<types.UploadToFileSearchStoreOperation>;
2550
- /**
2551
- * Lists file search stores.
2552
- *
2553
- * @param params - The parameters for the list request.
2554
- * @return - A pager of file search stores.
2555
- *
2556
- * @example
2557
- * ```ts
2558
- * const fileSearchStores = await ai.fileSearchStores.list({config: {'pageSize': 2}});
2559
- * for await (const fileSearchStore of fileSearchStores) {
2560
- * console.log(fileSearchStore);
2561
- * }
2562
- * ```
2563
- */
2564
- list: (params?: types.ListFileSearchStoresParameters) => Promise<Pager<types.FileSearchStore>>;
2565
2562
  /**
2566
2563
  * Creates a File Search Store.
2567
2564
  *
@@ -2582,12 +2579,6 @@ declare class FileSearchStores extends BaseModule {
2582
2579
  * @param params - The parameters for deleting a File Search Store.
2583
2580
  */
2584
2581
  delete(params: types.DeleteFileSearchStoreParameters): Promise<void>;
2585
- /**
2586
- * Lists all FileSearchStore owned by the user.
2587
- *
2588
- * @param params - The parameters for listing file search stores.
2589
- * @return ListFileSearchStoresResponse.
2590
- */
2591
2582
  private listInternal;
2592
2583
  private uploadToFileSearchStoreInternal;
2593
2584
  /**
@@ -2959,6 +2950,9 @@ export declare interface GenerateContentConfig {
2959
2950
  object](https://spec.openapis.org/oas/v3.0.3#schema).
2960
2951
  If set, a compatible response_mime_type must also be set.
2961
2952
  Compatible mimetypes: `application/json`: Schema for JSON response.
2953
+
2954
+ If `response_schema` doesn't process your schema correctly, try using
2955
+ `response_json_schema` instead.
2962
2956
  */
2963
2957
  responseSchema?: SchemaUnion;
2964
2958
  /** Optional. Output schema of the generated response.
@@ -3023,6 +3017,10 @@ export declare interface GenerateContentConfig {
3023
3017
  /** The image generation configuration.
3024
3018
  */
3025
3019
  imageConfig?: ImageConfig;
3020
+ /** Enables enhanced civic answers. It may not be available for all
3021
+ models. This field is not supported in Vertex AI.
3022
+ */
3023
+ enableEnhancedCivicAnswers?: boolean;
3026
3024
  }
3027
3025
 
3028
3026
  /** Config for models.generate_content parameters. */
@@ -3745,6 +3743,7 @@ export declare class GoogleGenAI {
3745
3743
  private readonly apiKey?;
3746
3744
  readonly vertexai: boolean;
3747
3745
  private readonly apiVersion?;
3746
+ private readonly httpOptions?;
3748
3747
  readonly models: Models;
3749
3748
  readonly live: Live;
3750
3749
  readonly batches: Batches;
@@ -6709,6 +6708,17 @@ export declare class ReplayResponse {
6709
6708
  sdkResponseSegments?: Record<string, unknown>[];
6710
6709
  }
6711
6710
 
6711
+ /** ReplicatedVoiceConfig is used to configure replicated voice. */
6712
+ export declare interface ReplicatedVoiceConfig {
6713
+ /** The mime type of the replicated voice.
6714
+ */
6715
+ mimeType?: string;
6716
+ /** The sample audio of the replicated voice.
6717
+
6718
+ * @remarks Encoded as base64 string. */
6719
+ voiceSampleAudio?: string;
6720
+ }
6721
+
6712
6722
  /** Defines a retrieval tool that model can call to access external knowledge. This data type is not supported in Gemini API. */
6713
6723
  export declare interface Retrieval {
6714
6724
  /** Optional. Deprecated. This option is no longer supported. */
@@ -7199,12 +7209,11 @@ export declare interface SpeakerVoiceConfig {
7199
7209
  voiceConfig?: VoiceConfig;
7200
7210
  }
7201
7211
 
7202
- /** The speech generation config. */
7203
7212
  export declare interface SpeechConfig {
7213
+ /** Configuration for the voice of the response. */
7214
+ voiceConfig?: VoiceConfig;
7204
7215
  /** Optional. Language code (ISO 639. e.g. en-US) for the speech synthesization. */
7205
7216
  languageCode?: string;
7206
- /** The configuration for the speaker to use. */
7207
- voiceConfig?: VoiceConfig;
7208
7217
  /** Optional. The configuration for the multi-speaker setup. It is mutually exclusive with the voice_config field. This field is not supported in Vertex AI. */
7209
7218
  multiSpeakerVoiceConfig?: MultiSpeakerVoiceConfig;
7210
7219
  }
@@ -7780,25 +7789,30 @@ declare class Tunings extends BaseModule {
7780
7789
  private readonly apiClient;
7781
7790
  constructor(apiClient: ApiClient);
7782
7791
  /**
7783
- * Gets a TuningJob.
7792
+ * Lists tuning jobs.
7784
7793
  *
7785
- * @param name - The resource name of the tuning job.
7786
- * @return - A TuningJob object.
7794
+ * @param params - The parameters for the list request.
7795
+ * @return - A pager of tuning jobs.
7787
7796
  *
7788
- * @experimental - The SDK's tuning implementation is experimental, and may
7789
- * change in future versions.
7797
+ * @example
7798
+ * ```ts
7799
+ * const tuningJobs = await ai.tunings.list({config: {'pageSize': 2}});
7800
+ * for await (const tuningJob of tuningJobs) {
7801
+ * console.log(tuningJob);
7802
+ * }
7803
+ * ```
7790
7804
  */
7791
- get: (params: types.GetTuningJobParameters) => Promise<types.TuningJob>;
7805
+ list: (params?: types.ListTuningJobsParameters) => Promise<Pager<types.TuningJob>>;
7792
7806
  /**
7793
- * Lists tuning jobs.
7807
+ * Gets a TuningJob.
7794
7808
  *
7795
- * @param config - The configuration for the list request.
7796
- * @return - A list of tuning jobs.
7809
+ * @param name - The resource name of the tuning job.
7810
+ * @return - A TuningJob object.
7797
7811
  *
7798
7812
  * @experimental - The SDK's tuning implementation is experimental, and may
7799
7813
  * change in future versions.
7800
7814
  */
7801
- list: (params?: types.ListTuningJobsParameters) => Promise<Pager<types.TuningJob>>;
7815
+ get: (params: types.GetTuningJobParameters) => Promise<types.TuningJob>;
7802
7816
  /**
7803
7817
  * Creates a supervised fine-tuning job.
7804
7818
  *
@@ -7822,7 +7836,7 @@ declare class Tunings extends BaseModule {
7822
7836
  * await ai.tunings.cancel({name: '...'}); // The server-generated resource name.
7823
7837
  * ```
7824
7838
  */
7825
- cancel(params: types.CancelTuningJobParameters): Promise<void>;
7839
+ cancel(params: types.CancelTuningJobParameters): Promise<types.CancelTuningJobResponse>;
7826
7840
  private tuneInternal;
7827
7841
  private tuneMldevInternal;
7828
7842
  }
@@ -8049,6 +8063,12 @@ declare namespace types {
8049
8063
  LatLng,
8050
8064
  RetrievalConfig,
8051
8065
  ToolConfig,
8066
+ ReplicatedVoiceConfig,
8067
+ PrebuiltVoiceConfig,
8068
+ VoiceConfig,
8069
+ SpeakerVoiceConfig,
8070
+ MultiSpeakerVoiceConfig,
8071
+ SpeechConfig,
8052
8072
  AutomaticFunctionCallingConfig,
8053
8073
  ThinkingConfig,
8054
8074
  ImageConfig,
@@ -8136,11 +8156,6 @@ declare namespace types {
8136
8156
  DeleteModelConfig,
8137
8157
  DeleteModelParameters,
8138
8158
  DeleteModelResponse,
8139
- PrebuiltVoiceConfig,
8140
- VoiceConfig,
8141
- SpeakerVoiceConfig,
8142
- MultiSpeakerVoiceConfig,
8143
- SpeechConfig,
8144
8159
  GenerationConfig,
8145
8160
  CountTokensConfig,
8146
8161
  CountTokensParameters,
@@ -8190,6 +8205,7 @@ declare namespace types {
8190
8205
  ListTuningJobsResponse,
8191
8206
  CancelTuningJobConfig,
8192
8207
  CancelTuningJobParameters,
8208
+ CancelTuningJobResponse,
8193
8209
  TuningExample,
8194
8210
  TuningDataset,
8195
8211
  TuningValidationDataset,
@@ -8848,8 +8864,9 @@ export declare interface VideoMetadata {
8848
8864
  startOffset?: string;
8849
8865
  }
8850
8866
 
8851
- /** The configuration for the voice to use. */
8852
8867
  export declare interface VoiceConfig {
8868
+ /** If true, the model will use a replicated voice for the response. */
8869
+ replicatedVoiceConfig?: ReplicatedVoiceConfig;
8853
8870
  /** The configuration for the prebuilt voice to use. */
8854
8871
  prebuiltVoiceConfig?: PrebuiltVoiceConfig;
8855
8872
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@google/genai",
3
- "version": "1.30.0",
3
+ "version": "1.32.0",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/node/index.mjs",
@@ -37,7 +37,7 @@
37
37
  }
38
38
  },
39
39
  "scripts": {
40
- "prepare": "npm run build-prod",
40
+ "prepare": "node scripts/prepare.js",
41
41
  "build": "patch-package && rollup -c && npm-run-all --parallel api-extractor:dev:* && node scripts/ignore_missing_mcp_dep.js",
42
42
  "build-prod": "patch-package && rollup -c && npm-run-all --parallel api-extractor:prod:* && node scripts/ignore_missing_mcp_dep.js",
43
43
  "api-extractor:dev:main": "api-extractor run --local --verbose",
@@ -82,13 +82,14 @@
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
+ "@modelcontextprotocol/sdk": "^1.24.0",
86
86
  "@rollup/plugin-json": "^6.1.0",
87
87
  "@types/jasmine": "^5.1.2",
88
88
  "@types/node": "^20.9.0",
89
89
  "@types/node-fetch": "^2.6.13",
90
90
  "@types/unist": "^3.0.3",
91
91
  "@types/ws": "^8.5.14",
92
+ "@cfworker/json-schema": "^4.1.1",
92
93
  "c8": "^10.1.3",
93
94
  "eslint": "8.57.0",
94
95
  "gts": "^5.2.0",
@@ -106,19 +107,19 @@
106
107
  "tslib": "^2.8.1",
107
108
  "tsx": "^4.19.4",
108
109
  "typedoc": "^0.27.0",
109
- "typescript": "~5.2.0",
110
+ "typescript": "~5.4.0",
110
111
  "typescript-eslint": "8.24.1",
111
112
  "undici": "^7.16.0",
112
113
  "undici-types": "^7.16.0",
113
- "zod": "^3.22.4",
114
- "zod-to-json-schema": "^3.22.4"
114
+ "zod": "^3.25.0",
115
+ "zod-to-json-schema": "^3.25.0"
115
116
  },
116
117
  "dependencies": {
117
118
  "google-auth-library": "^10.3.0",
118
119
  "ws": "^8.18.0"
119
120
  },
120
121
  "peerDependencies": {
121
- "@modelcontextprotocol/sdk": "^1.20.1"
122
+ "@modelcontextprotocol/sdk": "^1.24.0"
122
123
  },
123
124
  "peerDependenciesMeta": {
124
125
  "@modelcontextprotocol/sdk": {