@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/node/index.mjs
CHANGED
|
@@ -8240,6 +8240,12 @@ function liveConnectConfigToMldev$1(fromObject, parentObject) {
|
|
|
8240
8240
|
}
|
|
8241
8241
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
8242
8242
|
}
|
|
8243
|
+
const fromStreamTranslationConfig = getValueByPath(fromObject, [
|
|
8244
|
+
'streamTranslationConfig',
|
|
8245
|
+
]);
|
|
8246
|
+
if (parentObject !== undefined && fromStreamTranslationConfig != null) {
|
|
8247
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'streamTranslationConfig'], fromStreamTranslationConfig);
|
|
8248
|
+
}
|
|
8243
8249
|
return toObject;
|
|
8244
8250
|
}
|
|
8245
8251
|
function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
@@ -8372,6 +8378,9 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
|
8372
8378
|
}
|
|
8373
8379
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
8374
8380
|
}
|
|
8381
|
+
if (getValueByPath(fromObject, ['streamTranslationConfig']) !== undefined) {
|
|
8382
|
+
throw new Error('streamTranslationConfig parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
8383
|
+
}
|
|
8375
8384
|
return toObject;
|
|
8376
8385
|
}
|
|
8377
8386
|
function liveConnectParametersToMldev(apiClient, fromObject) {
|
|
@@ -12792,7 +12801,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
12792
12801
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
12793
12802
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
12794
12803
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
12795
|
-
const SDK_VERSION = '2.
|
|
12804
|
+
const SDK_VERSION = '2.4.0'; // x-release-please-version
|
|
12796
12805
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
12797
12806
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
12798
12807
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -16442,6 +16451,12 @@ function liveConnectConfigToMldev(fromObject, parentObject) {
|
|
|
16442
16451
|
}
|
|
16443
16452
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
16444
16453
|
}
|
|
16454
|
+
const fromStreamTranslationConfig = getValueByPath(fromObject, [
|
|
16455
|
+
'streamTranslationConfig',
|
|
16456
|
+
]);
|
|
16457
|
+
if (parentObject !== undefined && fromStreamTranslationConfig != null) {
|
|
16458
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'streamTranslationConfig'], fromStreamTranslationConfig);
|
|
16459
|
+
}
|
|
16445
16460
|
return toObject;
|
|
16446
16461
|
}
|
|
16447
16462
|
function liveConnectConstraintsToMldev(apiClient, fromObject) {
|
|
@@ -17572,7 +17587,9 @@ class APIConnectionError extends APIError {
|
|
|
17572
17587
|
}
|
|
17573
17588
|
class APIConnectionTimeoutError extends APIConnectionError {
|
|
17574
17589
|
constructor({ message } = {}) {
|
|
17575
|
-
super({
|
|
17590
|
+
super({
|
|
17591
|
+
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.',
|
|
17592
|
+
});
|
|
17576
17593
|
}
|
|
17577
17594
|
}
|
|
17578
17595
|
class BadRequestError extends APIError {
|
|
@@ -17939,6 +17956,126 @@ class APIResource {
|
|
|
17939
17956
|
*/
|
|
17940
17957
|
APIResource._key = [];
|
|
17941
17958
|
|
|
17959
|
+
/**
|
|
17960
|
+
* @license
|
|
17961
|
+
* Copyright 2025 Google LLC
|
|
17962
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
17963
|
+
*/
|
|
17964
|
+
/**
|
|
17965
|
+
* Percent-encode everything that isn't safe to have in a path without encoding safe chars.
|
|
17966
|
+
*
|
|
17967
|
+
* Taken from https://datatracker.ietf.org/doc/html/rfc3986#section-3.3:
|
|
17968
|
+
* > unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
|
|
17969
|
+
* > sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="
|
|
17970
|
+
* > pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
|
|
17971
|
+
*/
|
|
17972
|
+
function encodeURIPath(str) {
|
|
17973
|
+
return str.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g, encodeURIComponent);
|
|
17974
|
+
}
|
|
17975
|
+
const EMPTY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.create(null));
|
|
17976
|
+
const createPathTagFunction = (pathEncoder = encodeURIPath) => (function path(statics, ...params) {
|
|
17977
|
+
// If there are no params, no processing is needed.
|
|
17978
|
+
if (statics.length === 1)
|
|
17979
|
+
return statics[0];
|
|
17980
|
+
let postPath = false;
|
|
17981
|
+
const invalidSegments = [];
|
|
17982
|
+
const path = statics.reduce((previousValue, currentValue, index) => {
|
|
17983
|
+
var _a, _b, _c;
|
|
17984
|
+
if (/[?#]/.test(currentValue)) {
|
|
17985
|
+
postPath = true;
|
|
17986
|
+
}
|
|
17987
|
+
const value = params[index];
|
|
17988
|
+
let encoded = (postPath ? encodeURIComponent : pathEncoder)('' + value);
|
|
17989
|
+
if (index !== params.length &&
|
|
17990
|
+
(value == null ||
|
|
17991
|
+
(typeof value === 'object' &&
|
|
17992
|
+
// handle values from other realms
|
|
17993
|
+
value.toString ===
|
|
17994
|
+
((_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)))) {
|
|
17995
|
+
encoded = value + '';
|
|
17996
|
+
invalidSegments.push({
|
|
17997
|
+
start: previousValue.length + currentValue.length,
|
|
17998
|
+
length: encoded.length,
|
|
17999
|
+
error: `Value of type ${Object.prototype.toString
|
|
18000
|
+
.call(value)
|
|
18001
|
+
.slice(8, -1)} is not a valid path parameter`,
|
|
18002
|
+
});
|
|
18003
|
+
}
|
|
18004
|
+
return previousValue + currentValue + (index === params.length ? '' : encoded);
|
|
18005
|
+
}, '');
|
|
18006
|
+
const pathOnly = path.split(/[?#]/, 1)[0];
|
|
18007
|
+
const invalidSegmentPattern = /(^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi;
|
|
18008
|
+
let match;
|
|
18009
|
+
// Find all invalid segments
|
|
18010
|
+
while ((match = invalidSegmentPattern.exec(pathOnly)) !== null) {
|
|
18011
|
+
const hasLeadingSlash = match[0].startsWith('/');
|
|
18012
|
+
const offset = hasLeadingSlash ? 1 : 0;
|
|
18013
|
+
const cleanMatch = hasLeadingSlash ? match[0].slice(1) : match[0];
|
|
18014
|
+
invalidSegments.push({
|
|
18015
|
+
start: match.index + offset,
|
|
18016
|
+
length: cleanMatch.length,
|
|
18017
|
+
error: `Value "${cleanMatch}" can\'t be safely passed as a path parameter`,
|
|
18018
|
+
});
|
|
18019
|
+
}
|
|
18020
|
+
invalidSegments.sort((a, b) => a.start - b.start);
|
|
18021
|
+
if (invalidSegments.length > 0) {
|
|
18022
|
+
let lastEnd = 0;
|
|
18023
|
+
const underline = invalidSegments.reduce((acc, segment) => {
|
|
18024
|
+
const spaces = ' '.repeat(segment.start - lastEnd);
|
|
18025
|
+
const arrows = '^'.repeat(segment.length);
|
|
18026
|
+
lastEnd = segment.start + segment.length;
|
|
18027
|
+
return acc + spaces + arrows;
|
|
18028
|
+
}, '');
|
|
18029
|
+
throw new GeminiNextGenAPIClientError(`Path parameters result in path with invalid segments:\n${invalidSegments
|
|
18030
|
+
.map((e) => e.error)
|
|
18031
|
+
.join('\n')}\n${path}\n${underline}`);
|
|
18032
|
+
}
|
|
18033
|
+
return path;
|
|
18034
|
+
});
|
|
18035
|
+
/**
|
|
18036
|
+
* URI-encodes path params and ensures no unsafe /./ or /../ path segments are introduced.
|
|
18037
|
+
*/
|
|
18038
|
+
const path = /* @__PURE__ */ createPathTagFunction(encodeURIPath);
|
|
18039
|
+
|
|
18040
|
+
/**
|
|
18041
|
+
* @license
|
|
18042
|
+
* Copyright 2025 Google LLC
|
|
18043
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
18044
|
+
*/
|
|
18045
|
+
class BaseAgents extends APIResource {
|
|
18046
|
+
/**
|
|
18047
|
+
* Creates a new Agent (Typed version for SDK).
|
|
18048
|
+
*/
|
|
18049
|
+
create(params = {}, options) {
|
|
18050
|
+
const _a = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion } = _a, body = __rest(_a, ["api_version"]);
|
|
18051
|
+
return this._client.post(path `/${api_version}/agents`, Object.assign({ body }, options));
|
|
18052
|
+
}
|
|
18053
|
+
/**
|
|
18054
|
+
* Lists all Agents.
|
|
18055
|
+
*/
|
|
18056
|
+
list(params = {}, options) {
|
|
18057
|
+
const _a = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion } = _a, query = __rest(_a, ["api_version"]);
|
|
18058
|
+
return this._client.get(path `/${api_version}/agents`, Object.assign({ query }, options));
|
|
18059
|
+
}
|
|
18060
|
+
/**
|
|
18061
|
+
* Deletes an Agent.
|
|
18062
|
+
*/
|
|
18063
|
+
delete(id, params = {}, options) {
|
|
18064
|
+
const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
|
|
18065
|
+
return this._client.delete(path `/${api_version}/agents/${id}`, options);
|
|
18066
|
+
}
|
|
18067
|
+
/**
|
|
18068
|
+
* Gets a specific Agent.
|
|
18069
|
+
*/
|
|
18070
|
+
get(id, params = {}, options) {
|
|
18071
|
+
const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
|
|
18072
|
+
return this._client.get(path `/${api_version}/agents/${id}`, options);
|
|
18073
|
+
}
|
|
18074
|
+
}
|
|
18075
|
+
BaseAgents._key = Object.freeze(['agents']);
|
|
18076
|
+
class Agents extends BaseAgents {
|
|
18077
|
+
}
|
|
18078
|
+
|
|
17942
18079
|
/**
|
|
17943
18080
|
* @license
|
|
17944
18081
|
* Copyright 2025 Google LLC
|
|
@@ -18600,87 +18737,6 @@ class LegacyLyriaStream extends Stream {
|
|
|
18600
18737
|
}
|
|
18601
18738
|
}
|
|
18602
18739
|
|
|
18603
|
-
/**
|
|
18604
|
-
* @license
|
|
18605
|
-
* Copyright 2025 Google LLC
|
|
18606
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
18607
|
-
*/
|
|
18608
|
-
/**
|
|
18609
|
-
* Percent-encode everything that isn't safe to have in a path without encoding safe chars.
|
|
18610
|
-
*
|
|
18611
|
-
* Taken from https://datatracker.ietf.org/doc/html/rfc3986#section-3.3:
|
|
18612
|
-
* > unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
|
|
18613
|
-
* > sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="
|
|
18614
|
-
* > pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
|
|
18615
|
-
*/
|
|
18616
|
-
function encodeURIPath(str) {
|
|
18617
|
-
return str.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g, encodeURIComponent);
|
|
18618
|
-
}
|
|
18619
|
-
const EMPTY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.create(null));
|
|
18620
|
-
const createPathTagFunction = (pathEncoder = encodeURIPath) => (function path(statics, ...params) {
|
|
18621
|
-
// If there are no params, no processing is needed.
|
|
18622
|
-
if (statics.length === 1)
|
|
18623
|
-
return statics[0];
|
|
18624
|
-
let postPath = false;
|
|
18625
|
-
const invalidSegments = [];
|
|
18626
|
-
const path = statics.reduce((previousValue, currentValue, index) => {
|
|
18627
|
-
var _a, _b, _c;
|
|
18628
|
-
if (/[?#]/.test(currentValue)) {
|
|
18629
|
-
postPath = true;
|
|
18630
|
-
}
|
|
18631
|
-
const value = params[index];
|
|
18632
|
-
let encoded = (postPath ? encodeURIComponent : pathEncoder)('' + value);
|
|
18633
|
-
if (index !== params.length &&
|
|
18634
|
-
(value == null ||
|
|
18635
|
-
(typeof value === 'object' &&
|
|
18636
|
-
// handle values from other realms
|
|
18637
|
-
value.toString ===
|
|
18638
|
-
((_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)))) {
|
|
18639
|
-
encoded = value + '';
|
|
18640
|
-
invalidSegments.push({
|
|
18641
|
-
start: previousValue.length + currentValue.length,
|
|
18642
|
-
length: encoded.length,
|
|
18643
|
-
error: `Value of type ${Object.prototype.toString
|
|
18644
|
-
.call(value)
|
|
18645
|
-
.slice(8, -1)} is not a valid path parameter`,
|
|
18646
|
-
});
|
|
18647
|
-
}
|
|
18648
|
-
return previousValue + currentValue + (index === params.length ? '' : encoded);
|
|
18649
|
-
}, '');
|
|
18650
|
-
const pathOnly = path.split(/[?#]/, 1)[0];
|
|
18651
|
-
const invalidSegmentPattern = /(^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi;
|
|
18652
|
-
let match;
|
|
18653
|
-
// Find all invalid segments
|
|
18654
|
-
while ((match = invalidSegmentPattern.exec(pathOnly)) !== null) {
|
|
18655
|
-
const hasLeadingSlash = match[0].startsWith('/');
|
|
18656
|
-
const offset = hasLeadingSlash ? 1 : 0;
|
|
18657
|
-
const cleanMatch = hasLeadingSlash ? match[0].slice(1) : match[0];
|
|
18658
|
-
invalidSegments.push({
|
|
18659
|
-
start: match.index + offset,
|
|
18660
|
-
length: cleanMatch.length,
|
|
18661
|
-
error: `Value "${cleanMatch}" can\'t be safely passed as a path parameter`,
|
|
18662
|
-
});
|
|
18663
|
-
}
|
|
18664
|
-
invalidSegments.sort((a, b) => a.start - b.start);
|
|
18665
|
-
if (invalidSegments.length > 0) {
|
|
18666
|
-
let lastEnd = 0;
|
|
18667
|
-
const underline = invalidSegments.reduce((acc, segment) => {
|
|
18668
|
-
const spaces = ' '.repeat(segment.start - lastEnd);
|
|
18669
|
-
const arrows = '^'.repeat(segment.length);
|
|
18670
|
-
lastEnd = segment.start + segment.length;
|
|
18671
|
-
return acc + spaces + arrows;
|
|
18672
|
-
}, '');
|
|
18673
|
-
throw new GeminiNextGenAPIClientError(`Path parameters result in path with invalid segments:\n${invalidSegments
|
|
18674
|
-
.map((e) => e.error)
|
|
18675
|
-
.join('\n')}\n${path}\n${underline}`);
|
|
18676
|
-
}
|
|
18677
|
-
return path;
|
|
18678
|
-
});
|
|
18679
|
-
/**
|
|
18680
|
-
* URI-encodes path params and ensures no unsafe /./ or /../ path segments are introduced.
|
|
18681
|
-
*/
|
|
18682
|
-
const path = /* @__PURE__ */ createPathTagFunction(encodeURIPath);
|
|
18683
|
-
|
|
18684
18740
|
/**
|
|
18685
18741
|
* @license
|
|
18686
18742
|
* Copyright 2025 Google LLC
|
|
@@ -18702,10 +18758,14 @@ class BaseInteractions extends APIResource {
|
|
|
18702
18758
|
});
|
|
18703
18759
|
const isStreaming = (_a = params.stream) !== null && _a !== void 0 ? _a : false;
|
|
18704
18760
|
const promise = this._client.post(path `/${api_version}/interactions`, Object.assign(Object.assign(Object.assign({ body }, options), { stream: isStreaming }), (needsLegacyLyriaShim && isStreaming ? { __streamClass: LegacyLyriaStream } : {})));
|
|
18705
|
-
if (
|
|
18706
|
-
return promise
|
|
18761
|
+
if (isStreaming) {
|
|
18762
|
+
return promise;
|
|
18763
|
+
}
|
|
18764
|
+
let nonStreaming = promise;
|
|
18765
|
+
if (needsLegacyLyriaShim) {
|
|
18766
|
+
nonStreaming = nonStreaming._thenUnwrap((data) => coerceLegacyInteractionResponse(data));
|
|
18707
18767
|
}
|
|
18708
|
-
return
|
|
18768
|
+
return nonStreaming._thenUnwrap(addOutputProperties);
|
|
18709
18769
|
}
|
|
18710
18770
|
/**
|
|
18711
18771
|
* Deletes the interaction by id.
|
|
@@ -18734,17 +18794,78 @@ class BaseInteractions extends APIResource {
|
|
|
18734
18794
|
*/
|
|
18735
18795
|
cancel(id, params = {}, options) {
|
|
18736
18796
|
const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
|
|
18737
|
-
return this._client.post(path `/${api_version}/interactions/${id}/cancel`, options);
|
|
18797
|
+
return this._client.post(path `/${api_version}/interactions/${id}/cancel`, options)._thenUnwrap(addOutputProperties);
|
|
18738
18798
|
}
|
|
18739
18799
|
get(id, params = {}, options) {
|
|
18740
18800
|
var _a;
|
|
18741
18801
|
const _b = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion } = _b, query = __rest(_b, ["api_version"]);
|
|
18742
|
-
|
|
18802
|
+
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 }));
|
|
18803
|
+
if (params === null || params === void 0 ? void 0 : params.stream) {
|
|
18804
|
+
return response;
|
|
18805
|
+
}
|
|
18806
|
+
return response._thenUnwrap(addOutputProperties);
|
|
18743
18807
|
}
|
|
18744
18808
|
}
|
|
18745
18809
|
BaseInteractions._key = Object.freeze(['interactions']);
|
|
18746
18810
|
class Interactions extends BaseInteractions {
|
|
18747
18811
|
}
|
|
18812
|
+
function addOutputProperties(interaction) {
|
|
18813
|
+
var _a, _b;
|
|
18814
|
+
const steps = (_a = interaction.steps) !== null && _a !== void 0 ? _a : [];
|
|
18815
|
+
// output_text: scan backwards across all steps (stopping at user_input),
|
|
18816
|
+
// skip non-text content until the first text item is found, then collect
|
|
18817
|
+
// text until a non-text barrier is hit.
|
|
18818
|
+
const textParts = [];
|
|
18819
|
+
let collecting = false;
|
|
18820
|
+
outer: for (let i = steps.length - 1; i >= 0; i--) {
|
|
18821
|
+
const step = steps[i];
|
|
18822
|
+
if (step.type === 'user_input')
|
|
18823
|
+
break;
|
|
18824
|
+
if (step.type !== 'model_output' || !step.content) {
|
|
18825
|
+
if (collecting)
|
|
18826
|
+
break outer;
|
|
18827
|
+
continue;
|
|
18828
|
+
}
|
|
18829
|
+
const content = step.content;
|
|
18830
|
+
for (let j = content.length - 1; j >= 0; j--) {
|
|
18831
|
+
const item = content[j];
|
|
18832
|
+
if (item.type === 'text') {
|
|
18833
|
+
collecting = true;
|
|
18834
|
+
textParts.push((_b = item.text) !== null && _b !== void 0 ? _b : '');
|
|
18835
|
+
}
|
|
18836
|
+
else if (collecting) {
|
|
18837
|
+
// Hit a non-text barrier after we started collecting.
|
|
18838
|
+
break outer;
|
|
18839
|
+
}
|
|
18840
|
+
}
|
|
18841
|
+
}
|
|
18842
|
+
const output_text = textParts.reverse().join('');
|
|
18843
|
+
let output_image;
|
|
18844
|
+
let output_audio;
|
|
18845
|
+
let output_video;
|
|
18846
|
+
for (let i = steps.length - 1; i >= 0; i--) {
|
|
18847
|
+
const step = steps[i];
|
|
18848
|
+
const anyStep = step;
|
|
18849
|
+
if (anyStep.type === 'user_input') {
|
|
18850
|
+
break;
|
|
18851
|
+
}
|
|
18852
|
+
if (anyStep.type === 'model_output' && anyStep.content) {
|
|
18853
|
+
for (let j = anyStep.content.length - 1; j >= 0; j--) {
|
|
18854
|
+
const content = anyStep.content[j];
|
|
18855
|
+
if (content.type === 'image' && !output_image) {
|
|
18856
|
+
output_image = content;
|
|
18857
|
+
}
|
|
18858
|
+
if (content.type === 'audio' && !output_audio) {
|
|
18859
|
+
output_audio = content;
|
|
18860
|
+
}
|
|
18861
|
+
if (content.type === 'video' && !output_video) {
|
|
18862
|
+
output_video = content;
|
|
18863
|
+
}
|
|
18864
|
+
}
|
|
18865
|
+
}
|
|
18866
|
+
}
|
|
18867
|
+
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 }));
|
|
18868
|
+
}
|
|
18748
18869
|
|
|
18749
18870
|
/**
|
|
18750
18871
|
* @license
|
|
@@ -19459,6 +19580,7 @@ class GeminiNextGenAPIClient extends BaseGeminiNextGenAPIClient {
|
|
|
19459
19580
|
super(...arguments);
|
|
19460
19581
|
this.interactions = new Interactions(this);
|
|
19461
19582
|
this.webhooks = new Webhooks(this);
|
|
19583
|
+
this.agents = new Agents(this);
|
|
19462
19584
|
}
|
|
19463
19585
|
}
|
|
19464
19586
|
_a = GeminiNextGenAPIClient;
|
|
@@ -19479,6 +19601,7 @@ GeminiNextGenAPIClient.UnprocessableEntityError = UnprocessableEntityError;
|
|
|
19479
19601
|
GeminiNextGenAPIClient.toFile = toFile;
|
|
19480
19602
|
GeminiNextGenAPIClient.Interactions = Interactions;
|
|
19481
19603
|
GeminiNextGenAPIClient.Webhooks = Webhooks;
|
|
19604
|
+
GeminiNextGenAPIClient.Agents = Agents;
|
|
19482
19605
|
|
|
19483
19606
|
/**
|
|
19484
19607
|
* @license
|
|
@@ -21297,6 +21420,7 @@ class GoogleGenAI {
|
|
|
21297
21420
|
if (this._interactions !== undefined) {
|
|
21298
21421
|
return this._interactions;
|
|
21299
21422
|
}
|
|
21423
|
+
console.warn('GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.');
|
|
21300
21424
|
this._interactions = this.getNextGenClient().interactions;
|
|
21301
21425
|
return this._interactions;
|
|
21302
21426
|
}
|
|
@@ -21307,6 +21431,14 @@ class GoogleGenAI {
|
|
|
21307
21431
|
this._webhooks = this.getNextGenClient().webhooks;
|
|
21308
21432
|
return this._webhooks;
|
|
21309
21433
|
}
|
|
21434
|
+
get agents() {
|
|
21435
|
+
if (this._agents !== undefined) {
|
|
21436
|
+
return this._agents;
|
|
21437
|
+
}
|
|
21438
|
+
console.warn('GoogleGenAI.agents: Agents usage is experimental and may change in future versions.');
|
|
21439
|
+
this._agents = this.getNextGenClient().agents;
|
|
21440
|
+
return this._agents;
|
|
21441
|
+
}
|
|
21310
21442
|
constructor(options) {
|
|
21311
21443
|
var _a, _b, _c, _d;
|
|
21312
21444
|
// Validate explicitly set initializer values.
|