@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/genai.d.ts +127 -90
- package/dist/index.cjs +15 -30
- package/dist/index.mjs +15 -30
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +15 -27
- package/dist/node/index.mjs +15 -27
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +127 -90
- package/dist/tokenizer/node.cjs +4 -4
- package/dist/tokenizer/node.mjs +4 -4
- package/dist/tokenizer/node.mjs.map +1 -1
- package/dist/vertex_internal/index.cjs +5 -5
- package/dist/vertex_internal/index.cjs.map +1 -1
- package/dist/vertex_internal/index.d.ts +5 -5
- package/dist/vertex_internal/index.js +5 -5
- package/dist/vertex_internal/index.js.map +1 -1
- package/dist/web/index.mjs +15 -27
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +127 -90
- package/package.json +1 -1
package/dist/node/index.cjs
CHANGED
|
@@ -1606,19 +1606,19 @@ exports.ServiceTier = void 0;
|
|
|
1606
1606
|
/**
|
|
1607
1607
|
* Default service tier, which is standard.
|
|
1608
1608
|
*/
|
|
1609
|
-
ServiceTier["
|
|
1609
|
+
ServiceTier["UNSPECIFIED"] = "unspecified";
|
|
1610
1610
|
/**
|
|
1611
1611
|
* Flex service tier.
|
|
1612
1612
|
*/
|
|
1613
|
-
ServiceTier["
|
|
1613
|
+
ServiceTier["FLEX"] = "flex";
|
|
1614
1614
|
/**
|
|
1615
1615
|
* Standard service tier.
|
|
1616
1616
|
*/
|
|
1617
|
-
ServiceTier["
|
|
1617
|
+
ServiceTier["STANDARD"] = "standard";
|
|
1618
1618
|
/**
|
|
1619
1619
|
* Priority service tier.
|
|
1620
1620
|
*/
|
|
1621
|
-
ServiceTier["
|
|
1621
|
+
ServiceTier["PRIORITY"] = "priority";
|
|
1622
1622
|
})(exports.ServiceTier || (exports.ServiceTier = {}));
|
|
1623
1623
|
/** Options for feature selection preference. */
|
|
1624
1624
|
exports.FeatureSelectionPreference = void 0;
|
|
@@ -10117,8 +10117,9 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject, root
|
|
|
10117
10117
|
if (parentObject !== undefined && fromModelArmorConfig != null) {
|
|
10118
10118
|
setValueByPath(parentObject, ['modelArmorConfig'], fromModelArmorConfig);
|
|
10119
10119
|
}
|
|
10120
|
-
|
|
10121
|
-
|
|
10120
|
+
const fromServiceTier = getValueByPath(fromObject, ['serviceTier']);
|
|
10121
|
+
if (parentObject !== undefined && fromServiceTier != null) {
|
|
10122
|
+
setValueByPath(parentObject, ['serviceTier'], fromServiceTier);
|
|
10122
10123
|
}
|
|
10123
10124
|
return toObject;
|
|
10124
10125
|
}
|
|
@@ -12773,7 +12774,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
12773
12774
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
12774
12775
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
12775
12776
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
12776
|
-
const SDK_VERSION = '1.
|
|
12777
|
+
const SDK_VERSION = '1.49.0'; // x-release-please-version
|
|
12777
12778
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
12778
12779
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
12779
12780
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -15338,29 +15339,15 @@ class Models extends BaseModule {
|
|
|
15338
15339
|
/**
|
|
15339
15340
|
* Recontextualizes an image.
|
|
15340
15341
|
*
|
|
15341
|
-
* There
|
|
15342
|
-
* 1)
|
|
15343
|
-
* and contexts.
|
|
15344
|
-
* 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.
|
|
15345
15344
|
*
|
|
15346
15345
|
* @param params - The parameters for recontextualizing an image.
|
|
15347
15346
|
* @return The response from the API.
|
|
15348
15347
|
*
|
|
15349
15348
|
* @example
|
|
15350
15349
|
* ```ts
|
|
15351
|
-
* const
|
|
15352
|
-
* model: 'imagen-product-recontext-preview-06-30',
|
|
15353
|
-
* source: {
|
|
15354
|
-
* prompt: 'In a modern kitchen setting.',
|
|
15355
|
-
* productImages: [productImage],
|
|
15356
|
-
* },
|
|
15357
|
-
* config: {
|
|
15358
|
-
* numberOfImages: 1,
|
|
15359
|
-
* },
|
|
15360
|
-
* });
|
|
15361
|
-
* console.log(response1?.generatedImages?.[0]?.image?.imageBytes);
|
|
15362
|
-
*
|
|
15363
|
-
* const response2 = await ai.models.recontextImage({
|
|
15350
|
+
* const response = await ai.models.recontextImage({
|
|
15364
15351
|
* model: 'virtual-try-on-001',
|
|
15365
15352
|
* source: {
|
|
15366
15353
|
* personImage: personImage,
|
|
@@ -15370,7 +15357,7 @@ class Models extends BaseModule {
|
|
|
15370
15357
|
* numberOfImages: 1,
|
|
15371
15358
|
* },
|
|
15372
15359
|
* });
|
|
15373
|
-
* console.log(
|
|
15360
|
+
* console.log(response?.generatedImages?.[0]?.image?.imageBytes);
|
|
15374
15361
|
* ```
|
|
15375
15362
|
*/
|
|
15376
15363
|
async recontextImage(params) {
|
|
@@ -17950,7 +17937,8 @@ class BaseInteractions extends APIResource {
|
|
|
17950
17937
|
return this._client.delete(path `/${api_version}/interactions/${id}`, options);
|
|
17951
17938
|
}
|
|
17952
17939
|
/**
|
|
17953
|
-
* Cancels an interaction by id. This only applies to background interactions that
|
|
17940
|
+
* Cancels an interaction by id. This only applies to background interactions that
|
|
17941
|
+
* are still running.
|
|
17954
17942
|
*
|
|
17955
17943
|
* @example
|
|
17956
17944
|
* ```ts
|
|
@@ -18806,7 +18794,7 @@ class BaseGeminiNextGenAPIClient {
|
|
|
18806
18794
|
if (this.apiKey) {
|
|
18807
18795
|
return buildHeaders([{ 'x-goog-api-key': this.apiKey }]);
|
|
18808
18796
|
}
|
|
18809
|
-
if (this.clientAdapter.isVertexAI()) {
|
|
18797
|
+
if (this.clientAdapter && this.clientAdapter.isVertexAI()) {
|
|
18810
18798
|
return buildHeaders([await this.clientAdapter.getAuthHeaders()]);
|
|
18811
18799
|
}
|
|
18812
18800
|
return undefined;
|
package/dist/node/index.mjs
CHANGED
|
@@ -1584,19 +1584,19 @@ var ServiceTier;
|
|
|
1584
1584
|
/**
|
|
1585
1585
|
* Default service tier, which is standard.
|
|
1586
1586
|
*/
|
|
1587
|
-
ServiceTier["
|
|
1587
|
+
ServiceTier["UNSPECIFIED"] = "unspecified";
|
|
1588
1588
|
/**
|
|
1589
1589
|
* Flex service tier.
|
|
1590
1590
|
*/
|
|
1591
|
-
ServiceTier["
|
|
1591
|
+
ServiceTier["FLEX"] = "flex";
|
|
1592
1592
|
/**
|
|
1593
1593
|
* Standard service tier.
|
|
1594
1594
|
*/
|
|
1595
|
-
ServiceTier["
|
|
1595
|
+
ServiceTier["STANDARD"] = "standard";
|
|
1596
1596
|
/**
|
|
1597
1597
|
* Priority service tier.
|
|
1598
1598
|
*/
|
|
1599
|
-
ServiceTier["
|
|
1599
|
+
ServiceTier["PRIORITY"] = "priority";
|
|
1600
1600
|
})(ServiceTier || (ServiceTier = {}));
|
|
1601
1601
|
/** Options for feature selection preference. */
|
|
1602
1602
|
var FeatureSelectionPreference;
|
|
@@ -10095,8 +10095,9 @@ function generateContentConfigToVertex(apiClient, fromObject, parentObject, root
|
|
|
10095
10095
|
if (parentObject !== undefined && fromModelArmorConfig != null) {
|
|
10096
10096
|
setValueByPath(parentObject, ['modelArmorConfig'], fromModelArmorConfig);
|
|
10097
10097
|
}
|
|
10098
|
-
|
|
10099
|
-
|
|
10098
|
+
const fromServiceTier = getValueByPath(fromObject, ['serviceTier']);
|
|
10099
|
+
if (parentObject !== undefined && fromServiceTier != null) {
|
|
10100
|
+
setValueByPath(parentObject, ['serviceTier'], fromServiceTier);
|
|
10100
10101
|
}
|
|
10101
10102
|
return toObject;
|
|
10102
10103
|
}
|
|
@@ -12751,7 +12752,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
12751
12752
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
12752
12753
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
12753
12754
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
12754
|
-
const SDK_VERSION = '1.
|
|
12755
|
+
const SDK_VERSION = '1.49.0'; // x-release-please-version
|
|
12755
12756
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
12756
12757
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
12757
12758
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -15316,29 +15317,15 @@ class Models extends BaseModule {
|
|
|
15316
15317
|
/**
|
|
15317
15318
|
* Recontextualizes an image.
|
|
15318
15319
|
*
|
|
15319
|
-
* There
|
|
15320
|
-
* 1)
|
|
15321
|
-
* and contexts.
|
|
15322
|
-
* 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.
|
|
15323
15322
|
*
|
|
15324
15323
|
* @param params - The parameters for recontextualizing an image.
|
|
15325
15324
|
* @return The response from the API.
|
|
15326
15325
|
*
|
|
15327
15326
|
* @example
|
|
15328
15327
|
* ```ts
|
|
15329
|
-
* const
|
|
15330
|
-
* model: 'imagen-product-recontext-preview-06-30',
|
|
15331
|
-
* source: {
|
|
15332
|
-
* prompt: 'In a modern kitchen setting.',
|
|
15333
|
-
* productImages: [productImage],
|
|
15334
|
-
* },
|
|
15335
|
-
* config: {
|
|
15336
|
-
* numberOfImages: 1,
|
|
15337
|
-
* },
|
|
15338
|
-
* });
|
|
15339
|
-
* console.log(response1?.generatedImages?.[0]?.image?.imageBytes);
|
|
15340
|
-
*
|
|
15341
|
-
* const response2 = await ai.models.recontextImage({
|
|
15328
|
+
* const response = await ai.models.recontextImage({
|
|
15342
15329
|
* model: 'virtual-try-on-001',
|
|
15343
15330
|
* source: {
|
|
15344
15331
|
* personImage: personImage,
|
|
@@ -15348,7 +15335,7 @@ class Models extends BaseModule {
|
|
|
15348
15335
|
* numberOfImages: 1,
|
|
15349
15336
|
* },
|
|
15350
15337
|
* });
|
|
15351
|
-
* console.log(
|
|
15338
|
+
* console.log(response?.generatedImages?.[0]?.image?.imageBytes);
|
|
15352
15339
|
* ```
|
|
15353
15340
|
*/
|
|
15354
15341
|
async recontextImage(params) {
|
|
@@ -17928,7 +17915,8 @@ class BaseInteractions extends APIResource {
|
|
|
17928
17915
|
return this._client.delete(path `/${api_version}/interactions/${id}`, options);
|
|
17929
17916
|
}
|
|
17930
17917
|
/**
|
|
17931
|
-
* Cancels an interaction by id. This only applies to background interactions that
|
|
17918
|
+
* Cancels an interaction by id. This only applies to background interactions that
|
|
17919
|
+
* are still running.
|
|
17932
17920
|
*
|
|
17933
17921
|
* @example
|
|
17934
17922
|
* ```ts
|
|
@@ -18784,7 +18772,7 @@ class BaseGeminiNextGenAPIClient {
|
|
|
18784
18772
|
if (this.apiKey) {
|
|
18785
18773
|
return buildHeaders([{ 'x-goog-api-key': this.apiKey }]);
|
|
18786
18774
|
}
|
|
18787
|
-
if (this.clientAdapter.isVertexAI()) {
|
|
18775
|
+
if (this.clientAdapter && this.clientAdapter.isVertexAI()) {
|
|
18788
18776
|
return buildHeaders([await this.clientAdapter.getAuthHeaders()]);
|
|
18789
18777
|
}
|
|
18790
18778
|
return undefined;
|