@google/genai 1.48.0 → 1.49.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.
@@ -12774,7 +12774,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
12774
12774
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
12775
12775
  const USER_AGENT_HEADER = 'User-Agent';
12776
12776
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
12777
- const SDK_VERSION = '1.48.0'; // x-release-please-version
12777
+ const SDK_VERSION = '1.49.0'; // x-release-please-version
12778
12778
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
12779
12779
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
12780
12780
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -15339,29 +15339,15 @@ class Models extends BaseModule {
15339
15339
  /**
15340
15340
  * Recontextualizes an image.
15341
15341
  *
15342
- * There are two types of recontextualization currently supported:
15343
- * 1) Imagen Product Recontext - Generate images of products in new scenes
15344
- * and contexts.
15345
- * 2) Virtual Try-On: Generate images of persons modeling fashion products.
15342
+ * There is one type of recontextualization currently supported:
15343
+ * 1) Virtual Try-On: Generate images of persons modeling fashion products.
15346
15344
  *
15347
15345
  * @param params - The parameters for recontextualizing an image.
15348
15346
  * @return The response from the API.
15349
15347
  *
15350
15348
  * @example
15351
15349
  * ```ts
15352
- * const response1 = await ai.models.recontextImage({
15353
- * model: 'imagen-product-recontext-preview-06-30',
15354
- * source: {
15355
- * prompt: 'In a modern kitchen setting.',
15356
- * productImages: [productImage],
15357
- * },
15358
- * config: {
15359
- * numberOfImages: 1,
15360
- * },
15361
- * });
15362
- * console.log(response1?.generatedImages?.[0]?.image?.imageBytes);
15363
- *
15364
- * const response2 = await ai.models.recontextImage({
15350
+ * const response = await ai.models.recontextImage({
15365
15351
  * model: 'virtual-try-on-001',
15366
15352
  * source: {
15367
15353
  * personImage: personImage,
@@ -15371,7 +15357,7 @@ class Models extends BaseModule {
15371
15357
  * numberOfImages: 1,
15372
15358
  * },
15373
15359
  * });
15374
- * console.log(response2?.generatedImages?.[0]?.image?.imageBytes);
15360
+ * console.log(response?.generatedImages?.[0]?.image?.imageBytes);
15375
15361
  * ```
15376
15362
  */
15377
15363
  async recontextImage(params) {
@@ -17951,7 +17937,8 @@ class BaseInteractions extends APIResource {
17951
17937
  return this._client.delete(path `/${api_version}/interactions/${id}`, options);
17952
17938
  }
17953
17939
  /**
17954
- * Cancels an interaction by id. This only applies to background interactions that are still running.
17940
+ * Cancels an interaction by id. This only applies to background interactions that
17941
+ * are still running.
17955
17942
  *
17956
17943
  * @example
17957
17944
  * ```ts
@@ -18807,7 +18794,7 @@ class BaseGeminiNextGenAPIClient {
18807
18794
  if (this.apiKey) {
18808
18795
  return buildHeaders([{ 'x-goog-api-key': this.apiKey }]);
18809
18796
  }
18810
- if (this.clientAdapter.isVertexAI()) {
18797
+ if (this.clientAdapter && this.clientAdapter.isVertexAI()) {
18811
18798
  return buildHeaders([await this.clientAdapter.getAuthHeaders()]);
18812
18799
  }
18813
18800
  return undefined;
@@ -12752,7 +12752,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
12752
12752
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
12753
12753
  const USER_AGENT_HEADER = 'User-Agent';
12754
12754
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
12755
- const SDK_VERSION = '1.48.0'; // x-release-please-version
12755
+ const SDK_VERSION = '1.49.0'; // x-release-please-version
12756
12756
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
12757
12757
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
12758
12758
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -15317,29 +15317,15 @@ class Models extends BaseModule {
15317
15317
  /**
15318
15318
  * Recontextualizes an image.
15319
15319
  *
15320
- * There are two types of recontextualization currently supported:
15321
- * 1) Imagen Product Recontext - Generate images of products in new scenes
15322
- * and contexts.
15323
- * 2) Virtual Try-On: Generate images of persons modeling fashion products.
15320
+ * There is one type of recontextualization currently supported:
15321
+ * 1) Virtual Try-On: Generate images of persons modeling fashion products.
15324
15322
  *
15325
15323
  * @param params - The parameters for recontextualizing an image.
15326
15324
  * @return The response from the API.
15327
15325
  *
15328
15326
  * @example
15329
15327
  * ```ts
15330
- * const response1 = await ai.models.recontextImage({
15331
- * model: 'imagen-product-recontext-preview-06-30',
15332
- * source: {
15333
- * prompt: 'In a modern kitchen setting.',
15334
- * productImages: [productImage],
15335
- * },
15336
- * config: {
15337
- * numberOfImages: 1,
15338
- * },
15339
- * });
15340
- * console.log(response1?.generatedImages?.[0]?.image?.imageBytes);
15341
- *
15342
- * const response2 = await ai.models.recontextImage({
15328
+ * const response = await ai.models.recontextImage({
15343
15329
  * model: 'virtual-try-on-001',
15344
15330
  * source: {
15345
15331
  * personImage: personImage,
@@ -15349,7 +15335,7 @@ class Models extends BaseModule {
15349
15335
  * numberOfImages: 1,
15350
15336
  * },
15351
15337
  * });
15352
- * console.log(response2?.generatedImages?.[0]?.image?.imageBytes);
15338
+ * console.log(response?.generatedImages?.[0]?.image?.imageBytes);
15353
15339
  * ```
15354
15340
  */
15355
15341
  async recontextImage(params) {
@@ -17929,7 +17915,8 @@ class BaseInteractions extends APIResource {
17929
17915
  return this._client.delete(path `/${api_version}/interactions/${id}`, options);
17930
17916
  }
17931
17917
  /**
17932
- * Cancels an interaction by id. This only applies to background interactions that are still running.
17918
+ * Cancels an interaction by id. This only applies to background interactions that
17919
+ * are still running.
17933
17920
  *
17934
17921
  * @example
17935
17922
  * ```ts
@@ -18785,7 +18772,7 @@ class BaseGeminiNextGenAPIClient {
18785
18772
  if (this.apiKey) {
18786
18773
  return buildHeaders([{ 'x-goog-api-key': this.apiKey }]);
18787
18774
  }
18788
- if (this.clientAdapter.isVertexAI()) {
18775
+ if (this.clientAdapter && this.clientAdapter.isVertexAI()) {
18789
18776
  return buildHeaders([await this.clientAdapter.getAuthHeaders()]);
18790
18777
  }
18791
18778
  return undefined;