@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.
@@ -1576,19 +1576,19 @@ var ServiceTier;
1576
1576
  /**
1577
1577
  * Default service tier, which is standard.
1578
1578
  */
1579
- ServiceTier["SERVICE_TIER_UNSPECIFIED"] = "SERVICE_TIER_UNSPECIFIED";
1579
+ ServiceTier["UNSPECIFIED"] = "unspecified";
1580
1580
  /**
1581
1581
  * Flex service tier.
1582
1582
  */
1583
- ServiceTier["SERVICE_TIER_FLEX"] = "SERVICE_TIER_FLEX";
1583
+ ServiceTier["FLEX"] = "flex";
1584
1584
  /**
1585
1585
  * Standard service tier.
1586
1586
  */
1587
- ServiceTier["SERVICE_TIER_STANDARD"] = "SERVICE_TIER_STANDARD";
1587
+ ServiceTier["STANDARD"] = "standard";
1588
1588
  /**
1589
1589
  * Priority service tier.
1590
1590
  */
1591
- ServiceTier["SERVICE_TIER_PRIORITY"] = "SERVICE_TIER_PRIORITY";
1591
+ ServiceTier["PRIORITY"] = "priority";
1592
1592
  })(ServiceTier || (ServiceTier = {}));
1593
1593
  /** Options for feature selection preference. */
1594
1594
  var FeatureSelectionPreference;
@@ -10087,8 +10087,9 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject, root
10087
10087
  if (parentObject !== undefined && fromModelArmorConfig != null) {
10088
10088
  setValueByPath(parentObject, ['modelArmorConfig'], fromModelArmorConfig);
10089
10089
  }
10090
- if (getValueByPath(fromObject, ['serviceTier']) !== undefined) {
10091
- throw new Error('serviceTier parameter is not supported in Vertex AI.');
10090
+ const fromServiceTier = getValueByPath(fromObject, ['serviceTier']);
10091
+ if (parentObject !== undefined && fromServiceTier != null) {
10092
+ setValueByPath(parentObject, ['serviceTier'], fromServiceTier);
10092
10093
  }
10093
10094
  return toObject;
10094
10095
  }
@@ -12743,7 +12744,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
12743
12744
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
12744
12745
  const USER_AGENT_HEADER = 'User-Agent';
12745
12746
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
12746
- const SDK_VERSION = '1.47.0'; // x-release-please-version
12747
+ const SDK_VERSION = '1.49.0'; // x-release-please-version
12747
12748
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
12748
12749
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
12749
12750
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -15308,29 +15309,15 @@ class Models extends BaseModule {
15308
15309
  /**
15309
15310
  * Recontextualizes an image.
15310
15311
  *
15311
- * There are two types of recontextualization currently supported:
15312
- * 1) Imagen Product Recontext - Generate images of products in new scenes
15313
- * and contexts.
15314
- * 2) Virtual Try-On: Generate images of persons modeling fashion products.
15312
+ * There is one type of recontextualization currently supported:
15313
+ * 1) Virtual Try-On: Generate images of persons modeling fashion products.
15315
15314
  *
15316
15315
  * @param params - The parameters for recontextualizing an image.
15317
15316
  * @return The response from the API.
15318
15317
  *
15319
15318
  * @example
15320
15319
  * ```ts
15321
- * const response1 = await ai.models.recontextImage({
15322
- * model: 'imagen-product-recontext-preview-06-30',
15323
- * source: {
15324
- * prompt: 'In a modern kitchen setting.',
15325
- * productImages: [productImage],
15326
- * },
15327
- * config: {
15328
- * numberOfImages: 1,
15329
- * },
15330
- * });
15331
- * console.log(response1?.generatedImages?.[0]?.image?.imageBytes);
15332
- *
15333
- * const response2 = await ai.models.recontextImage({
15320
+ * const response = await ai.models.recontextImage({
15334
15321
  * model: 'virtual-try-on-001',
15335
15322
  * source: {
15336
15323
  * personImage: personImage,
@@ -15340,7 +15327,7 @@ class Models extends BaseModule {
15340
15327
  * numberOfImages: 1,
15341
15328
  * },
15342
15329
  * });
15343
- * console.log(response2?.generatedImages?.[0]?.image?.imageBytes);
15330
+ * console.log(response?.generatedImages?.[0]?.image?.imageBytes);
15344
15331
  * ```
15345
15332
  */
15346
15333
  async recontextImage(params) {
@@ -17920,7 +17907,8 @@ class BaseInteractions extends APIResource {
17920
17907
  return this._client.delete(path `/${api_version}/interactions/${id}`, options);
17921
17908
  }
17922
17909
  /**
17923
- * Cancels an interaction by id. This only applies to background interactions that are still running.
17910
+ * Cancels an interaction by id. This only applies to background interactions that
17911
+ * are still running.
17924
17912
  *
17925
17913
  * @example
17926
17914
  * ```ts
@@ -18776,7 +18764,7 @@ class BaseGeminiNextGenAPIClient {
18776
18764
  if (this.apiKey) {
18777
18765
  return buildHeaders([{ 'x-goog-api-key': this.apiKey }]);
18778
18766
  }
18779
- if (this.clientAdapter.isVertexAI()) {
18767
+ if (this.clientAdapter && this.clientAdapter.isVertexAI()) {
18780
18768
  return buildHeaders([await this.clientAdapter.getAuthHeaders()]);
18781
18769
  }
18782
18770
  return undefined;