@google/genai 1.47.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.
package/dist/index.mjs CHANGED
@@ -1546,19 +1546,19 @@ var ServiceTier;
1546
1546
  /**
1547
1547
  * Default service tier, which is standard.
1548
1548
  */
1549
- ServiceTier["SERVICE_TIER_UNSPECIFIED"] = "SERVICE_TIER_UNSPECIFIED";
1549
+ ServiceTier["UNSPECIFIED"] = "unspecified";
1550
1550
  /**
1551
1551
  * Flex service tier.
1552
1552
  */
1553
- ServiceTier["SERVICE_TIER_FLEX"] = "SERVICE_TIER_FLEX";
1553
+ ServiceTier["FLEX"] = "flex";
1554
1554
  /**
1555
1555
  * Standard service tier.
1556
1556
  */
1557
- ServiceTier["SERVICE_TIER_STANDARD"] = "SERVICE_TIER_STANDARD";
1557
+ ServiceTier["STANDARD"] = "standard";
1558
1558
  /**
1559
1559
  * Priority service tier.
1560
1560
  */
1561
- ServiceTier["SERVICE_TIER_PRIORITY"] = "SERVICE_TIER_PRIORITY";
1561
+ ServiceTier["PRIORITY"] = "priority";
1562
1562
  })(ServiceTier || (ServiceTier = {}));
1563
1563
  /** Options for feature selection preference. */
1564
1564
  var FeatureSelectionPreference;
@@ -7427,7 +7427,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
7427
7427
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
7428
7428
  const USER_AGENT_HEADER = 'User-Agent';
7429
7429
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
7430
- const SDK_VERSION = '1.47.0'; // x-release-please-version
7430
+ const SDK_VERSION = '1.49.0'; // x-release-please-version
7431
7431
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
7432
7432
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
7433
7433
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -9812,7 +9812,8 @@ class BaseInteractions extends APIResource {
9812
9812
  return this._client.delete(path `/${api_version}/interactions/${id}`, options);
9813
9813
  }
9814
9814
  /**
9815
- * Cancels an interaction by id. This only applies to background interactions that are still running.
9815
+ * Cancels an interaction by id. This only applies to background interactions that
9816
+ * are still running.
9816
9817
  *
9817
9818
  * @example
9818
9819
  * ```ts
@@ -10668,7 +10669,7 @@ class BaseGeminiNextGenAPIClient {
10668
10669
  if (this.apiKey) {
10669
10670
  return buildHeaders([{ 'x-goog-api-key': this.apiKey }]);
10670
10671
  }
10671
- if (this.clientAdapter.isVertexAI()) {
10672
+ if (this.clientAdapter && this.clientAdapter.isVertexAI()) {
10672
10673
  return buildHeaders([await this.clientAdapter.getAuthHeaders()]);
10673
10674
  }
10674
10675
  return undefined;
@@ -13473,8 +13474,9 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject, root
13473
13474
  if (parentObject !== undefined && fromModelArmorConfig != null) {
13474
13475
  setValueByPath(parentObject, ['modelArmorConfig'], fromModelArmorConfig);
13475
13476
  }
13476
- if (getValueByPath(fromObject, ['serviceTier']) !== undefined) {
13477
- throw new Error('serviceTier parameter is not supported in Vertex AI.');
13477
+ const fromServiceTier = getValueByPath(fromObject, ['serviceTier']);
13478
+ if (parentObject !== undefined && fromServiceTier != null) {
13479
+ setValueByPath(parentObject, ['serviceTier'], fromServiceTier);
13478
13480
  }
13479
13481
  return toObject;
13480
13482
  }
@@ -17779,29 +17781,15 @@ class Models extends BaseModule {
17779
17781
  /**
17780
17782
  * Recontextualizes an image.
17781
17783
  *
17782
- * There are two types of recontextualization currently supported:
17783
- * 1) Imagen Product Recontext - Generate images of products in new scenes
17784
- * and contexts.
17785
- * 2) Virtual Try-On: Generate images of persons modeling fashion products.
17784
+ * There is one type of recontextualization currently supported:
17785
+ * 1) Virtual Try-On: Generate images of persons modeling fashion products.
17786
17786
  *
17787
17787
  * @param params - The parameters for recontextualizing an image.
17788
17788
  * @return The response from the API.
17789
17789
  *
17790
17790
  * @example
17791
17791
  * ```ts
17792
- * const response1 = await ai.models.recontextImage({
17793
- * model: 'imagen-product-recontext-preview-06-30',
17794
- * source: {
17795
- * prompt: 'In a modern kitchen setting.',
17796
- * productImages: [productImage],
17797
- * },
17798
- * config: {
17799
- * numberOfImages: 1,
17800
- * },
17801
- * });
17802
- * console.log(response1?.generatedImages?.[0]?.image?.imageBytes);
17803
- *
17804
- * const response2 = await ai.models.recontextImage({
17792
+ * const response = await ai.models.recontextImage({
17805
17793
  * model: 'virtual-try-on-001',
17806
17794
  * source: {
17807
17795
  * personImage: personImage,
@@ -17811,7 +17799,7 @@ class Models extends BaseModule {
17811
17799
  * numberOfImages: 1,
17812
17800
  * },
17813
17801
  * });
17814
- * console.log(response2?.generatedImages?.[0]?.image?.imageBytes);
17802
+ * console.log(response?.generatedImages?.[0]?.image?.imageBytes);
17815
17803
  * ```
17816
17804
  */
17817
17805
  async recontextImage(params) {
@@ -20612,9 +20600,6 @@ class GoogleGenAI {
20612
20600
  return this._interactions;
20613
20601
  }
20614
20602
  console.warn('GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.');
20615
- if (this.vertexai) {
20616
- throw new Error('This version of the GenAI SDK does not support Vertex AI API for interactions.');
20617
- }
20618
20603
  const httpOpts = this.httpOptions;
20619
20604
  // Unsupported Options Warnings
20620
20605
  if (httpOpts === null || httpOpts === void 0 ? void 0 : httpOpts.extraBody) {