@google/genai 1.9.0 → 1.10.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/README.md CHANGED
@@ -218,10 +218,10 @@ main();
218
218
 
219
219
  ### Function Calling
220
220
 
221
- To let Gemini to interact with external systems, you can provide provide
221
+ To let Gemini to interact with external systems, you can provide
222
222
  `functionDeclaration` objects as `tools`. To use these tools it's a 4 step
223
223
 
224
- 1. **Declare the function name, description, and parameters**
224
+ 1. **Declare the function name, description, and parametersJsonSchema**
225
225
  2. **Call `generateContent` with function calling enabled**
226
226
  3. **Use the returned `FunctionCall` parameters to call your actual function**
227
227
  3. **Send the result back to the model (with history, easier in `ai.chat`)
@@ -234,19 +234,14 @@ const GEMINI_API_KEY = process.env.GEMINI_API_KEY;
234
234
  async function main() {
235
235
  const controlLightDeclaration: FunctionDeclaration = {
236
236
  name: 'controlLight',
237
- parameters: {
238
- type: Type.OBJECT,
239
- description: 'Set the brightness and color temperature of a room light.',
240
- properties: {
237
+ parametersJsonSchema: {
238
+ type: 'object',
239
+ properties:{
241
240
  brightness: {
242
- type: Type.NUMBER,
243
- description:
244
- 'Light level from 0 to 100. Zero is off and 100 is full brightness.',
241
+ type:'number',
245
242
  },
246
243
  colorTemperature: {
247
- type: Type.STRING,
248
- description:
249
- 'Color temperature of the light fixture which can be `daylight`, `cool`, or `warm`.',
244
+ type:'string',
250
245
  },
251
246
  },
252
247
  required: ['brightness', 'colorTemperature'],
package/dist/genai.d.ts CHANGED
@@ -560,6 +560,8 @@ export declare interface BatchJobDestination {
560
560
  inlinedResponses?: InlinedResponse[];
561
561
  }
562
562
 
563
+ export declare type BatchJobDestinationUnion = BatchJobDestination | string;
564
+
563
565
  /** Config for `src` parameter. */
564
566
  export declare interface BatchJobSource {
565
567
  /** Storage format of the input files. Must be one of:
@@ -1229,7 +1231,7 @@ export declare interface CreateBatchJobConfig {
1229
1231
  /** GCS or BigQuery URI prefix for the output predictions. Example:
1230
1232
  "gs://path/to/output/data" or "bq://projectId.bqDatasetId.bqTableId".
1231
1233
  */
1232
- dest?: string;
1234
+ dest?: BatchJobDestinationUnion;
1233
1235
  }
1234
1236
 
1235
1237
  /** Config for batches.create parameters. */
@@ -1745,6 +1747,9 @@ export declare interface EditImageConfig {
1745
1747
  only).
1746
1748
  */
1747
1749
  outputCompressionQuality?: number;
1750
+ /** Whether to add a watermark to the generated images.
1751
+ */
1752
+ addWatermark?: boolean;
1748
1753
  /** Describes the editing mode for the request. */
1749
1754
  editMode?: EditMode;
1750
1755
  /** The number of sampling steps. A higher value has better image
@@ -2480,6 +2485,8 @@ export declare interface GenerateContentParameters {
2480
2485
 
2481
2486
  /** Response message for PredictionService.GenerateContent. */
2482
2487
  export declare class GenerateContentResponse {
2488
+ /** Used to retain the full HTTP response. */
2489
+ sdkHttpResponse?: HttpResponse;
2483
2490
  /** Response variations returned by the model.
2484
2491
  */
2485
2492
  candidates?: Candidate[];
@@ -2800,7 +2807,7 @@ export declare interface GenerateVideosConfig {
2800
2807
  seed?: number;
2801
2808
  /** The aspect ratio for the generated video. 16:9 (landscape) and 9:16 (portrait) are supported. */
2802
2809
  aspectRatio?: string;
2803
- /** The resolution for the generated video. 1280x720, 1920x1080 are supported. */
2810
+ /** The resolution for the generated video. 720p and 1080p are supported. */
2804
2811
  resolution?: string;
2805
2812
  /** Whether allow to generate person videos, and restrict to specific ages. Supported values are: dont_allow, allow_adult. */
2806
2813
  personGeneration?: string;
@@ -3415,7 +3422,10 @@ export declare interface HttpOptions {
3415
3422
  headers?: Record<string, string>;
3416
3423
  /** Timeout for the request in milliseconds. */
3417
3424
  timeout?: number;
3418
- /** Extra parameters to add to the request body. */
3425
+ /** Extra parameters to add to the request body.
3426
+ The structure must match the backend API's request structure.
3427
+ - VertexAI backend API docs: https://cloud.google.com/vertex-ai/docs/reference/rest
3428
+ - GeminiAPI backend API docs: https://ai.google.dev/api/rest */
3419
3429
  extraBody?: Record<string, unknown>;
3420
3430
  }
3421
3431
 
@@ -5075,18 +5085,6 @@ export declare interface MultiSpeakerVoiceConfig {
5075
5085
  speakerVoiceConfigs?: SpeakerVoiceConfig[];
5076
5086
  }
5077
5087
 
5078
- /** A long-running operation. */
5079
- export declare interface Operation {
5080
- /** The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`. */
5081
- name?: string;
5082
- /** Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. */
5083
- metadata?: Record<string, unknown>;
5084
- /** If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available. */
5085
- done?: boolean;
5086
- /** The error result of the operation in case of failure or cancellation. */
5087
- error?: Record<string, unknown>;
5088
- }
5089
-
5090
5088
  /** Parameters for the get method of the operations module. */
5091
5089
  export declare interface OperationGetParameters {
5092
5090
  /** The operation to be retrieved. */
@@ -6386,6 +6384,18 @@ export declare interface TuningJob {
6386
6384
  tunedModelDisplayName?: string;
6387
6385
  }
6388
6386
 
6387
+ /** A long-running operation. */
6388
+ export declare interface TuningOperation {
6389
+ /** The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`. */
6390
+ name?: string;
6391
+ /** Service-specific metadata associated with the operation. It typically contains progress information and common metadata such as create time. Some services might not provide such metadata. Any method that returns a long-running operation should document the metadata type, if any. */
6392
+ metadata?: Record<string, unknown>;
6393
+ /** If the value is `false`, it means the operation is still in progress. If `true`, the operation is completed, and either `error` or `response` is available. */
6394
+ done?: boolean;
6395
+ /** The error result of the operation in case of failure or cancellation. */
6396
+ error?: Record<string, unknown>;
6397
+ }
6398
+
6389
6399
  declare class Tunings extends BaseModule {
6390
6400
  private readonly apiClient;
6391
6401
  constructor(apiClient: ApiClient);
@@ -6703,7 +6713,7 @@ declare namespace types {
6703
6713
  TuningValidationDataset,
6704
6714
  CreateTuningJobConfig,
6705
6715
  CreateTuningJobParameters,
6706
- Operation,
6716
+ TuningOperation,
6707
6717
  CreateCachedContentConfig,
6708
6718
  CreateCachedContentParameters,
6709
6719
  CachedContentUsageMetadata,
@@ -6832,7 +6842,8 @@ declare namespace types {
6832
6842
  ToolUnion,
6833
6843
  ToolListUnion,
6834
6844
  DownloadableFileUnion,
6835
- BatchJobSourceUnion
6845
+ BatchJobSourceUnion,
6846
+ BatchJobDestinationUnion
6836
6847
  }
6837
6848
  }
6838
6849