@google/genai 2.2.0 → 2.4.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/README.md +4 -1
- package/dist/genai.d.ts +384 -35
- package/dist/index.cjs +220 -88
- package/dist/index.mjs +220 -88
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +220 -88
- package/dist/node/index.mjs +220 -88
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +384 -35
- package/dist/tokenizer/node.mjs.map +1 -1
- package/dist/vertex_internal/index.cjs +1 -1
- package/dist/vertex_internal/index.cjs.map +1 -1
- package/dist/vertex_internal/index.d.ts +14 -0
- package/dist/vertex_internal/index.js +1 -1
- package/dist/vertex_internal/index.js.map +1 -1
- package/dist/web/index.mjs +220 -88
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +384 -35
- package/package.json +1 -1
package/dist/web/index.mjs
CHANGED
|
@@ -8232,6 +8232,12 @@ function liveConnectConfigToMldev$1(fromObject, parentObject) {
|
|
|
8232
8232
|
}
|
|
8233
8233
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
8234
8234
|
}
|
|
8235
|
+
const fromStreamTranslationConfig = getValueByPath(fromObject, [
|
|
8236
|
+
'streamTranslationConfig',
|
|
8237
|
+
]);
|
|
8238
|
+
if (parentObject !== undefined && fromStreamTranslationConfig != null) {
|
|
8239
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'streamTranslationConfig'], fromStreamTranslationConfig);
|
|
8240
|
+
}
|
|
8235
8241
|
return toObject;
|
|
8236
8242
|
}
|
|
8237
8243
|
function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
@@ -8364,6 +8370,9 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
|
8364
8370
|
}
|
|
8365
8371
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
8366
8372
|
}
|
|
8373
|
+
if (getValueByPath(fromObject, ['streamTranslationConfig']) !== undefined) {
|
|
8374
|
+
throw new Error('streamTranslationConfig parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
8375
|
+
}
|
|
8367
8376
|
return toObject;
|
|
8368
8377
|
}
|
|
8369
8378
|
function liveConnectParametersToMldev(apiClient, fromObject) {
|
|
@@ -12784,7 +12793,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
12784
12793
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
12785
12794
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
12786
12795
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
12787
|
-
const SDK_VERSION = '2.
|
|
12796
|
+
const SDK_VERSION = '2.4.0'; // x-release-please-version
|
|
12788
12797
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
12789
12798
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
12790
12799
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -16434,6 +16443,12 @@ function liveConnectConfigToMldev(fromObject, parentObject) {
|
|
|
16434
16443
|
}
|
|
16435
16444
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
16436
16445
|
}
|
|
16446
|
+
const fromStreamTranslationConfig = getValueByPath(fromObject, [
|
|
16447
|
+
'streamTranslationConfig',
|
|
16448
|
+
]);
|
|
16449
|
+
if (parentObject !== undefined && fromStreamTranslationConfig != null) {
|
|
16450
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'streamTranslationConfig'], fromStreamTranslationConfig);
|
|
16451
|
+
}
|
|
16437
16452
|
return toObject;
|
|
16438
16453
|
}
|
|
16439
16454
|
function liveConnectConstraintsToMldev(apiClient, fromObject) {
|
|
@@ -17564,7 +17579,9 @@ class APIConnectionError extends APIError {
|
|
|
17564
17579
|
}
|
|
17565
17580
|
class APIConnectionTimeoutError extends APIConnectionError {
|
|
17566
17581
|
constructor({ message } = {}) {
|
|
17567
|
-
super({
|
|
17582
|
+
super({
|
|
17583
|
+
message: message !== null && message !== void 0 ? message : 'Request timed out. This is a client-side timeout. You can increase the timeout by setting the `timeout` argument in your request or client http options.',
|
|
17584
|
+
});
|
|
17568
17585
|
}
|
|
17569
17586
|
}
|
|
17570
17587
|
class BadRequestError extends APIError {
|
|
@@ -17931,6 +17948,126 @@ class APIResource {
|
|
|
17931
17948
|
*/
|
|
17932
17949
|
APIResource._key = [];
|
|
17933
17950
|
|
|
17951
|
+
/**
|
|
17952
|
+
* @license
|
|
17953
|
+
* Copyright 2025 Google LLC
|
|
17954
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
17955
|
+
*/
|
|
17956
|
+
/**
|
|
17957
|
+
* Percent-encode everything that isn't safe to have in a path without encoding safe chars.
|
|
17958
|
+
*
|
|
17959
|
+
* Taken from https://datatracker.ietf.org/doc/html/rfc3986#section-3.3:
|
|
17960
|
+
* > unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
|
|
17961
|
+
* > sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="
|
|
17962
|
+
* > pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
|
|
17963
|
+
*/
|
|
17964
|
+
function encodeURIPath(str) {
|
|
17965
|
+
return str.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g, encodeURIComponent);
|
|
17966
|
+
}
|
|
17967
|
+
const EMPTY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.create(null));
|
|
17968
|
+
const createPathTagFunction = (pathEncoder = encodeURIPath) => (function path(statics, ...params) {
|
|
17969
|
+
// If there are no params, no processing is needed.
|
|
17970
|
+
if (statics.length === 1)
|
|
17971
|
+
return statics[0];
|
|
17972
|
+
let postPath = false;
|
|
17973
|
+
const invalidSegments = [];
|
|
17974
|
+
const path = statics.reduce((previousValue, currentValue, index) => {
|
|
17975
|
+
var _a, _b, _c;
|
|
17976
|
+
if (/[?#]/.test(currentValue)) {
|
|
17977
|
+
postPath = true;
|
|
17978
|
+
}
|
|
17979
|
+
const value = params[index];
|
|
17980
|
+
let encoded = (postPath ? encodeURIComponent : pathEncoder)('' + value);
|
|
17981
|
+
if (index !== params.length &&
|
|
17982
|
+
(value == null ||
|
|
17983
|
+
(typeof value === 'object' &&
|
|
17984
|
+
// handle values from other realms
|
|
17985
|
+
value.toString ===
|
|
17986
|
+
((_c = Object.getPrototypeOf((_b = Object.getPrototypeOf((_a = value.hasOwnProperty) !== null && _a !== void 0 ? _a : EMPTY)) !== null && _b !== void 0 ? _b : EMPTY)) === null || _c === void 0 ? void 0 : _c.toString)))) {
|
|
17987
|
+
encoded = value + '';
|
|
17988
|
+
invalidSegments.push({
|
|
17989
|
+
start: previousValue.length + currentValue.length,
|
|
17990
|
+
length: encoded.length,
|
|
17991
|
+
error: `Value of type ${Object.prototype.toString
|
|
17992
|
+
.call(value)
|
|
17993
|
+
.slice(8, -1)} is not a valid path parameter`,
|
|
17994
|
+
});
|
|
17995
|
+
}
|
|
17996
|
+
return previousValue + currentValue + (index === params.length ? '' : encoded);
|
|
17997
|
+
}, '');
|
|
17998
|
+
const pathOnly = path.split(/[?#]/, 1)[0];
|
|
17999
|
+
const invalidSegmentPattern = /(^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi;
|
|
18000
|
+
let match;
|
|
18001
|
+
// Find all invalid segments
|
|
18002
|
+
while ((match = invalidSegmentPattern.exec(pathOnly)) !== null) {
|
|
18003
|
+
const hasLeadingSlash = match[0].startsWith('/');
|
|
18004
|
+
const offset = hasLeadingSlash ? 1 : 0;
|
|
18005
|
+
const cleanMatch = hasLeadingSlash ? match[0].slice(1) : match[0];
|
|
18006
|
+
invalidSegments.push({
|
|
18007
|
+
start: match.index + offset,
|
|
18008
|
+
length: cleanMatch.length,
|
|
18009
|
+
error: `Value "${cleanMatch}" can\'t be safely passed as a path parameter`,
|
|
18010
|
+
});
|
|
18011
|
+
}
|
|
18012
|
+
invalidSegments.sort((a, b) => a.start - b.start);
|
|
18013
|
+
if (invalidSegments.length > 0) {
|
|
18014
|
+
let lastEnd = 0;
|
|
18015
|
+
const underline = invalidSegments.reduce((acc, segment) => {
|
|
18016
|
+
const spaces = ' '.repeat(segment.start - lastEnd);
|
|
18017
|
+
const arrows = '^'.repeat(segment.length);
|
|
18018
|
+
lastEnd = segment.start + segment.length;
|
|
18019
|
+
return acc + spaces + arrows;
|
|
18020
|
+
}, '');
|
|
18021
|
+
throw new GeminiNextGenAPIClientError(`Path parameters result in path with invalid segments:\n${invalidSegments
|
|
18022
|
+
.map((e) => e.error)
|
|
18023
|
+
.join('\n')}\n${path}\n${underline}`);
|
|
18024
|
+
}
|
|
18025
|
+
return path;
|
|
18026
|
+
});
|
|
18027
|
+
/**
|
|
18028
|
+
* URI-encodes path params and ensures no unsafe /./ or /../ path segments are introduced.
|
|
18029
|
+
*/
|
|
18030
|
+
const path = /* @__PURE__ */ createPathTagFunction(encodeURIPath);
|
|
18031
|
+
|
|
18032
|
+
/**
|
|
18033
|
+
* @license
|
|
18034
|
+
* Copyright 2025 Google LLC
|
|
18035
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
18036
|
+
*/
|
|
18037
|
+
class BaseAgents extends APIResource {
|
|
18038
|
+
/**
|
|
18039
|
+
* Creates a new Agent (Typed version for SDK).
|
|
18040
|
+
*/
|
|
18041
|
+
create(params = {}, options) {
|
|
18042
|
+
const _a = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion } = _a, body = __rest(_a, ["api_version"]);
|
|
18043
|
+
return this._client.post(path `/${api_version}/agents`, Object.assign({ body }, options));
|
|
18044
|
+
}
|
|
18045
|
+
/**
|
|
18046
|
+
* Lists all Agents.
|
|
18047
|
+
*/
|
|
18048
|
+
list(params = {}, options) {
|
|
18049
|
+
const _a = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion } = _a, query = __rest(_a, ["api_version"]);
|
|
18050
|
+
return this._client.get(path `/${api_version}/agents`, Object.assign({ query }, options));
|
|
18051
|
+
}
|
|
18052
|
+
/**
|
|
18053
|
+
* Deletes an Agent.
|
|
18054
|
+
*/
|
|
18055
|
+
delete(id, params = {}, options) {
|
|
18056
|
+
const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
|
|
18057
|
+
return this._client.delete(path `/${api_version}/agents/${id}`, options);
|
|
18058
|
+
}
|
|
18059
|
+
/**
|
|
18060
|
+
* Gets a specific Agent.
|
|
18061
|
+
*/
|
|
18062
|
+
get(id, params = {}, options) {
|
|
18063
|
+
const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
|
|
18064
|
+
return this._client.get(path `/${api_version}/agents/${id}`, options);
|
|
18065
|
+
}
|
|
18066
|
+
}
|
|
18067
|
+
BaseAgents._key = Object.freeze(['agents']);
|
|
18068
|
+
class Agents extends BaseAgents {
|
|
18069
|
+
}
|
|
18070
|
+
|
|
17934
18071
|
/**
|
|
17935
18072
|
* @license
|
|
17936
18073
|
* Copyright 2025 Google LLC
|
|
@@ -18592,87 +18729,6 @@ class LegacyLyriaStream extends Stream {
|
|
|
18592
18729
|
}
|
|
18593
18730
|
}
|
|
18594
18731
|
|
|
18595
|
-
/**
|
|
18596
|
-
* @license
|
|
18597
|
-
* Copyright 2025 Google LLC
|
|
18598
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
18599
|
-
*/
|
|
18600
|
-
/**
|
|
18601
|
-
* Percent-encode everything that isn't safe to have in a path without encoding safe chars.
|
|
18602
|
-
*
|
|
18603
|
-
* Taken from https://datatracker.ietf.org/doc/html/rfc3986#section-3.3:
|
|
18604
|
-
* > unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
|
|
18605
|
-
* > sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="
|
|
18606
|
-
* > pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
|
|
18607
|
-
*/
|
|
18608
|
-
function encodeURIPath(str) {
|
|
18609
|
-
return str.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g, encodeURIComponent);
|
|
18610
|
-
}
|
|
18611
|
-
const EMPTY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.create(null));
|
|
18612
|
-
const createPathTagFunction = (pathEncoder = encodeURIPath) => (function path(statics, ...params) {
|
|
18613
|
-
// If there are no params, no processing is needed.
|
|
18614
|
-
if (statics.length === 1)
|
|
18615
|
-
return statics[0];
|
|
18616
|
-
let postPath = false;
|
|
18617
|
-
const invalidSegments = [];
|
|
18618
|
-
const path = statics.reduce((previousValue, currentValue, index) => {
|
|
18619
|
-
var _a, _b, _c;
|
|
18620
|
-
if (/[?#]/.test(currentValue)) {
|
|
18621
|
-
postPath = true;
|
|
18622
|
-
}
|
|
18623
|
-
const value = params[index];
|
|
18624
|
-
let encoded = (postPath ? encodeURIComponent : pathEncoder)('' + value);
|
|
18625
|
-
if (index !== params.length &&
|
|
18626
|
-
(value == null ||
|
|
18627
|
-
(typeof value === 'object' &&
|
|
18628
|
-
// handle values from other realms
|
|
18629
|
-
value.toString ===
|
|
18630
|
-
((_c = Object.getPrototypeOf((_b = Object.getPrototypeOf((_a = value.hasOwnProperty) !== null && _a !== void 0 ? _a : EMPTY)) !== null && _b !== void 0 ? _b : EMPTY)) === null || _c === void 0 ? void 0 : _c.toString)))) {
|
|
18631
|
-
encoded = value + '';
|
|
18632
|
-
invalidSegments.push({
|
|
18633
|
-
start: previousValue.length + currentValue.length,
|
|
18634
|
-
length: encoded.length,
|
|
18635
|
-
error: `Value of type ${Object.prototype.toString
|
|
18636
|
-
.call(value)
|
|
18637
|
-
.slice(8, -1)} is not a valid path parameter`,
|
|
18638
|
-
});
|
|
18639
|
-
}
|
|
18640
|
-
return previousValue + currentValue + (index === params.length ? '' : encoded);
|
|
18641
|
-
}, '');
|
|
18642
|
-
const pathOnly = path.split(/[?#]/, 1)[0];
|
|
18643
|
-
const invalidSegmentPattern = /(^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi;
|
|
18644
|
-
let match;
|
|
18645
|
-
// Find all invalid segments
|
|
18646
|
-
while ((match = invalidSegmentPattern.exec(pathOnly)) !== null) {
|
|
18647
|
-
const hasLeadingSlash = match[0].startsWith('/');
|
|
18648
|
-
const offset = hasLeadingSlash ? 1 : 0;
|
|
18649
|
-
const cleanMatch = hasLeadingSlash ? match[0].slice(1) : match[0];
|
|
18650
|
-
invalidSegments.push({
|
|
18651
|
-
start: match.index + offset,
|
|
18652
|
-
length: cleanMatch.length,
|
|
18653
|
-
error: `Value "${cleanMatch}" can\'t be safely passed as a path parameter`,
|
|
18654
|
-
});
|
|
18655
|
-
}
|
|
18656
|
-
invalidSegments.sort((a, b) => a.start - b.start);
|
|
18657
|
-
if (invalidSegments.length > 0) {
|
|
18658
|
-
let lastEnd = 0;
|
|
18659
|
-
const underline = invalidSegments.reduce((acc, segment) => {
|
|
18660
|
-
const spaces = ' '.repeat(segment.start - lastEnd);
|
|
18661
|
-
const arrows = '^'.repeat(segment.length);
|
|
18662
|
-
lastEnd = segment.start + segment.length;
|
|
18663
|
-
return acc + spaces + arrows;
|
|
18664
|
-
}, '');
|
|
18665
|
-
throw new GeminiNextGenAPIClientError(`Path parameters result in path with invalid segments:\n${invalidSegments
|
|
18666
|
-
.map((e) => e.error)
|
|
18667
|
-
.join('\n')}\n${path}\n${underline}`);
|
|
18668
|
-
}
|
|
18669
|
-
return path;
|
|
18670
|
-
});
|
|
18671
|
-
/**
|
|
18672
|
-
* URI-encodes path params and ensures no unsafe /./ or /../ path segments are introduced.
|
|
18673
|
-
*/
|
|
18674
|
-
const path = /* @__PURE__ */ createPathTagFunction(encodeURIPath);
|
|
18675
|
-
|
|
18676
18732
|
/**
|
|
18677
18733
|
* @license
|
|
18678
18734
|
* Copyright 2025 Google LLC
|
|
@@ -18694,10 +18750,14 @@ class BaseInteractions extends APIResource {
|
|
|
18694
18750
|
});
|
|
18695
18751
|
const isStreaming = (_a = params.stream) !== null && _a !== void 0 ? _a : false;
|
|
18696
18752
|
const promise = this._client.post(path `/${api_version}/interactions`, Object.assign(Object.assign(Object.assign({ body }, options), { stream: isStreaming }), (needsLegacyLyriaShim && isStreaming ? { __streamClass: LegacyLyriaStream } : {})));
|
|
18697
|
-
if (
|
|
18698
|
-
return promise
|
|
18753
|
+
if (isStreaming) {
|
|
18754
|
+
return promise;
|
|
18755
|
+
}
|
|
18756
|
+
let nonStreaming = promise;
|
|
18757
|
+
if (needsLegacyLyriaShim) {
|
|
18758
|
+
nonStreaming = nonStreaming._thenUnwrap((data) => coerceLegacyInteractionResponse(data));
|
|
18699
18759
|
}
|
|
18700
|
-
return
|
|
18760
|
+
return nonStreaming._thenUnwrap(addOutputProperties);
|
|
18701
18761
|
}
|
|
18702
18762
|
/**
|
|
18703
18763
|
* Deletes the interaction by id.
|
|
@@ -18726,17 +18786,78 @@ class BaseInteractions extends APIResource {
|
|
|
18726
18786
|
*/
|
|
18727
18787
|
cancel(id, params = {}, options) {
|
|
18728
18788
|
const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
|
|
18729
|
-
return this._client.post(path `/${api_version}/interactions/${id}/cancel`, options);
|
|
18789
|
+
return this._client.post(path `/${api_version}/interactions/${id}/cancel`, options)._thenUnwrap(addOutputProperties);
|
|
18730
18790
|
}
|
|
18731
18791
|
get(id, params = {}, options) {
|
|
18732
18792
|
var _a;
|
|
18733
18793
|
const _b = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion } = _b, query = __rest(_b, ["api_version"]);
|
|
18734
|
-
|
|
18794
|
+
const response = this._client.get(path `/${api_version}/interactions/${id}`, Object.assign(Object.assign({ query }, options), { stream: (_a = params === null || params === void 0 ? void 0 : params.stream) !== null && _a !== void 0 ? _a : false }));
|
|
18795
|
+
if (params === null || params === void 0 ? void 0 : params.stream) {
|
|
18796
|
+
return response;
|
|
18797
|
+
}
|
|
18798
|
+
return response._thenUnwrap(addOutputProperties);
|
|
18735
18799
|
}
|
|
18736
18800
|
}
|
|
18737
18801
|
BaseInteractions._key = Object.freeze(['interactions']);
|
|
18738
18802
|
class Interactions extends BaseInteractions {
|
|
18739
18803
|
}
|
|
18804
|
+
function addOutputProperties(interaction) {
|
|
18805
|
+
var _a, _b;
|
|
18806
|
+
const steps = (_a = interaction.steps) !== null && _a !== void 0 ? _a : [];
|
|
18807
|
+
// output_text: scan backwards across all steps (stopping at user_input),
|
|
18808
|
+
// skip non-text content until the first text item is found, then collect
|
|
18809
|
+
// text until a non-text barrier is hit.
|
|
18810
|
+
const textParts = [];
|
|
18811
|
+
let collecting = false;
|
|
18812
|
+
outer: for (let i = steps.length - 1; i >= 0; i--) {
|
|
18813
|
+
const step = steps[i];
|
|
18814
|
+
if (step.type === 'user_input')
|
|
18815
|
+
break;
|
|
18816
|
+
if (step.type !== 'model_output' || !step.content) {
|
|
18817
|
+
if (collecting)
|
|
18818
|
+
break outer;
|
|
18819
|
+
continue;
|
|
18820
|
+
}
|
|
18821
|
+
const content = step.content;
|
|
18822
|
+
for (let j = content.length - 1; j >= 0; j--) {
|
|
18823
|
+
const item = content[j];
|
|
18824
|
+
if (item.type === 'text') {
|
|
18825
|
+
collecting = true;
|
|
18826
|
+
textParts.push((_b = item.text) !== null && _b !== void 0 ? _b : '');
|
|
18827
|
+
}
|
|
18828
|
+
else if (collecting) {
|
|
18829
|
+
// Hit a non-text barrier after we started collecting.
|
|
18830
|
+
break outer;
|
|
18831
|
+
}
|
|
18832
|
+
}
|
|
18833
|
+
}
|
|
18834
|
+
const output_text = textParts.reverse().join('');
|
|
18835
|
+
let output_image;
|
|
18836
|
+
let output_audio;
|
|
18837
|
+
let output_video;
|
|
18838
|
+
for (let i = steps.length - 1; i >= 0; i--) {
|
|
18839
|
+
const step = steps[i];
|
|
18840
|
+
const anyStep = step;
|
|
18841
|
+
if (anyStep.type === 'user_input') {
|
|
18842
|
+
break;
|
|
18843
|
+
}
|
|
18844
|
+
if (anyStep.type === 'model_output' && anyStep.content) {
|
|
18845
|
+
for (let j = anyStep.content.length - 1; j >= 0; j--) {
|
|
18846
|
+
const content = anyStep.content[j];
|
|
18847
|
+
if (content.type === 'image' && !output_image) {
|
|
18848
|
+
output_image = content;
|
|
18849
|
+
}
|
|
18850
|
+
if (content.type === 'audio' && !output_audio) {
|
|
18851
|
+
output_audio = content;
|
|
18852
|
+
}
|
|
18853
|
+
if (content.type === 'video' && !output_video) {
|
|
18854
|
+
output_video = content;
|
|
18855
|
+
}
|
|
18856
|
+
}
|
|
18857
|
+
}
|
|
18858
|
+
}
|
|
18859
|
+
return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, interaction), (output_text && { output_text })), (output_image && { output_image })), (output_audio && { output_audio })), (output_video && { output_video }));
|
|
18860
|
+
}
|
|
18740
18861
|
|
|
18741
18862
|
/**
|
|
18742
18863
|
* @license
|
|
@@ -19451,6 +19572,7 @@ class GeminiNextGenAPIClient extends BaseGeminiNextGenAPIClient {
|
|
|
19451
19572
|
super(...arguments);
|
|
19452
19573
|
this.interactions = new Interactions(this);
|
|
19453
19574
|
this.webhooks = new Webhooks(this);
|
|
19575
|
+
this.agents = new Agents(this);
|
|
19454
19576
|
}
|
|
19455
19577
|
}
|
|
19456
19578
|
_a = GeminiNextGenAPIClient;
|
|
@@ -19471,6 +19593,7 @@ GeminiNextGenAPIClient.UnprocessableEntityError = UnprocessableEntityError;
|
|
|
19471
19593
|
GeminiNextGenAPIClient.toFile = toFile;
|
|
19472
19594
|
GeminiNextGenAPIClient.Interactions = Interactions;
|
|
19473
19595
|
GeminiNextGenAPIClient.Webhooks = Webhooks;
|
|
19596
|
+
GeminiNextGenAPIClient.Agents = Agents;
|
|
19474
19597
|
|
|
19475
19598
|
/**
|
|
19476
19599
|
* @license
|
|
@@ -20918,6 +21041,7 @@ class GoogleGenAI {
|
|
|
20918
21041
|
if (this._interactions !== undefined) {
|
|
20919
21042
|
return this._interactions;
|
|
20920
21043
|
}
|
|
21044
|
+
console.warn('GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.');
|
|
20921
21045
|
this._interactions = this.getNextGenClient().interactions;
|
|
20922
21046
|
return this._interactions;
|
|
20923
21047
|
}
|
|
@@ -20928,6 +21052,14 @@ class GoogleGenAI {
|
|
|
20928
21052
|
this._webhooks = this.getNextGenClient().webhooks;
|
|
20929
21053
|
return this._webhooks;
|
|
20930
21054
|
}
|
|
21055
|
+
get agents() {
|
|
21056
|
+
if (this._agents !== undefined) {
|
|
21057
|
+
return this._agents;
|
|
21058
|
+
}
|
|
21059
|
+
console.warn('GoogleGenAI.agents: Agents usage is experimental and may change in future versions.');
|
|
21060
|
+
this._agents = this.getNextGenClient().agents;
|
|
21061
|
+
return this._agents;
|
|
21062
|
+
}
|
|
20931
21063
|
constructor(options) {
|
|
20932
21064
|
var _a;
|
|
20933
21065
|
if (options.apiKey == null) {
|