@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.cjs
CHANGED
|
@@ -8262,6 +8262,12 @@ function liveConnectConfigToMldev$1(fromObject, parentObject) {
|
|
|
8262
8262
|
}
|
|
8263
8263
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
8264
8264
|
}
|
|
8265
|
+
const fromStreamTranslationConfig = getValueByPath(fromObject, [
|
|
8266
|
+
'streamTranslationConfig',
|
|
8267
|
+
]);
|
|
8268
|
+
if (parentObject !== undefined && fromStreamTranslationConfig != null) {
|
|
8269
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'streamTranslationConfig'], fromStreamTranslationConfig);
|
|
8270
|
+
}
|
|
8265
8271
|
return toObject;
|
|
8266
8272
|
}
|
|
8267
8273
|
function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
@@ -8394,6 +8400,9 @@ function liveConnectConfigToVertex(fromObject, parentObject) {
|
|
|
8394
8400
|
}
|
|
8395
8401
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
8396
8402
|
}
|
|
8403
|
+
if (getValueByPath(fromObject, ['streamTranslationConfig']) !== undefined) {
|
|
8404
|
+
throw new Error('streamTranslationConfig parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
8405
|
+
}
|
|
8397
8406
|
return toObject;
|
|
8398
8407
|
}
|
|
8399
8408
|
function liveConnectParametersToMldev(apiClient, fromObject) {
|
|
@@ -12814,7 +12823,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
12814
12823
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
12815
12824
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
12816
12825
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
12817
|
-
const SDK_VERSION = '2.
|
|
12826
|
+
const SDK_VERSION = '2.4.0'; // x-release-please-version
|
|
12818
12827
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
12819
12828
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
12820
12829
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -16464,6 +16473,12 @@ function liveConnectConfigToMldev(fromObject, parentObject) {
|
|
|
16464
16473
|
}
|
|
16465
16474
|
setValueByPath(parentObject, ['setup', 'safetySettings'], transformedList);
|
|
16466
16475
|
}
|
|
16476
|
+
const fromStreamTranslationConfig = getValueByPath(fromObject, [
|
|
16477
|
+
'streamTranslationConfig',
|
|
16478
|
+
]);
|
|
16479
|
+
if (parentObject !== undefined && fromStreamTranslationConfig != null) {
|
|
16480
|
+
setValueByPath(parentObject, ['setup', 'generationConfig', 'streamTranslationConfig'], fromStreamTranslationConfig);
|
|
16481
|
+
}
|
|
16467
16482
|
return toObject;
|
|
16468
16483
|
}
|
|
16469
16484
|
function liveConnectConstraintsToMldev(apiClient, fromObject) {
|
|
@@ -17594,7 +17609,9 @@ class APIConnectionError extends APIError {
|
|
|
17594
17609
|
}
|
|
17595
17610
|
class APIConnectionTimeoutError extends APIConnectionError {
|
|
17596
17611
|
constructor({ message } = {}) {
|
|
17597
|
-
super({
|
|
17612
|
+
super({
|
|
17613
|
+
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.',
|
|
17614
|
+
});
|
|
17598
17615
|
}
|
|
17599
17616
|
}
|
|
17600
17617
|
class BadRequestError extends APIError {
|
|
@@ -17961,6 +17978,126 @@ class APIResource {
|
|
|
17961
17978
|
*/
|
|
17962
17979
|
APIResource._key = [];
|
|
17963
17980
|
|
|
17981
|
+
/**
|
|
17982
|
+
* @license
|
|
17983
|
+
* Copyright 2025 Google LLC
|
|
17984
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
17985
|
+
*/
|
|
17986
|
+
/**
|
|
17987
|
+
* Percent-encode everything that isn't safe to have in a path without encoding safe chars.
|
|
17988
|
+
*
|
|
17989
|
+
* Taken from https://datatracker.ietf.org/doc/html/rfc3986#section-3.3:
|
|
17990
|
+
* > unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
|
|
17991
|
+
* > sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="
|
|
17992
|
+
* > pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
|
|
17993
|
+
*/
|
|
17994
|
+
function encodeURIPath(str) {
|
|
17995
|
+
return str.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g, encodeURIComponent);
|
|
17996
|
+
}
|
|
17997
|
+
const EMPTY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.create(null));
|
|
17998
|
+
const createPathTagFunction = (pathEncoder = encodeURIPath) => (function path(statics, ...params) {
|
|
17999
|
+
// If there are no params, no processing is needed.
|
|
18000
|
+
if (statics.length === 1)
|
|
18001
|
+
return statics[0];
|
|
18002
|
+
let postPath = false;
|
|
18003
|
+
const invalidSegments = [];
|
|
18004
|
+
const path = statics.reduce((previousValue, currentValue, index) => {
|
|
18005
|
+
var _a, _b, _c;
|
|
18006
|
+
if (/[?#]/.test(currentValue)) {
|
|
18007
|
+
postPath = true;
|
|
18008
|
+
}
|
|
18009
|
+
const value = params[index];
|
|
18010
|
+
let encoded = (postPath ? encodeURIComponent : pathEncoder)('' + value);
|
|
18011
|
+
if (index !== params.length &&
|
|
18012
|
+
(value == null ||
|
|
18013
|
+
(typeof value === 'object' &&
|
|
18014
|
+
// handle values from other realms
|
|
18015
|
+
value.toString ===
|
|
18016
|
+
((_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)))) {
|
|
18017
|
+
encoded = value + '';
|
|
18018
|
+
invalidSegments.push({
|
|
18019
|
+
start: previousValue.length + currentValue.length,
|
|
18020
|
+
length: encoded.length,
|
|
18021
|
+
error: `Value of type ${Object.prototype.toString
|
|
18022
|
+
.call(value)
|
|
18023
|
+
.slice(8, -1)} is not a valid path parameter`,
|
|
18024
|
+
});
|
|
18025
|
+
}
|
|
18026
|
+
return previousValue + currentValue + (index === params.length ? '' : encoded);
|
|
18027
|
+
}, '');
|
|
18028
|
+
const pathOnly = path.split(/[?#]/, 1)[0];
|
|
18029
|
+
const invalidSegmentPattern = /(^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi;
|
|
18030
|
+
let match;
|
|
18031
|
+
// Find all invalid segments
|
|
18032
|
+
while ((match = invalidSegmentPattern.exec(pathOnly)) !== null) {
|
|
18033
|
+
const hasLeadingSlash = match[0].startsWith('/');
|
|
18034
|
+
const offset = hasLeadingSlash ? 1 : 0;
|
|
18035
|
+
const cleanMatch = hasLeadingSlash ? match[0].slice(1) : match[0];
|
|
18036
|
+
invalidSegments.push({
|
|
18037
|
+
start: match.index + offset,
|
|
18038
|
+
length: cleanMatch.length,
|
|
18039
|
+
error: `Value "${cleanMatch}" can\'t be safely passed as a path parameter`,
|
|
18040
|
+
});
|
|
18041
|
+
}
|
|
18042
|
+
invalidSegments.sort((a, b) => a.start - b.start);
|
|
18043
|
+
if (invalidSegments.length > 0) {
|
|
18044
|
+
let lastEnd = 0;
|
|
18045
|
+
const underline = invalidSegments.reduce((acc, segment) => {
|
|
18046
|
+
const spaces = ' '.repeat(segment.start - lastEnd);
|
|
18047
|
+
const arrows = '^'.repeat(segment.length);
|
|
18048
|
+
lastEnd = segment.start + segment.length;
|
|
18049
|
+
return acc + spaces + arrows;
|
|
18050
|
+
}, '');
|
|
18051
|
+
throw new GeminiNextGenAPIClientError(`Path parameters result in path with invalid segments:\n${invalidSegments
|
|
18052
|
+
.map((e) => e.error)
|
|
18053
|
+
.join('\n')}\n${path}\n${underline}`);
|
|
18054
|
+
}
|
|
18055
|
+
return path;
|
|
18056
|
+
});
|
|
18057
|
+
/**
|
|
18058
|
+
* URI-encodes path params and ensures no unsafe /./ or /../ path segments are introduced.
|
|
18059
|
+
*/
|
|
18060
|
+
const path = /* @__PURE__ */ createPathTagFunction(encodeURIPath);
|
|
18061
|
+
|
|
18062
|
+
/**
|
|
18063
|
+
* @license
|
|
18064
|
+
* Copyright 2025 Google LLC
|
|
18065
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
18066
|
+
*/
|
|
18067
|
+
class BaseAgents extends APIResource {
|
|
18068
|
+
/**
|
|
18069
|
+
* Creates a new Agent (Typed version for SDK).
|
|
18070
|
+
*/
|
|
18071
|
+
create(params = {}, options) {
|
|
18072
|
+
const _a = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion } = _a, body = __rest(_a, ["api_version"]);
|
|
18073
|
+
return this._client.post(path `/${api_version}/agents`, Object.assign({ body }, options));
|
|
18074
|
+
}
|
|
18075
|
+
/**
|
|
18076
|
+
* Lists all Agents.
|
|
18077
|
+
*/
|
|
18078
|
+
list(params = {}, options) {
|
|
18079
|
+
const _a = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion } = _a, query = __rest(_a, ["api_version"]);
|
|
18080
|
+
return this._client.get(path `/${api_version}/agents`, Object.assign({ query }, options));
|
|
18081
|
+
}
|
|
18082
|
+
/**
|
|
18083
|
+
* Deletes an Agent.
|
|
18084
|
+
*/
|
|
18085
|
+
delete(id, params = {}, options) {
|
|
18086
|
+
const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
|
|
18087
|
+
return this._client.delete(path `/${api_version}/agents/${id}`, options);
|
|
18088
|
+
}
|
|
18089
|
+
/**
|
|
18090
|
+
* Gets a specific Agent.
|
|
18091
|
+
*/
|
|
18092
|
+
get(id, params = {}, options) {
|
|
18093
|
+
const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
|
|
18094
|
+
return this._client.get(path `/${api_version}/agents/${id}`, options);
|
|
18095
|
+
}
|
|
18096
|
+
}
|
|
18097
|
+
BaseAgents._key = Object.freeze(['agents']);
|
|
18098
|
+
class Agents extends BaseAgents {
|
|
18099
|
+
}
|
|
18100
|
+
|
|
17964
18101
|
/**
|
|
17965
18102
|
* @license
|
|
17966
18103
|
* Copyright 2025 Google LLC
|
|
@@ -18622,87 +18759,6 @@ class LegacyLyriaStream extends Stream {
|
|
|
18622
18759
|
}
|
|
18623
18760
|
}
|
|
18624
18761
|
|
|
18625
|
-
/**
|
|
18626
|
-
* @license
|
|
18627
|
-
* Copyright 2025 Google LLC
|
|
18628
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
18629
|
-
*/
|
|
18630
|
-
/**
|
|
18631
|
-
* Percent-encode everything that isn't safe to have in a path without encoding safe chars.
|
|
18632
|
-
*
|
|
18633
|
-
* Taken from https://datatracker.ietf.org/doc/html/rfc3986#section-3.3:
|
|
18634
|
-
* > unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
|
|
18635
|
-
* > sub-delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / "="
|
|
18636
|
-
* > pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
|
|
18637
|
-
*/
|
|
18638
|
-
function encodeURIPath(str) {
|
|
18639
|
-
return str.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g, encodeURIComponent);
|
|
18640
|
-
}
|
|
18641
|
-
const EMPTY = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.create(null));
|
|
18642
|
-
const createPathTagFunction = (pathEncoder = encodeURIPath) => (function path(statics, ...params) {
|
|
18643
|
-
// If there are no params, no processing is needed.
|
|
18644
|
-
if (statics.length === 1)
|
|
18645
|
-
return statics[0];
|
|
18646
|
-
let postPath = false;
|
|
18647
|
-
const invalidSegments = [];
|
|
18648
|
-
const path = statics.reduce((previousValue, currentValue, index) => {
|
|
18649
|
-
var _a, _b, _c;
|
|
18650
|
-
if (/[?#]/.test(currentValue)) {
|
|
18651
|
-
postPath = true;
|
|
18652
|
-
}
|
|
18653
|
-
const value = params[index];
|
|
18654
|
-
let encoded = (postPath ? encodeURIComponent : pathEncoder)('' + value);
|
|
18655
|
-
if (index !== params.length &&
|
|
18656
|
-
(value == null ||
|
|
18657
|
-
(typeof value === 'object' &&
|
|
18658
|
-
// handle values from other realms
|
|
18659
|
-
value.toString ===
|
|
18660
|
-
((_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)))) {
|
|
18661
|
-
encoded = value + '';
|
|
18662
|
-
invalidSegments.push({
|
|
18663
|
-
start: previousValue.length + currentValue.length,
|
|
18664
|
-
length: encoded.length,
|
|
18665
|
-
error: `Value of type ${Object.prototype.toString
|
|
18666
|
-
.call(value)
|
|
18667
|
-
.slice(8, -1)} is not a valid path parameter`,
|
|
18668
|
-
});
|
|
18669
|
-
}
|
|
18670
|
-
return previousValue + currentValue + (index === params.length ? '' : encoded);
|
|
18671
|
-
}, '');
|
|
18672
|
-
const pathOnly = path.split(/[?#]/, 1)[0];
|
|
18673
|
-
const invalidSegmentPattern = /(^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi;
|
|
18674
|
-
let match;
|
|
18675
|
-
// Find all invalid segments
|
|
18676
|
-
while ((match = invalidSegmentPattern.exec(pathOnly)) !== null) {
|
|
18677
|
-
const hasLeadingSlash = match[0].startsWith('/');
|
|
18678
|
-
const offset = hasLeadingSlash ? 1 : 0;
|
|
18679
|
-
const cleanMatch = hasLeadingSlash ? match[0].slice(1) : match[0];
|
|
18680
|
-
invalidSegments.push({
|
|
18681
|
-
start: match.index + offset,
|
|
18682
|
-
length: cleanMatch.length,
|
|
18683
|
-
error: `Value "${cleanMatch}" can\'t be safely passed as a path parameter`,
|
|
18684
|
-
});
|
|
18685
|
-
}
|
|
18686
|
-
invalidSegments.sort((a, b) => a.start - b.start);
|
|
18687
|
-
if (invalidSegments.length > 0) {
|
|
18688
|
-
let lastEnd = 0;
|
|
18689
|
-
const underline = invalidSegments.reduce((acc, segment) => {
|
|
18690
|
-
const spaces = ' '.repeat(segment.start - lastEnd);
|
|
18691
|
-
const arrows = '^'.repeat(segment.length);
|
|
18692
|
-
lastEnd = segment.start + segment.length;
|
|
18693
|
-
return acc + spaces + arrows;
|
|
18694
|
-
}, '');
|
|
18695
|
-
throw new GeminiNextGenAPIClientError(`Path parameters result in path with invalid segments:\n${invalidSegments
|
|
18696
|
-
.map((e) => e.error)
|
|
18697
|
-
.join('\n')}\n${path}\n${underline}`);
|
|
18698
|
-
}
|
|
18699
|
-
return path;
|
|
18700
|
-
});
|
|
18701
|
-
/**
|
|
18702
|
-
* URI-encodes path params and ensures no unsafe /./ or /../ path segments are introduced.
|
|
18703
|
-
*/
|
|
18704
|
-
const path = /* @__PURE__ */ createPathTagFunction(encodeURIPath);
|
|
18705
|
-
|
|
18706
18762
|
/**
|
|
18707
18763
|
* @license
|
|
18708
18764
|
* Copyright 2025 Google LLC
|
|
@@ -18724,10 +18780,14 @@ class BaseInteractions extends APIResource {
|
|
|
18724
18780
|
});
|
|
18725
18781
|
const isStreaming = (_a = params.stream) !== null && _a !== void 0 ? _a : false;
|
|
18726
18782
|
const promise = this._client.post(path `/${api_version}/interactions`, Object.assign(Object.assign(Object.assign({ body }, options), { stream: isStreaming }), (needsLegacyLyriaShim && isStreaming ? { __streamClass: LegacyLyriaStream } : {})));
|
|
18727
|
-
if (
|
|
18728
|
-
return promise
|
|
18783
|
+
if (isStreaming) {
|
|
18784
|
+
return promise;
|
|
18785
|
+
}
|
|
18786
|
+
let nonStreaming = promise;
|
|
18787
|
+
if (needsLegacyLyriaShim) {
|
|
18788
|
+
nonStreaming = nonStreaming._thenUnwrap((data) => coerceLegacyInteractionResponse(data));
|
|
18729
18789
|
}
|
|
18730
|
-
return
|
|
18790
|
+
return nonStreaming._thenUnwrap(addOutputProperties);
|
|
18731
18791
|
}
|
|
18732
18792
|
/**
|
|
18733
18793
|
* Deletes the interaction by id.
|
|
@@ -18756,17 +18816,78 @@ class BaseInteractions extends APIResource {
|
|
|
18756
18816
|
*/
|
|
18757
18817
|
cancel(id, params = {}, options) {
|
|
18758
18818
|
const { api_version = this._client.apiVersion } = params !== null && params !== void 0 ? params : {};
|
|
18759
|
-
return this._client.post(path `/${api_version}/interactions/${id}/cancel`, options);
|
|
18819
|
+
return this._client.post(path `/${api_version}/interactions/${id}/cancel`, options)._thenUnwrap(addOutputProperties);
|
|
18760
18820
|
}
|
|
18761
18821
|
get(id, params = {}, options) {
|
|
18762
18822
|
var _a;
|
|
18763
18823
|
const _b = params !== null && params !== void 0 ? params : {}, { api_version = this._client.apiVersion } = _b, query = __rest(_b, ["api_version"]);
|
|
18764
|
-
|
|
18824
|
+
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 }));
|
|
18825
|
+
if (params === null || params === void 0 ? void 0 : params.stream) {
|
|
18826
|
+
return response;
|
|
18827
|
+
}
|
|
18828
|
+
return response._thenUnwrap(addOutputProperties);
|
|
18765
18829
|
}
|
|
18766
18830
|
}
|
|
18767
18831
|
BaseInteractions._key = Object.freeze(['interactions']);
|
|
18768
18832
|
class Interactions extends BaseInteractions {
|
|
18769
18833
|
}
|
|
18834
|
+
function addOutputProperties(interaction) {
|
|
18835
|
+
var _a, _b;
|
|
18836
|
+
const steps = (_a = interaction.steps) !== null && _a !== void 0 ? _a : [];
|
|
18837
|
+
// output_text: scan backwards across all steps (stopping at user_input),
|
|
18838
|
+
// skip non-text content until the first text item is found, then collect
|
|
18839
|
+
// text until a non-text barrier is hit.
|
|
18840
|
+
const textParts = [];
|
|
18841
|
+
let collecting = false;
|
|
18842
|
+
outer: for (let i = steps.length - 1; i >= 0; i--) {
|
|
18843
|
+
const step = steps[i];
|
|
18844
|
+
if (step.type === 'user_input')
|
|
18845
|
+
break;
|
|
18846
|
+
if (step.type !== 'model_output' || !step.content) {
|
|
18847
|
+
if (collecting)
|
|
18848
|
+
break outer;
|
|
18849
|
+
continue;
|
|
18850
|
+
}
|
|
18851
|
+
const content = step.content;
|
|
18852
|
+
for (let j = content.length - 1; j >= 0; j--) {
|
|
18853
|
+
const item = content[j];
|
|
18854
|
+
if (item.type === 'text') {
|
|
18855
|
+
collecting = true;
|
|
18856
|
+
textParts.push((_b = item.text) !== null && _b !== void 0 ? _b : '');
|
|
18857
|
+
}
|
|
18858
|
+
else if (collecting) {
|
|
18859
|
+
// Hit a non-text barrier after we started collecting.
|
|
18860
|
+
break outer;
|
|
18861
|
+
}
|
|
18862
|
+
}
|
|
18863
|
+
}
|
|
18864
|
+
const output_text = textParts.reverse().join('');
|
|
18865
|
+
let output_image;
|
|
18866
|
+
let output_audio;
|
|
18867
|
+
let output_video;
|
|
18868
|
+
for (let i = steps.length - 1; i >= 0; i--) {
|
|
18869
|
+
const step = steps[i];
|
|
18870
|
+
const anyStep = step;
|
|
18871
|
+
if (anyStep.type === 'user_input') {
|
|
18872
|
+
break;
|
|
18873
|
+
}
|
|
18874
|
+
if (anyStep.type === 'model_output' && anyStep.content) {
|
|
18875
|
+
for (let j = anyStep.content.length - 1; j >= 0; j--) {
|
|
18876
|
+
const content = anyStep.content[j];
|
|
18877
|
+
if (content.type === 'image' && !output_image) {
|
|
18878
|
+
output_image = content;
|
|
18879
|
+
}
|
|
18880
|
+
if (content.type === 'audio' && !output_audio) {
|
|
18881
|
+
output_audio = content;
|
|
18882
|
+
}
|
|
18883
|
+
if (content.type === 'video' && !output_video) {
|
|
18884
|
+
output_video = content;
|
|
18885
|
+
}
|
|
18886
|
+
}
|
|
18887
|
+
}
|
|
18888
|
+
}
|
|
18889
|
+
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 }));
|
|
18890
|
+
}
|
|
18770
18891
|
|
|
18771
18892
|
/**
|
|
18772
18893
|
* @license
|
|
@@ -19481,6 +19602,7 @@ class GeminiNextGenAPIClient extends BaseGeminiNextGenAPIClient {
|
|
|
19481
19602
|
super(...arguments);
|
|
19482
19603
|
this.interactions = new Interactions(this);
|
|
19483
19604
|
this.webhooks = new Webhooks(this);
|
|
19605
|
+
this.agents = new Agents(this);
|
|
19484
19606
|
}
|
|
19485
19607
|
}
|
|
19486
19608
|
_a = GeminiNextGenAPIClient;
|
|
@@ -19501,6 +19623,7 @@ GeminiNextGenAPIClient.UnprocessableEntityError = UnprocessableEntityError;
|
|
|
19501
19623
|
GeminiNextGenAPIClient.toFile = toFile;
|
|
19502
19624
|
GeminiNextGenAPIClient.Interactions = Interactions;
|
|
19503
19625
|
GeminiNextGenAPIClient.Webhooks = Webhooks;
|
|
19626
|
+
GeminiNextGenAPIClient.Agents = Agents;
|
|
19504
19627
|
|
|
19505
19628
|
/**
|
|
19506
19629
|
* @license
|
|
@@ -21319,6 +21442,7 @@ class GoogleGenAI {
|
|
|
21319
21442
|
if (this._interactions !== undefined) {
|
|
21320
21443
|
return this._interactions;
|
|
21321
21444
|
}
|
|
21445
|
+
console.warn('GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.');
|
|
21322
21446
|
this._interactions = this.getNextGenClient().interactions;
|
|
21323
21447
|
return this._interactions;
|
|
21324
21448
|
}
|
|
@@ -21329,6 +21453,14 @@ class GoogleGenAI {
|
|
|
21329
21453
|
this._webhooks = this.getNextGenClient().webhooks;
|
|
21330
21454
|
return this._webhooks;
|
|
21331
21455
|
}
|
|
21456
|
+
get agents() {
|
|
21457
|
+
if (this._agents !== undefined) {
|
|
21458
|
+
return this._agents;
|
|
21459
|
+
}
|
|
21460
|
+
console.warn('GoogleGenAI.agents: Agents usage is experimental and may change in future versions.');
|
|
21461
|
+
this._agents = this.getNextGenClient().agents;
|
|
21462
|
+
return this._agents;
|
|
21463
|
+
}
|
|
21332
21464
|
constructor(options) {
|
|
21333
21465
|
var _a, _b, _c, _d;
|
|
21334
21466
|
// Validate explicitly set initializer values.
|