@google/genai 1.16.0 → 1.17.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.
@@ -917,7 +917,7 @@ exports.SubjectReferenceType = void 0;
917
917
  SubjectReferenceType["SUBJECT_TYPE_ANIMAL"] = "SUBJECT_TYPE_ANIMAL";
918
918
  SubjectReferenceType["SUBJECT_TYPE_PRODUCT"] = "SUBJECT_TYPE_PRODUCT";
919
919
  })(exports.SubjectReferenceType || (exports.SubjectReferenceType = {}));
920
- /** Enum representing the Imagen 3 Edit mode. */
920
+ /** Enum representing the editing mode. */
921
921
  exports.EditMode = void 0;
922
922
  (function (EditMode) {
923
923
  EditMode["EDIT_MODE_DEFAULT"] = "EDIT_MODE_DEFAULT";
@@ -10552,8 +10552,9 @@ function generateVideosConfigToMldev(fromObject, parentObject) {
10552
10552
  if (parentObject !== undefined && fromAspectRatio != null) {
10553
10553
  setValueByPath(parentObject, ['parameters', 'aspectRatio'], fromAspectRatio);
10554
10554
  }
10555
- if (getValueByPath(fromObject, ['resolution']) !== undefined) {
10556
- throw new Error('resolution parameter is not supported in Gemini API.');
10555
+ const fromResolution = getValueByPath(fromObject, ['resolution']);
10556
+ if (parentObject !== undefined && fromResolution != null) {
10557
+ setValueByPath(parentObject, ['parameters', 'resolution'], fromResolution);
10557
10558
  }
10558
10559
  const fromPersonGeneration = getValueByPath(fromObject, [
10559
10560
  'personGeneration',
@@ -13611,7 +13612,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
13611
13612
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
13612
13613
  const USER_AGENT_HEADER = 'User-Agent';
13613
13614
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
13614
- const SDK_VERSION = '1.16.0'; // x-release-please-version
13615
+ const SDK_VERSION = '1.17.0'; // x-release-please-version
13615
13616
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
13616
13617
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
13617
13618
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -15816,23 +15817,7 @@ class Models extends BaseModule {
15816
15817
  }
15817
15818
  }
15818
15819
  /**
15819
- * Generates an image based on a text description and configuration.
15820
- *
15821
- * @param params - The parameters for generating images.
15822
- * @return The response from the API.
15823
- *
15824
- * @example
15825
- * ```ts
15826
- * const response = await ai.models.generateImages({
15827
- * model: 'imagen-3.0-generate-002',
15828
- * prompt: 'Robot holding a red skateboard',
15829
- * config: {
15830
- * numberOfImages: 1,
15831
- * includeRaiReason: true,
15832
- * },
15833
- * });
15834
- * console.log(response?.generatedImages?.[0]?.image?.imageBytes);
15835
- * ```
15820
+ * Private method for generating images.
15836
15821
  */
15837
15822
  async generateImagesInternal(params) {
15838
15823
  var _a, _b, _c, _d;
@@ -15904,6 +15889,9 @@ class Models extends BaseModule {
15904
15889
  });
15905
15890
  }
15906
15891
  }
15892
+ /**
15893
+ * Private method for editing an image.
15894
+ */
15907
15895
  async editImageInternal(params) {
15908
15896
  var _a, _b;
15909
15897
  let response;
@@ -15945,6 +15933,9 @@ class Models extends BaseModule {
15945
15933
  throw new Error('This method is only supported by the Vertex AI.');
15946
15934
  }
15947
15935
  }
15936
+ /**
15937
+ * Private method for upscaling an image.
15938
+ */
15948
15939
  async upscaleImageInternal(params) {
15949
15940
  var _a, _b;
15950
15941
  let response;
@@ -16544,27 +16535,7 @@ class Models extends BaseModule {
16544
16535
  }
16545
16536
  }
16546
16537
  /**
16547
- * Generates videos based on a text description and configuration.
16548
- *
16549
- * @param params - The parameters for generating videos.
16550
- * @return A Promise<GenerateVideosOperation> which allows you to track the progress and eventually retrieve the generated videos using the operations.get method.
16551
- *
16552
- * @example
16553
- * ```ts
16554
- * const operation = await ai.models.generateVideos({
16555
- * model: 'veo-2.0-generate-001',
16556
- * prompt: 'A neon hologram of a cat driving at top speed',
16557
- * config: {
16558
- * numberOfVideos: 1
16559
- * });
16560
- *
16561
- * while (!operation.done) {
16562
- * await new Promise(resolve => setTimeout(resolve, 10000));
16563
- * operation = await ai.operations.getVideosOperation({operation: operation});
16564
- * }
16565
- *
16566
- * console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
16567
- * ```
16538
+ * Private method for generating videos.
16568
16539
  */
16569
16540
  async generateVideosInternal(params) {
16570
16541
  var _a, _b, _c, _d;
@@ -895,7 +895,7 @@ var SubjectReferenceType;
895
895
  SubjectReferenceType["SUBJECT_TYPE_ANIMAL"] = "SUBJECT_TYPE_ANIMAL";
896
896
  SubjectReferenceType["SUBJECT_TYPE_PRODUCT"] = "SUBJECT_TYPE_PRODUCT";
897
897
  })(SubjectReferenceType || (SubjectReferenceType = {}));
898
- /** Enum representing the Imagen 3 Edit mode. */
898
+ /** Enum representing the editing mode. */
899
899
  var EditMode;
900
900
  (function (EditMode) {
901
901
  EditMode["EDIT_MODE_DEFAULT"] = "EDIT_MODE_DEFAULT";
@@ -10530,8 +10530,9 @@ function generateVideosConfigToMldev(fromObject, parentObject) {
10530
10530
  if (parentObject !== undefined && fromAspectRatio != null) {
10531
10531
  setValueByPath(parentObject, ['parameters', 'aspectRatio'], fromAspectRatio);
10532
10532
  }
10533
- if (getValueByPath(fromObject, ['resolution']) !== undefined) {
10534
- throw new Error('resolution parameter is not supported in Gemini API.');
10533
+ const fromResolution = getValueByPath(fromObject, ['resolution']);
10534
+ if (parentObject !== undefined && fromResolution != null) {
10535
+ setValueByPath(parentObject, ['parameters', 'resolution'], fromResolution);
10535
10536
  }
10536
10537
  const fromPersonGeneration = getValueByPath(fromObject, [
10537
10538
  'personGeneration',
@@ -13589,7 +13590,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
13589
13590
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
13590
13591
  const USER_AGENT_HEADER = 'User-Agent';
13591
13592
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
13592
- const SDK_VERSION = '1.16.0'; // x-release-please-version
13593
+ const SDK_VERSION = '1.17.0'; // x-release-please-version
13593
13594
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
13594
13595
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
13595
13596
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -15794,23 +15795,7 @@ class Models extends BaseModule {
15794
15795
  }
15795
15796
  }
15796
15797
  /**
15797
- * Generates an image based on a text description and configuration.
15798
- *
15799
- * @param params - The parameters for generating images.
15800
- * @return The response from the API.
15801
- *
15802
- * @example
15803
- * ```ts
15804
- * const response = await ai.models.generateImages({
15805
- * model: 'imagen-3.0-generate-002',
15806
- * prompt: 'Robot holding a red skateboard',
15807
- * config: {
15808
- * numberOfImages: 1,
15809
- * includeRaiReason: true,
15810
- * },
15811
- * });
15812
- * console.log(response?.generatedImages?.[0]?.image?.imageBytes);
15813
- * ```
15798
+ * Private method for generating images.
15814
15799
  */
15815
15800
  async generateImagesInternal(params) {
15816
15801
  var _a, _b, _c, _d;
@@ -15882,6 +15867,9 @@ class Models extends BaseModule {
15882
15867
  });
15883
15868
  }
15884
15869
  }
15870
+ /**
15871
+ * Private method for editing an image.
15872
+ */
15885
15873
  async editImageInternal(params) {
15886
15874
  var _a, _b;
15887
15875
  let response;
@@ -15923,6 +15911,9 @@ class Models extends BaseModule {
15923
15911
  throw new Error('This method is only supported by the Vertex AI.');
15924
15912
  }
15925
15913
  }
15914
+ /**
15915
+ * Private method for upscaling an image.
15916
+ */
15926
15917
  async upscaleImageInternal(params) {
15927
15918
  var _a, _b;
15928
15919
  let response;
@@ -16522,27 +16513,7 @@ class Models extends BaseModule {
16522
16513
  }
16523
16514
  }
16524
16515
  /**
16525
- * Generates videos based on a text description and configuration.
16526
- *
16527
- * @param params - The parameters for generating videos.
16528
- * @return A Promise<GenerateVideosOperation> which allows you to track the progress and eventually retrieve the generated videos using the operations.get method.
16529
- *
16530
- * @example
16531
- * ```ts
16532
- * const operation = await ai.models.generateVideos({
16533
- * model: 'veo-2.0-generate-001',
16534
- * prompt: 'A neon hologram of a cat driving at top speed',
16535
- * config: {
16536
- * numberOfVideos: 1
16537
- * });
16538
- *
16539
- * while (!operation.done) {
16540
- * await new Promise(resolve => setTimeout(resolve, 10000));
16541
- * operation = await ai.operations.getVideosOperation({operation: operation});
16542
- * }
16543
- *
16544
- * console.log(operation.response?.generatedVideos?.[0]?.video?.uri);
16545
- * ```
16516
+ * Private method for generating videos.
16546
16517
  */
16547
16518
  async generateVideosInternal(params) {
16548
16519
  var _a, _b, _c, _d;