@google/genai 2.9.0-rc.0 → 2.10.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 +1 -4
- package/dist/genai.d.ts +570 -363
- package/dist/index.cjs +283 -120
- package/dist/index.mjs +284 -121
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +283 -120
- package/dist/node/index.mjs +284 -121
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +570 -363
- package/dist/tokenizer/node.cjs +56 -20
- package/dist/tokenizer/node.d.ts +41 -10
- package/dist/tokenizer/node.mjs +56 -20
- package/dist/tokenizer/node.mjs.map +1 -1
- package/dist/vertex_internal/index.cjs +57 -21
- package/dist/vertex_internal/index.cjs.map +1 -1
- package/dist/vertex_internal/index.d.ts +71 -18
- package/dist/vertex_internal/index.js +57 -21
- package/dist/vertex_internal/index.js.map +1 -1
- package/dist/web/index.mjs +284 -121
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +570 -363
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -646,26 +646,6 @@ exports.Type = void 0;
|
|
|
646
646
|
*/
|
|
647
647
|
Type["NULL"] = "NULL";
|
|
648
648
|
})(exports.Type || (exports.Type = {}));
|
|
649
|
-
/** The environment being operated. */
|
|
650
|
-
exports.Environment = void 0;
|
|
651
|
-
(function (Environment) {
|
|
652
|
-
/**
|
|
653
|
-
* Defaults to browser.
|
|
654
|
-
*/
|
|
655
|
-
Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
|
|
656
|
-
/**
|
|
657
|
-
* Operates in a web browser.
|
|
658
|
-
*/
|
|
659
|
-
Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
|
|
660
|
-
/**
|
|
661
|
-
* Operates in a mobile environment.
|
|
662
|
-
*/
|
|
663
|
-
Environment["ENVIRONMENT_MOBILE"] = "ENVIRONMENT_MOBILE";
|
|
664
|
-
/**
|
|
665
|
-
* Operates in a desktop environment.
|
|
666
|
-
*/
|
|
667
|
-
Environment["ENVIRONMENT_DESKTOP"] = "ENVIRONMENT_DESKTOP";
|
|
668
|
-
})(exports.Environment || (exports.Environment = {}));
|
|
669
649
|
/** Type of auth scheme. This enum is not supported in Gemini API. */
|
|
670
650
|
exports.AuthType = void 0;
|
|
671
651
|
(function (AuthType) {
|
|
@@ -736,6 +716,62 @@ exports.ApiSpec = void 0;
|
|
|
736
716
|
*/
|
|
737
717
|
ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
|
|
738
718
|
})(exports.ApiSpec || (exports.ApiSpec = {}));
|
|
719
|
+
/** The environment being operated. */
|
|
720
|
+
exports.Environment = void 0;
|
|
721
|
+
(function (Environment) {
|
|
722
|
+
/**
|
|
723
|
+
* Defaults to browser.
|
|
724
|
+
*/
|
|
725
|
+
Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
|
|
726
|
+
/**
|
|
727
|
+
* Operates in a web browser.
|
|
728
|
+
*/
|
|
729
|
+
Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
|
|
730
|
+
/**
|
|
731
|
+
* Operates in a mobile environment.
|
|
732
|
+
*/
|
|
733
|
+
Environment["ENVIRONMENT_MOBILE"] = "ENVIRONMENT_MOBILE";
|
|
734
|
+
/**
|
|
735
|
+
* Operates in a desktop environment.
|
|
736
|
+
*/
|
|
737
|
+
Environment["ENVIRONMENT_DESKTOP"] = "ENVIRONMENT_DESKTOP";
|
|
738
|
+
})(exports.Environment || (exports.Environment = {}));
|
|
739
|
+
/** SafetyPolicy */
|
|
740
|
+
exports.SafetyPolicy = void 0;
|
|
741
|
+
(function (SafetyPolicy) {
|
|
742
|
+
/**
|
|
743
|
+
* Unspecified safety policy.
|
|
744
|
+
*/
|
|
745
|
+
SafetyPolicy["SAFETY_POLICY_UNSPECIFIED"] = "SAFETY_POLICY_UNSPECIFIED";
|
|
746
|
+
/**
|
|
747
|
+
* Safety policy for financial transactions.
|
|
748
|
+
*/
|
|
749
|
+
SafetyPolicy["FINANCIAL_TRANSACTIONS"] = "FINANCIAL_TRANSACTIONS";
|
|
750
|
+
/**
|
|
751
|
+
* Safety policy for sensitive data modification.
|
|
752
|
+
*/
|
|
753
|
+
SafetyPolicy["SENSITIVE_DATA_MODIFICATION"] = "SENSITIVE_DATA_MODIFICATION";
|
|
754
|
+
/**
|
|
755
|
+
* Safety policy for communication tools (e.g. Gmail, Chat, Meet).
|
|
756
|
+
*/
|
|
757
|
+
SafetyPolicy["COMMUNICATION_TOOL"] = "COMMUNICATION_TOOL";
|
|
758
|
+
/**
|
|
759
|
+
* Safety policy for account creation.
|
|
760
|
+
*/
|
|
761
|
+
SafetyPolicy["ACCOUNT_CREATION"] = "ACCOUNT_CREATION";
|
|
762
|
+
/**
|
|
763
|
+
* Safety policy for data modification.
|
|
764
|
+
*/
|
|
765
|
+
SafetyPolicy["DATA_MODIFICATION"] = "DATA_MODIFICATION";
|
|
766
|
+
/**
|
|
767
|
+
* Safety policy for user consent management.
|
|
768
|
+
*/
|
|
769
|
+
SafetyPolicy["USER_CONSENT_MANAGEMENT"] = "USER_CONSENT_MANAGEMENT";
|
|
770
|
+
/**
|
|
771
|
+
* Safety policy for legal terms and agreements.
|
|
772
|
+
*/
|
|
773
|
+
SafetyPolicy["LEGAL_TERMS_AND_AGREEMENTS"] = "LEGAL_TERMS_AND_AGREEMENTS";
|
|
774
|
+
})(exports.SafetyPolicy || (exports.SafetyPolicy = {}));
|
|
739
775
|
/** Sites with confidence level chosen & above this value will be blocked from the search results. This enum is not supported in Gemini API. */
|
|
740
776
|
exports.PhishBlockThreshold = void 0;
|
|
741
777
|
(function (PhishBlockThreshold) {
|
|
@@ -5915,6 +5951,29 @@ function codeExecutionResultToVertex$3(fromObject) {
|
|
|
5915
5951
|
}
|
|
5916
5952
|
return toObject;
|
|
5917
5953
|
}
|
|
5954
|
+
function computerUseToVertex$2(fromObject) {
|
|
5955
|
+
const toObject = {};
|
|
5956
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
5957
|
+
if (fromEnvironment != null) {
|
|
5958
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
5959
|
+
}
|
|
5960
|
+
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
5961
|
+
'excludedPredefinedFunctions',
|
|
5962
|
+
]);
|
|
5963
|
+
if (fromExcludedPredefinedFunctions != null) {
|
|
5964
|
+
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
5965
|
+
}
|
|
5966
|
+
const fromEnablePromptInjectionDetection = getValueByPath(fromObject, [
|
|
5967
|
+
'enablePromptInjectionDetection',
|
|
5968
|
+
]);
|
|
5969
|
+
if (fromEnablePromptInjectionDetection != null) {
|
|
5970
|
+
setValueByPath(toObject, ['enablePromptInjectionDetection'], fromEnablePromptInjectionDetection);
|
|
5971
|
+
}
|
|
5972
|
+
if (getValueByPath(fromObject, ['disabledSafetyPolicies']) !== undefined) {
|
|
5973
|
+
throw new Error('disabledSafetyPolicies parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
5974
|
+
}
|
|
5975
|
+
return toObject;
|
|
5976
|
+
}
|
|
5918
5977
|
function contentToMldev$3(fromObject) {
|
|
5919
5978
|
const toObject = {};
|
|
5920
5979
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
@@ -6590,7 +6649,7 @@ function toolToVertex$2(fromObject) {
|
|
|
6590
6649
|
}
|
|
6591
6650
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
6592
6651
|
if (fromComputerUse != null) {
|
|
6593
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
6652
|
+
setValueByPath(toObject, ['computerUse'], computerUseToVertex$2(fromComputerUse));
|
|
6594
6653
|
}
|
|
6595
6654
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
6596
6655
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -7741,7 +7800,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
7741
7800
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
7742
7801
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
7743
7802
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
7744
|
-
const SDK_VERSION = '2.
|
|
7803
|
+
const SDK_VERSION = '2.10.0'; // x-release-please-version
|
|
7745
7804
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
7746
7805
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
7747
7806
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -8750,7 +8809,7 @@ class Files extends BaseModule {
|
|
|
8750
8809
|
* file extension.
|
|
8751
8810
|
* - For Blob object inputs, the `mimeType` will be set to the Blob's `type`
|
|
8752
8811
|
* property.
|
|
8753
|
-
*
|
|
8812
|
+
* Some examples for file extension to mimeType mapping:
|
|
8754
8813
|
* .txt -> text/plain
|
|
8755
8814
|
* .json -> application/json
|
|
8756
8815
|
* .jpg -> image/jpeg
|
|
@@ -9882,15 +9941,6 @@ class GoogleGenAiError extends Error {
|
|
|
9882
9941
|
* g3-prettier-ignore-file
|
|
9883
9942
|
*/
|
|
9884
9943
|
class GeminiNextGenAPIClientError extends Error {
|
|
9885
|
-
static [Symbol.hasInstance](instance) {
|
|
9886
|
-
if (Function.prototype[Symbol.hasInstance].call(this, instance)) {
|
|
9887
|
-
return true;
|
|
9888
|
-
}
|
|
9889
|
-
if (this === GeminiNextGenAPIClientError) {
|
|
9890
|
-
return isKnownLegacyErrorLike(instance);
|
|
9891
|
-
}
|
|
9892
|
-
return isNamedLegacyErrorLike(instance, this.name);
|
|
9893
|
-
}
|
|
9894
9944
|
}
|
|
9895
9945
|
/** General errors raised by the GenAI API. */
|
|
9896
9946
|
class APIError extends GeminiNextGenAPIClientError {
|
|
@@ -9905,6 +9955,7 @@ class APIError extends GeminiNextGenAPIClientError {
|
|
|
9905
9955
|
this.rawResponse = undefined;
|
|
9906
9956
|
this.cause = undefined;
|
|
9907
9957
|
this.name = this.constructor.name;
|
|
9958
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
9908
9959
|
}
|
|
9909
9960
|
static makeMessage(status, error, message) {
|
|
9910
9961
|
var _a;
|
|
@@ -9916,15 +9967,6 @@ class APIError extends GeminiNextGenAPIClientError {
|
|
|
9916
9967
|
const statusText = status ? `${status} ` : "";
|
|
9917
9968
|
return `${statusText}${msg}`;
|
|
9918
9969
|
}
|
|
9919
|
-
static [Symbol.hasInstance](instance) {
|
|
9920
|
-
if (Function.prototype[Symbol.hasInstance].call(this, instance)) {
|
|
9921
|
-
return true;
|
|
9922
|
-
}
|
|
9923
|
-
if (this === APIError) {
|
|
9924
|
-
return isAPIErrorLike(instance);
|
|
9925
|
-
}
|
|
9926
|
-
return isNamedLegacyErrorLike(instance, this.name);
|
|
9927
|
-
}
|
|
9928
9970
|
static generate(status, errorResponse, message, headers) {
|
|
9929
9971
|
if (!status || !headers) {
|
|
9930
9972
|
return new APIConnectionError({
|
|
@@ -10065,57 +10107,12 @@ function stringifyErrorBody(error) {
|
|
|
10065
10107
|
function isPlainObject$2(value) {
|
|
10066
10108
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
10067
10109
|
}
|
|
10068
|
-
function isLegacyErrorLike(value) {
|
|
10069
|
-
if (!(value instanceof Error) || !isPlainObject$2(value)) {
|
|
10070
|
-
return false;
|
|
10071
|
-
}
|
|
10072
|
-
return ("status" in value ||
|
|
10073
|
-
"statusCode" in value ||
|
|
10074
|
-
"error" in value ||
|
|
10075
|
-
"headers" in value);
|
|
10076
|
-
}
|
|
10077
|
-
function isAPIErrorLike(value) {
|
|
10078
|
-
return isLegacyErrorLike(value) && "error" in value;
|
|
10079
|
-
}
|
|
10080
10110
|
function isCompatAPIErrorInstance(value) {
|
|
10111
|
+
// Avoid instanceof here so this guard never depends on Symbol.hasInstance.
|
|
10081
10112
|
return typeof value === "object" && value !== null
|
|
10082
10113
|
? APIError.prototype.isPrototypeOf(value)
|
|
10083
10114
|
: false;
|
|
10084
10115
|
}
|
|
10085
|
-
const knownLegacyErrorNames = [
|
|
10086
|
-
"GeminiNextGenAPIClientError",
|
|
10087
|
-
"APIError",
|
|
10088
|
-
"APIUserAbortError",
|
|
10089
|
-
"APIConnectionError",
|
|
10090
|
-
"APIConnectionTimeoutError",
|
|
10091
|
-
"BadRequestError",
|
|
10092
|
-
"AuthenticationError",
|
|
10093
|
-
"PermissionDeniedError",
|
|
10094
|
-
"NotFoundError",
|
|
10095
|
-
"ConflictError",
|
|
10096
|
-
"UnprocessableEntityError",
|
|
10097
|
-
"RateLimitError",
|
|
10098
|
-
"InternalServerError",
|
|
10099
|
-
];
|
|
10100
|
-
const legacySubclassNamesByBaseName = {
|
|
10101
|
-
GeminiNextGenAPIClientError: knownLegacyErrorNames,
|
|
10102
|
-
APIConnectionError: ["APIConnectionTimeoutError"],
|
|
10103
|
-
};
|
|
10104
|
-
function isKnownLegacyErrorLike(value) {
|
|
10105
|
-
if (!isLegacyErrorLike(value)) {
|
|
10106
|
-
return false;
|
|
10107
|
-
}
|
|
10108
|
-
return knownLegacyErrorNames.includes(value.name);
|
|
10109
|
-
}
|
|
10110
|
-
function isNamedLegacyErrorLike(value, name) {
|
|
10111
|
-
var _a, _b;
|
|
10112
|
-
if (!isLegacyErrorLike(value)) {
|
|
10113
|
-
return false;
|
|
10114
|
-
}
|
|
10115
|
-
const valueName = value.name;
|
|
10116
|
-
return (valueName === name ||
|
|
10117
|
-
((_b = (_a = legacySubclassNamesByBaseName[name]) === null || _a === void 0 ? void 0 : _a.includes(valueName)) !== null && _b !== void 0 ? _b : false));
|
|
10118
|
-
}
|
|
10119
10116
|
function defineReadonly(target, key, value) {
|
|
10120
10117
|
Object.defineProperty(target, key, {
|
|
10121
10118
|
configurable: true,
|
|
@@ -10325,7 +10322,7 @@ function serverURLFromOptions(options) {
|
|
|
10325
10322
|
return new URL(u);
|
|
10326
10323
|
}
|
|
10327
10324
|
const SDK_METADATA = {
|
|
10328
|
-
userAgent: "speakeasy-sdk/typescript 2.4.1-preview.4 2.
|
|
10325
|
+
userAgent: "speakeasy-sdk/typescript 2.4.1-preview.4 2.911.0 v1beta @google/genai",
|
|
10329
10326
|
};
|
|
10330
10327
|
|
|
10331
10328
|
/**
|
|
@@ -10874,14 +10871,19 @@ async function retry(fetchFn, options) {
|
|
|
10874
10871
|
statusCodes: options.statusCodes,
|
|
10875
10872
|
retryConnectionErrors: !!options.config.retryConnectionErrors,
|
|
10876
10873
|
}), (_a = options.config.backoff) !== null && _a !== void 0 ? _a : defaultBackoff);
|
|
10874
|
+
case "attempt-count-backoff":
|
|
10875
|
+
return retryAttemptCountBackoff(wrapFetcher(fetchFn, {
|
|
10876
|
+
statusCodes: options.statusCodes,
|
|
10877
|
+
retryConnectionErrors: !!options.config.retryConnectionErrors,
|
|
10878
|
+
}), Object.assign(Object.assign({}, defaultBackoff), options.config.backoff), options.config);
|
|
10877
10879
|
default:
|
|
10878
|
-
return await fetchFn();
|
|
10880
|
+
return await fetchFn(0);
|
|
10879
10881
|
}
|
|
10880
10882
|
}
|
|
10881
10883
|
function wrapFetcher(fn, options) {
|
|
10882
|
-
return async () => {
|
|
10884
|
+
return async (attempt) => {
|
|
10883
10885
|
try {
|
|
10884
|
-
const res = await fn();
|
|
10886
|
+
const res = await fn(attempt);
|
|
10885
10887
|
if (isRetryableResponse(res, options.statusCodes)) {
|
|
10886
10888
|
throw new TemporaryError("Response failed with retryable status code", res);
|
|
10887
10889
|
}
|
|
@@ -10923,7 +10925,7 @@ async function retryBackoff(fn, strategy) {
|
|
|
10923
10925
|
let x = 0;
|
|
10924
10926
|
while (true) {
|
|
10925
10927
|
try {
|
|
10926
|
-
const res = await fn();
|
|
10928
|
+
const res = await fn(x);
|
|
10927
10929
|
return res;
|
|
10928
10930
|
}
|
|
10929
10931
|
catch (err) {
|
|
@@ -10951,7 +10953,46 @@ async function retryBackoff(fn, strategy) {
|
|
|
10951
10953
|
}
|
|
10952
10954
|
}
|
|
10953
10955
|
}
|
|
10956
|
+
async function retryAttemptCountBackoff(fn, strategy, config) {
|
|
10957
|
+
let attempt = 0;
|
|
10958
|
+
while (true) {
|
|
10959
|
+
try {
|
|
10960
|
+
return await fn(attempt);
|
|
10961
|
+
}
|
|
10962
|
+
catch (err) {
|
|
10963
|
+
if (err instanceof PermanentError) {
|
|
10964
|
+
throw err.cause;
|
|
10965
|
+
}
|
|
10966
|
+
if (attempt >= config.maxRetries) {
|
|
10967
|
+
if (err instanceof TemporaryError) {
|
|
10968
|
+
return err.response;
|
|
10969
|
+
}
|
|
10970
|
+
throw err;
|
|
10971
|
+
}
|
|
10972
|
+
let retryInterval = 0;
|
|
10973
|
+
if (err instanceof TemporaryError) {
|
|
10974
|
+
retryInterval = retryIntervalFromResponse(err.response);
|
|
10975
|
+
}
|
|
10976
|
+
if (retryInterval <= 0) {
|
|
10977
|
+
retryInterval =
|
|
10978
|
+
strategy.initialInterval *
|
|
10979
|
+
Math.pow(strategy.exponent, attempt) *
|
|
10980
|
+
(1 - Math.random() * 0.25);
|
|
10981
|
+
}
|
|
10982
|
+
const d = Math.min(retryInterval, strategy.maxInterval);
|
|
10983
|
+
await delay(d);
|
|
10984
|
+
attempt++;
|
|
10985
|
+
}
|
|
10986
|
+
}
|
|
10987
|
+
}
|
|
10954
10988
|
function retryIntervalFromResponse(res) {
|
|
10989
|
+
const retryAfterMsVal = res.headers.get("retry-after-ms");
|
|
10990
|
+
if (retryAfterMsVal) {
|
|
10991
|
+
const parsedMs = Number(retryAfterMsVal);
|
|
10992
|
+
if (Number.isFinite(parsedMs) && parsedMs >= 0) {
|
|
10993
|
+
return parsedMs;
|
|
10994
|
+
}
|
|
10995
|
+
}
|
|
10955
10996
|
const retryVal = res.headers.get("retry-after") || "";
|
|
10956
10997
|
if (!retryVal) {
|
|
10957
10998
|
return 0;
|
|
@@ -11406,13 +11447,12 @@ class Stream extends ReadableStream {
|
|
|
11406
11447
|
cancel: reason => upstream.cancel(reason),
|
|
11407
11448
|
});
|
|
11408
11449
|
}
|
|
11409
|
-
|
|
11410
|
-
[Symbol.asyncIterator]() {
|
|
11450
|
+
[Symbol.asyncIterator](options) {
|
|
11411
11451
|
const fn = ReadableStream.prototype[Symbol.asyncIterator];
|
|
11412
11452
|
if (typeof fn === "function")
|
|
11413
|
-
return fn.call(this);
|
|
11453
|
+
return fn.call(this, options);
|
|
11414
11454
|
const reader = this.getReader();
|
|
11415
|
-
|
|
11455
|
+
const iterator = {
|
|
11416
11456
|
next: async () => {
|
|
11417
11457
|
const r = await reader.read();
|
|
11418
11458
|
if (r.done) {
|
|
@@ -11435,6 +11475,17 @@ class Stream extends ReadableStream {
|
|
|
11435
11475
|
return this;
|
|
11436
11476
|
},
|
|
11437
11477
|
};
|
|
11478
|
+
const asyncDispose = Symbol.asyncDispose;
|
|
11479
|
+
if (asyncDispose) {
|
|
11480
|
+
iterator[asyncDispose] = async () => {
|
|
11481
|
+
var _a;
|
|
11482
|
+
await ((_a = iterator.return) === null || _a === void 0 ? void 0 : _a.call(iterator));
|
|
11483
|
+
};
|
|
11484
|
+
}
|
|
11485
|
+
return iterator;
|
|
11486
|
+
}
|
|
11487
|
+
values(options) {
|
|
11488
|
+
return this[Symbol.asyncIterator](options);
|
|
11438
11489
|
}
|
|
11439
11490
|
}
|
|
11440
11491
|
const CR = 13;
|
|
@@ -11575,7 +11626,16 @@ function match(...matchers) {
|
|
|
11575
11626
|
switch (encoding) {
|
|
11576
11627
|
case "json":
|
|
11577
11628
|
body = await response.text();
|
|
11578
|
-
|
|
11629
|
+
try {
|
|
11630
|
+
raw = JSON.parse(body);
|
|
11631
|
+
}
|
|
11632
|
+
catch (err) {
|
|
11633
|
+
// Passthrough for malformed error bodies; success bodies must be valid.
|
|
11634
|
+
if (!("err" in matcher)) {
|
|
11635
|
+
throw err;
|
|
11636
|
+
}
|
|
11637
|
+
raw = body;
|
|
11638
|
+
}
|
|
11579
11639
|
break;
|
|
11580
11640
|
case "jsonl":
|
|
11581
11641
|
raw = response.body;
|
|
@@ -11933,7 +11993,7 @@ async function $do$e(client, body, api_version, options) {
|
|
|
11933
11993
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
11934
11994
|
|| client._options.retry_config
|
|
11935
11995
|
|| {
|
|
11936
|
-
strategy: "backoff",
|
|
11996
|
+
strategy: "attempt-count-backoff",
|
|
11937
11997
|
backoff: {
|
|
11938
11998
|
initialInterval: 500,
|
|
11939
11999
|
maxInterval: 8000,
|
|
@@ -11941,6 +12001,7 @@ async function $do$e(client, body, api_version, options) {
|
|
|
11941
12001
|
maxElapsedTime: 30000,
|
|
11942
12002
|
},
|
|
11943
12003
|
retryConnectionErrors: true,
|
|
12004
|
+
maxRetries: 4,
|
|
11944
12005
|
}
|
|
11945
12006
|
|| { strategy: "none" },
|
|
11946
12007
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -12020,7 +12081,7 @@ async function $do$d(client, id, api_version, options) {
|
|
|
12020
12081
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
12021
12082
|
|| client._options.retry_config
|
|
12022
12083
|
|| {
|
|
12023
|
-
strategy: "backoff",
|
|
12084
|
+
strategy: "attempt-count-backoff",
|
|
12024
12085
|
backoff: {
|
|
12025
12086
|
initialInterval: 500,
|
|
12026
12087
|
maxInterval: 8000,
|
|
@@ -12028,6 +12089,7 @@ async function $do$d(client, id, api_version, options) {
|
|
|
12028
12089
|
maxElapsedTime: 30000,
|
|
12029
12090
|
},
|
|
12030
12091
|
retryConnectionErrors: true,
|
|
12092
|
+
maxRetries: 4,
|
|
12031
12093
|
}
|
|
12032
12094
|
|| { strategy: "none" },
|
|
12033
12095
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -12107,7 +12169,7 @@ async function $do$c(client, id, api_version, options) {
|
|
|
12107
12169
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
12108
12170
|
|| client._options.retry_config
|
|
12109
12171
|
|| {
|
|
12110
|
-
strategy: "backoff",
|
|
12172
|
+
strategy: "attempt-count-backoff",
|
|
12111
12173
|
backoff: {
|
|
12112
12174
|
initialInterval: 500,
|
|
12113
12175
|
maxInterval: 8000,
|
|
@@ -12115,6 +12177,7 @@ async function $do$c(client, id, api_version, options) {
|
|
|
12115
12177
|
maxElapsedTime: 30000,
|
|
12116
12178
|
},
|
|
12117
12179
|
retryConnectionErrors: true,
|
|
12180
|
+
maxRetries: 4,
|
|
12118
12181
|
}
|
|
12119
12182
|
|| { strategy: "none" },
|
|
12120
12183
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -12197,7 +12260,7 @@ async function $do$b(client, api_version, page_size, page_token, parent, options
|
|
|
12197
12260
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
12198
12261
|
|| client._options.retry_config
|
|
12199
12262
|
|| {
|
|
12200
|
-
strategy: "backoff",
|
|
12263
|
+
strategy: "attempt-count-backoff",
|
|
12201
12264
|
backoff: {
|
|
12202
12265
|
initialInterval: 500,
|
|
12203
12266
|
maxInterval: 8000,
|
|
@@ -12205,6 +12268,7 @@ async function $do$b(client, api_version, page_size, page_token, parent, options
|
|
|
12205
12268
|
maxElapsedTime: 30000,
|
|
12206
12269
|
},
|
|
12207
12270
|
retryConnectionErrors: true,
|
|
12271
|
+
maxRetries: 4,
|
|
12208
12272
|
}
|
|
12209
12273
|
|| { strategy: "none" },
|
|
12210
12274
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -12467,7 +12531,7 @@ async function $do$a(client, id, api_version, options) {
|
|
|
12467
12531
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
12468
12532
|
|| client._options.retry_config
|
|
12469
12533
|
|| {
|
|
12470
|
-
strategy: "backoff",
|
|
12534
|
+
strategy: "attempt-count-backoff",
|
|
12471
12535
|
backoff: {
|
|
12472
12536
|
initialInterval: 500,
|
|
12473
12537
|
maxInterval: 8000,
|
|
@@ -12475,6 +12539,7 @@ async function $do$a(client, id, api_version, options) {
|
|
|
12475
12539
|
maxElapsedTime: 30000,
|
|
12476
12540
|
},
|
|
12477
12541
|
retryConnectionErrors: true,
|
|
12542
|
+
maxRetries: 4,
|
|
12478
12543
|
}
|
|
12479
12544
|
|| { strategy: "none" },
|
|
12480
12545
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -12551,7 +12616,7 @@ async function $do$9(client, body, api_version, options) {
|
|
|
12551
12616
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
12552
12617
|
|| client._options.retry_config
|
|
12553
12618
|
|| {
|
|
12554
|
-
strategy: "backoff",
|
|
12619
|
+
strategy: "attempt-count-backoff",
|
|
12555
12620
|
backoff: {
|
|
12556
12621
|
initialInterval: 500,
|
|
12557
12622
|
maxInterval: 8000,
|
|
@@ -12559,6 +12624,7 @@ async function $do$9(client, body, api_version, options) {
|
|
|
12559
12624
|
maxElapsedTime: 30000,
|
|
12560
12625
|
},
|
|
12561
12626
|
retryConnectionErrors: true,
|
|
12627
|
+
maxRetries: 4,
|
|
12562
12628
|
}
|
|
12563
12629
|
|| { strategy: "none" },
|
|
12564
12630
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -12647,7 +12713,7 @@ async function $do$8(client, id, api_version, options) {
|
|
|
12647
12713
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
12648
12714
|
|| client._options.retry_config
|
|
12649
12715
|
|| {
|
|
12650
|
-
strategy: "backoff",
|
|
12716
|
+
strategy: "attempt-count-backoff",
|
|
12651
12717
|
backoff: {
|
|
12652
12718
|
initialInterval: 500,
|
|
12653
12719
|
maxInterval: 8000,
|
|
@@ -12655,6 +12721,7 @@ async function $do$8(client, id, api_version, options) {
|
|
|
12655
12721
|
maxElapsedTime: 30000,
|
|
12656
12722
|
},
|
|
12657
12723
|
retryConnectionErrors: true,
|
|
12724
|
+
maxRetries: 4,
|
|
12658
12725
|
}
|
|
12659
12726
|
|| { strategy: "none" },
|
|
12660
12727
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -12742,7 +12809,7 @@ async function $do$7(client, id, stream, last_event_id, include_input, api_versi
|
|
|
12742
12809
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
12743
12810
|
|| client._options.retry_config
|
|
12744
12811
|
|| {
|
|
12745
|
-
strategy: "backoff",
|
|
12812
|
+
strategy: "attempt-count-backoff",
|
|
12746
12813
|
backoff: {
|
|
12747
12814
|
initialInterval: 500,
|
|
12748
12815
|
maxInterval: 8000,
|
|
@@ -12750,6 +12817,7 @@ async function $do$7(client, id, stream, last_event_id, include_input, api_versi
|
|
|
12750
12817
|
maxElapsedTime: 30000,
|
|
12751
12818
|
},
|
|
12752
12819
|
retryConnectionErrors: true,
|
|
12820
|
+
maxRetries: 4,
|
|
12753
12821
|
}
|
|
12754
12822
|
|| { strategy: "none" },
|
|
12755
12823
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -12868,7 +12936,7 @@ async function $do$6(client, body, api_version, options) {
|
|
|
12868
12936
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
12869
12937
|
|| client._options.retry_config
|
|
12870
12938
|
|| {
|
|
12871
|
-
strategy: "backoff",
|
|
12939
|
+
strategy: "attempt-count-backoff",
|
|
12872
12940
|
backoff: {
|
|
12873
12941
|
initialInterval: 500,
|
|
12874
12942
|
maxInterval: 8000,
|
|
@@ -12876,6 +12944,7 @@ async function $do$6(client, body, api_version, options) {
|
|
|
12876
12944
|
maxElapsedTime: 30000,
|
|
12877
12945
|
},
|
|
12878
12946
|
retryConnectionErrors: true,
|
|
12947
|
+
maxRetries: 4,
|
|
12879
12948
|
}
|
|
12880
12949
|
|| { strategy: "none" },
|
|
12881
12950
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -12955,7 +13024,7 @@ async function $do$5(client, id, api_version, options) {
|
|
|
12955
13024
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
12956
13025
|
|| client._options.retry_config
|
|
12957
13026
|
|| {
|
|
12958
|
-
strategy: "backoff",
|
|
13027
|
+
strategy: "attempt-count-backoff",
|
|
12959
13028
|
backoff: {
|
|
12960
13029
|
initialInterval: 500,
|
|
12961
13030
|
maxInterval: 8000,
|
|
@@ -12963,6 +13032,7 @@ async function $do$5(client, id, api_version, options) {
|
|
|
12963
13032
|
maxElapsedTime: 30000,
|
|
12964
13033
|
},
|
|
12965
13034
|
retryConnectionErrors: true,
|
|
13035
|
+
maxRetries: 4,
|
|
12966
13036
|
}
|
|
12967
13037
|
|| { strategy: "none" },
|
|
12968
13038
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -13042,7 +13112,7 @@ async function $do$4(client, id, api_version, options) {
|
|
|
13042
13112
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
13043
13113
|
|| client._options.retry_config
|
|
13044
13114
|
|| {
|
|
13045
|
-
strategy: "backoff",
|
|
13115
|
+
strategy: "attempt-count-backoff",
|
|
13046
13116
|
backoff: {
|
|
13047
13117
|
initialInterval: 500,
|
|
13048
13118
|
maxInterval: 8000,
|
|
@@ -13050,6 +13120,7 @@ async function $do$4(client, id, api_version, options) {
|
|
|
13050
13120
|
maxElapsedTime: 30000,
|
|
13051
13121
|
},
|
|
13052
13122
|
retryConnectionErrors: true,
|
|
13123
|
+
maxRetries: 4,
|
|
13053
13124
|
}
|
|
13054
13125
|
|| { strategy: "none" },
|
|
13055
13126
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -13130,7 +13201,7 @@ async function $do$3(client, api_version, page_size, page_token, options) {
|
|
|
13130
13201
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
13131
13202
|
|| client._options.retry_config
|
|
13132
13203
|
|| {
|
|
13133
|
-
strategy: "backoff",
|
|
13204
|
+
strategy: "attempt-count-backoff",
|
|
13134
13205
|
backoff: {
|
|
13135
13206
|
initialInterval: 500,
|
|
13136
13207
|
maxInterval: 8000,
|
|
@@ -13138,6 +13209,7 @@ async function $do$3(client, api_version, page_size, page_token, options) {
|
|
|
13138
13209
|
maxElapsedTime: 30000,
|
|
13139
13210
|
},
|
|
13140
13211
|
retryConnectionErrors: true,
|
|
13212
|
+
maxRetries: 4,
|
|
13141
13213
|
}
|
|
13142
13214
|
|| { strategy: "none" },
|
|
13143
13215
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -13220,7 +13292,7 @@ async function $do$2(client, id, api_version, body, options) {
|
|
|
13220
13292
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
13221
13293
|
|| client._options.retry_config
|
|
13222
13294
|
|| {
|
|
13223
|
-
strategy: "backoff",
|
|
13295
|
+
strategy: "attempt-count-backoff",
|
|
13224
13296
|
backoff: {
|
|
13225
13297
|
initialInterval: 500,
|
|
13226
13298
|
maxInterval: 8000,
|
|
@@ -13228,6 +13300,7 @@ async function $do$2(client, id, api_version, body, options) {
|
|
|
13228
13300
|
maxElapsedTime: 30000,
|
|
13229
13301
|
},
|
|
13230
13302
|
retryConnectionErrors: true,
|
|
13303
|
+
maxRetries: 4,
|
|
13231
13304
|
}
|
|
13232
13305
|
|| { strategy: "none" },
|
|
13233
13306
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -13309,7 +13382,7 @@ async function $do$1(client, id, api_version, body, options) {
|
|
|
13309
13382
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
13310
13383
|
|| client._options.retry_config
|
|
13311
13384
|
|| {
|
|
13312
|
-
strategy: "backoff",
|
|
13385
|
+
strategy: "attempt-count-backoff",
|
|
13313
13386
|
backoff: {
|
|
13314
13387
|
initialInterval: 500,
|
|
13315
13388
|
maxInterval: 8000,
|
|
@@ -13317,6 +13390,7 @@ async function $do$1(client, id, api_version, body, options) {
|
|
|
13317
13390
|
maxElapsedTime: 30000,
|
|
13318
13391
|
},
|
|
13319
13392
|
retryConnectionErrors: true,
|
|
13393
|
+
maxRetries: 4,
|
|
13320
13394
|
}
|
|
13321
13395
|
|| { strategy: "none" },
|
|
13322
13396
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -13402,7 +13476,7 @@ async function $do(client, id, api_version, update_mask, body, options) {
|
|
|
13402
13476
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
13403
13477
|
|| client._options.retry_config
|
|
13404
13478
|
|| {
|
|
13405
|
-
strategy: "backoff",
|
|
13479
|
+
strategy: "attempt-count-backoff",
|
|
13406
13480
|
backoff: {
|
|
13407
13481
|
initialInterval: 500,
|
|
13408
13482
|
maxInterval: 8000,
|
|
@@ -13410,6 +13484,7 @@ async function $do(client, id, api_version, update_mask, body, options) {
|
|
|
13410
13484
|
maxElapsedTime: 30000,
|
|
13411
13485
|
},
|
|
13412
13486
|
retryConnectionErrors: true,
|
|
13487
|
+
maxRetries: 4,
|
|
13413
13488
|
}
|
|
13414
13489
|
|| { strategy: "none" },
|
|
13415
13490
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -13676,7 +13751,7 @@ function toGoogleGenAIRequestOptions(options, streaming = false) {
|
|
|
13676
13751
|
if (!options && !streaming) {
|
|
13677
13752
|
return undefined;
|
|
13678
13753
|
}
|
|
13679
|
-
const _e = options !== null && options !== void 0 ? options : {}, { timeout, maxRetries
|
|
13754
|
+
const _e = options !== null && options !== void 0 ? options : {}, { timeout, maxRetries, defaultBaseURL, query, body, fetchOptions } = _e, rest = __rest(_e, ["timeout", "maxRetries", "defaultBaseURL", "query", "body", "fetchOptions"]);
|
|
13680
13755
|
const nextOptions = Object.assign({}, rest);
|
|
13681
13756
|
if (isPlainObject(query)) {
|
|
13682
13757
|
nextOptions.extra_query = query;
|
|
@@ -13702,6 +13777,13 @@ function toGoogleGenAIRequestOptions(options, streaming = false) {
|
|
|
13702
13777
|
if (timeout_ms !== undefined) {
|
|
13703
13778
|
nextOptions.timeout_ms = timeout_ms;
|
|
13704
13779
|
}
|
|
13780
|
+
if (maxRetries !== undefined) {
|
|
13781
|
+
nextOptions.retries = {
|
|
13782
|
+
strategy: "attempt-count-backoff",
|
|
13783
|
+
retryConnectionErrors: true,
|
|
13784
|
+
maxRetries,
|
|
13785
|
+
};
|
|
13786
|
+
}
|
|
13705
13787
|
if (streaming) {
|
|
13706
13788
|
const headers = new Headers((_d = nextOptions.headers) !== null && _d !== void 0 ? _d : fetch_options === null || fetch_options === void 0 ? void 0 : fetch_options.headers);
|
|
13707
13789
|
headers.set("Accept", "text/event-stream");
|
|
@@ -13899,6 +13981,22 @@ function audioTranscriptionConfigToMldev$1(fromObject) {
|
|
|
13899
13981
|
if (getValueByPath(fromObject, ['languageCodes']) !== undefined) {
|
|
13900
13982
|
throw new Error('languageCodes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
13901
13983
|
}
|
|
13984
|
+
const fromLanguageAuto = getValueByPath(fromObject, ['languageAuto']);
|
|
13985
|
+
if (fromLanguageAuto != null) {
|
|
13986
|
+
setValueByPath(toObject, ['languageAuto'], fromLanguageAuto);
|
|
13987
|
+
}
|
|
13988
|
+
const fromLanguageHints = getValueByPath(fromObject, [
|
|
13989
|
+
'languageHints',
|
|
13990
|
+
]);
|
|
13991
|
+
if (fromLanguageHints != null) {
|
|
13992
|
+
setValueByPath(toObject, ['languageHints'], fromLanguageHints);
|
|
13993
|
+
}
|
|
13994
|
+
const fromAdaptationPhrases = getValueByPath(fromObject, [
|
|
13995
|
+
'adaptationPhrases',
|
|
13996
|
+
]);
|
|
13997
|
+
if (fromAdaptationPhrases != null) {
|
|
13998
|
+
setValueByPath(toObject, ['adaptationPhrases'], fromAdaptationPhrases);
|
|
13999
|
+
}
|
|
13902
14000
|
return toObject;
|
|
13903
14001
|
}
|
|
13904
14002
|
function authConfigToMldev$2(fromObject) {
|
|
@@ -13958,6 +14056,29 @@ function codeExecutionResultToVertex$2(fromObject) {
|
|
|
13958
14056
|
}
|
|
13959
14057
|
return toObject;
|
|
13960
14058
|
}
|
|
14059
|
+
function computerUseToVertex$1(fromObject) {
|
|
14060
|
+
const toObject = {};
|
|
14061
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
14062
|
+
if (fromEnvironment != null) {
|
|
14063
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
14064
|
+
}
|
|
14065
|
+
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
14066
|
+
'excludedPredefinedFunctions',
|
|
14067
|
+
]);
|
|
14068
|
+
if (fromExcludedPredefinedFunctions != null) {
|
|
14069
|
+
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
14070
|
+
}
|
|
14071
|
+
const fromEnablePromptInjectionDetection = getValueByPath(fromObject, [
|
|
14072
|
+
'enablePromptInjectionDetection',
|
|
14073
|
+
]);
|
|
14074
|
+
if (fromEnablePromptInjectionDetection != null) {
|
|
14075
|
+
setValueByPath(toObject, ['enablePromptInjectionDetection'], fromEnablePromptInjectionDetection);
|
|
14076
|
+
}
|
|
14077
|
+
if (getValueByPath(fromObject, ['disabledSafetyPolicies']) !== undefined) {
|
|
14078
|
+
throw new Error('disabledSafetyPolicies parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
14079
|
+
}
|
|
14080
|
+
return toObject;
|
|
14081
|
+
}
|
|
13961
14082
|
function contentToMldev$2(fromObject) {
|
|
13962
14083
|
const toObject = {};
|
|
13963
14084
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
@@ -14916,7 +15037,7 @@ function toolToVertex$1(fromObject) {
|
|
|
14916
15037
|
}
|
|
14917
15038
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
14918
15039
|
if (fromComputerUse != null) {
|
|
14919
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
15040
|
+
setValueByPath(toObject, ['computerUse'], computerUseToVertex$1(fromComputerUse));
|
|
14920
15041
|
}
|
|
14921
15042
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
14922
15043
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -15079,6 +15200,10 @@ function voiceActivityFromVertex(fromObject) {
|
|
|
15079
15200
|
if (fromVoiceActivityType != null) {
|
|
15080
15201
|
setValueByPath(toObject, ['voiceActivityType'], fromVoiceActivityType);
|
|
15081
15202
|
}
|
|
15203
|
+
const fromAudioOffset = getValueByPath(fromObject, ['audioOffset']);
|
|
15204
|
+
if (fromAudioOffset != null) {
|
|
15205
|
+
setValueByPath(toObject, ['audioOffset'], fromAudioOffset);
|
|
15206
|
+
}
|
|
15082
15207
|
return toObject;
|
|
15083
15208
|
}
|
|
15084
15209
|
|
|
@@ -15256,6 +15381,29 @@ function computeTokensResponseFromVertex(fromObject, _rootObject) {
|
|
|
15256
15381
|
}
|
|
15257
15382
|
return toObject;
|
|
15258
15383
|
}
|
|
15384
|
+
function computerUseToVertex(fromObject, _rootObject) {
|
|
15385
|
+
const toObject = {};
|
|
15386
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
15387
|
+
if (fromEnvironment != null) {
|
|
15388
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
15389
|
+
}
|
|
15390
|
+
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
15391
|
+
'excludedPredefinedFunctions',
|
|
15392
|
+
]);
|
|
15393
|
+
if (fromExcludedPredefinedFunctions != null) {
|
|
15394
|
+
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
15395
|
+
}
|
|
15396
|
+
const fromEnablePromptInjectionDetection = getValueByPath(fromObject, [
|
|
15397
|
+
'enablePromptInjectionDetection',
|
|
15398
|
+
]);
|
|
15399
|
+
if (fromEnablePromptInjectionDetection != null) {
|
|
15400
|
+
setValueByPath(toObject, ['enablePromptInjectionDetection'], fromEnablePromptInjectionDetection);
|
|
15401
|
+
}
|
|
15402
|
+
if (getValueByPath(fromObject, ['disabledSafetyPolicies']) !== undefined) {
|
|
15403
|
+
throw new Error('disabledSafetyPolicies parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
15404
|
+
}
|
|
15405
|
+
return toObject;
|
|
15406
|
+
}
|
|
15259
15407
|
function contentEmbeddingFromVertex(fromObject, rootObject) {
|
|
15260
15408
|
const toObject = {};
|
|
15261
15409
|
const fromValues = getValueByPath(fromObject, ['values']);
|
|
@@ -18334,7 +18482,7 @@ function toolToVertex(fromObject, rootObject) {
|
|
|
18334
18482
|
}
|
|
18335
18483
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
18336
18484
|
if (fromComputerUse != null) {
|
|
18337
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
18485
|
+
setValueByPath(toObject, ['computerUse'], computerUseToVertex(fromComputerUse));
|
|
18338
18486
|
}
|
|
18339
18487
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
18340
18488
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -19730,7 +19878,7 @@ class Models extends BaseModule {
|
|
|
19730
19878
|
this.generateContent = async (params) => {
|
|
19731
19879
|
var _a, _b, _c, _d, _e;
|
|
19732
19880
|
const transformedParams = await this.processParamsMaybeAddMcpUsage(params);
|
|
19733
|
-
this.
|
|
19881
|
+
this.maybeMoveToResponseJsonSchema(params);
|
|
19734
19882
|
if (!hasCallableTools(params) || shouldDisableAfc(params.config)) {
|
|
19735
19883
|
return await this.generateContentInternal(transformedParams);
|
|
19736
19884
|
}
|
|
@@ -19822,7 +19970,7 @@ class Models extends BaseModule {
|
|
|
19822
19970
|
*/
|
|
19823
19971
|
this.generateContentStream = async (params) => {
|
|
19824
19972
|
var _a, _b, _c, _d, _e;
|
|
19825
|
-
this.
|
|
19973
|
+
this.maybeMoveToResponseJsonSchema(params);
|
|
19826
19974
|
if (shouldDisableAfc(params.config)) {
|
|
19827
19975
|
const transformedParams = await this.processParamsMaybeAddMcpUsage(params);
|
|
19828
19976
|
return await this.generateContentStreamInternal(transformedParams);
|
|
@@ -20047,7 +20195,7 @@ class Models extends BaseModule {
|
|
|
20047
20195
|
* To maintain backward compatibility, we move the data that was treated as
|
|
20048
20196
|
* JSON schema from the responseSchema field to the responseJsonSchema field.
|
|
20049
20197
|
*/
|
|
20050
|
-
|
|
20198
|
+
maybeMoveToResponseJsonSchema(params) {
|
|
20051
20199
|
if (params.config && params.config.responseSchema) {
|
|
20052
20200
|
if (!params.config.responseJsonSchema) {
|
|
20053
20201
|
if (Object.keys(params.config.responseSchema).includes('$schema')) {
|
|
@@ -20149,7 +20297,7 @@ class Models extends BaseModule {
|
|
|
20149
20297
|
throw new Error('Function call name was not returned by the model.');
|
|
20150
20298
|
}
|
|
20151
20299
|
if (!afcTools.has(part.functionCall.name)) {
|
|
20152
|
-
throw new Error(`Automatic function calling was requested, but not all the tools the model used implement the CallableTool interface. Available tools: ${afcTools.keys()},
|
|
20300
|
+
throw new Error(`Automatic function calling was requested, but not all the tools the model used implement the CallableTool interface. Available tools: ${afcTools.keys()}, missing tool: ${part.functionCall.name}`);
|
|
20153
20301
|
}
|
|
20154
20302
|
else {
|
|
20155
20303
|
const responseParts = yield __await(afcTools
|
|
@@ -21370,6 +21518,22 @@ function audioTranscriptionConfigToMldev(fromObject) {
|
|
|
21370
21518
|
if (getValueByPath(fromObject, ['languageCodes']) !== undefined) {
|
|
21371
21519
|
throw new Error('languageCodes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
21372
21520
|
}
|
|
21521
|
+
const fromLanguageAuto = getValueByPath(fromObject, ['languageAuto']);
|
|
21522
|
+
if (fromLanguageAuto != null) {
|
|
21523
|
+
setValueByPath(toObject, ['languageAuto'], fromLanguageAuto);
|
|
21524
|
+
}
|
|
21525
|
+
const fromLanguageHints = getValueByPath(fromObject, [
|
|
21526
|
+
'languageHints',
|
|
21527
|
+
]);
|
|
21528
|
+
if (fromLanguageHints != null) {
|
|
21529
|
+
setValueByPath(toObject, ['languageHints'], fromLanguageHints);
|
|
21530
|
+
}
|
|
21531
|
+
const fromAdaptationPhrases = getValueByPath(fromObject, [
|
|
21532
|
+
'adaptationPhrases',
|
|
21533
|
+
]);
|
|
21534
|
+
if (fromAdaptationPhrases != null) {
|
|
21535
|
+
setValueByPath(toObject, ['adaptationPhrases'], fromAdaptationPhrases);
|
|
21536
|
+
}
|
|
21373
21537
|
return toObject;
|
|
21374
21538
|
}
|
|
21375
21539
|
function authConfigToMldev(fromObject) {
|
|
@@ -24010,7 +24174,6 @@ class GoogleGenAI {
|
|
|
24010
24174
|
if (this._interactions !== undefined) {
|
|
24011
24175
|
return this._interactions;
|
|
24012
24176
|
}
|
|
24013
|
-
console.warn('GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.');
|
|
24014
24177
|
this._interactions = new GeminiNextGenInteractions(this.apiClient);
|
|
24015
24178
|
return this._interactions;
|
|
24016
24179
|
}
|