@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.mjs
CHANGED
|
@@ -644,26 +644,6 @@ var Type;
|
|
|
644
644
|
*/
|
|
645
645
|
Type["NULL"] = "NULL";
|
|
646
646
|
})(Type || (Type = {}));
|
|
647
|
-
/** The environment being operated. */
|
|
648
|
-
var Environment;
|
|
649
|
-
(function (Environment) {
|
|
650
|
-
/**
|
|
651
|
-
* Defaults to browser.
|
|
652
|
-
*/
|
|
653
|
-
Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
|
|
654
|
-
/**
|
|
655
|
-
* Operates in a web browser.
|
|
656
|
-
*/
|
|
657
|
-
Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
|
|
658
|
-
/**
|
|
659
|
-
* Operates in a mobile environment.
|
|
660
|
-
*/
|
|
661
|
-
Environment["ENVIRONMENT_MOBILE"] = "ENVIRONMENT_MOBILE";
|
|
662
|
-
/**
|
|
663
|
-
* Operates in a desktop environment.
|
|
664
|
-
*/
|
|
665
|
-
Environment["ENVIRONMENT_DESKTOP"] = "ENVIRONMENT_DESKTOP";
|
|
666
|
-
})(Environment || (Environment = {}));
|
|
667
647
|
/** Type of auth scheme. This enum is not supported in Gemini API. */
|
|
668
648
|
var AuthType;
|
|
669
649
|
(function (AuthType) {
|
|
@@ -734,6 +714,62 @@ var ApiSpec;
|
|
|
734
714
|
*/
|
|
735
715
|
ApiSpec["ELASTIC_SEARCH"] = "ELASTIC_SEARCH";
|
|
736
716
|
})(ApiSpec || (ApiSpec = {}));
|
|
717
|
+
/** The environment being operated. */
|
|
718
|
+
var Environment;
|
|
719
|
+
(function (Environment) {
|
|
720
|
+
/**
|
|
721
|
+
* Defaults to browser.
|
|
722
|
+
*/
|
|
723
|
+
Environment["ENVIRONMENT_UNSPECIFIED"] = "ENVIRONMENT_UNSPECIFIED";
|
|
724
|
+
/**
|
|
725
|
+
* Operates in a web browser.
|
|
726
|
+
*/
|
|
727
|
+
Environment["ENVIRONMENT_BROWSER"] = "ENVIRONMENT_BROWSER";
|
|
728
|
+
/**
|
|
729
|
+
* Operates in a mobile environment.
|
|
730
|
+
*/
|
|
731
|
+
Environment["ENVIRONMENT_MOBILE"] = "ENVIRONMENT_MOBILE";
|
|
732
|
+
/**
|
|
733
|
+
* Operates in a desktop environment.
|
|
734
|
+
*/
|
|
735
|
+
Environment["ENVIRONMENT_DESKTOP"] = "ENVIRONMENT_DESKTOP";
|
|
736
|
+
})(Environment || (Environment = {}));
|
|
737
|
+
/** SafetyPolicy */
|
|
738
|
+
var SafetyPolicy;
|
|
739
|
+
(function (SafetyPolicy) {
|
|
740
|
+
/**
|
|
741
|
+
* Unspecified safety policy.
|
|
742
|
+
*/
|
|
743
|
+
SafetyPolicy["SAFETY_POLICY_UNSPECIFIED"] = "SAFETY_POLICY_UNSPECIFIED";
|
|
744
|
+
/**
|
|
745
|
+
* Safety policy for financial transactions.
|
|
746
|
+
*/
|
|
747
|
+
SafetyPolicy["FINANCIAL_TRANSACTIONS"] = "FINANCIAL_TRANSACTIONS";
|
|
748
|
+
/**
|
|
749
|
+
* Safety policy for sensitive data modification.
|
|
750
|
+
*/
|
|
751
|
+
SafetyPolicy["SENSITIVE_DATA_MODIFICATION"] = "SENSITIVE_DATA_MODIFICATION";
|
|
752
|
+
/**
|
|
753
|
+
* Safety policy for communication tools (e.g. Gmail, Chat, Meet).
|
|
754
|
+
*/
|
|
755
|
+
SafetyPolicy["COMMUNICATION_TOOL"] = "COMMUNICATION_TOOL";
|
|
756
|
+
/**
|
|
757
|
+
* Safety policy for account creation.
|
|
758
|
+
*/
|
|
759
|
+
SafetyPolicy["ACCOUNT_CREATION"] = "ACCOUNT_CREATION";
|
|
760
|
+
/**
|
|
761
|
+
* Safety policy for data modification.
|
|
762
|
+
*/
|
|
763
|
+
SafetyPolicy["DATA_MODIFICATION"] = "DATA_MODIFICATION";
|
|
764
|
+
/**
|
|
765
|
+
* Safety policy for user consent management.
|
|
766
|
+
*/
|
|
767
|
+
SafetyPolicy["USER_CONSENT_MANAGEMENT"] = "USER_CONSENT_MANAGEMENT";
|
|
768
|
+
/**
|
|
769
|
+
* Safety policy for legal terms and agreements.
|
|
770
|
+
*/
|
|
771
|
+
SafetyPolicy["LEGAL_TERMS_AND_AGREEMENTS"] = "LEGAL_TERMS_AND_AGREEMENTS";
|
|
772
|
+
})(SafetyPolicy || (SafetyPolicy = {}));
|
|
737
773
|
/** Sites with confidence level chosen & above this value will be blocked from the search results. This enum is not supported in Gemini API. */
|
|
738
774
|
var PhishBlockThreshold;
|
|
739
775
|
(function (PhishBlockThreshold) {
|
|
@@ -5913,6 +5949,29 @@ function codeExecutionResultToVertex$3(fromObject) {
|
|
|
5913
5949
|
}
|
|
5914
5950
|
return toObject;
|
|
5915
5951
|
}
|
|
5952
|
+
function computerUseToVertex$2(fromObject) {
|
|
5953
|
+
const toObject = {};
|
|
5954
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
5955
|
+
if (fromEnvironment != null) {
|
|
5956
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
5957
|
+
}
|
|
5958
|
+
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
5959
|
+
'excludedPredefinedFunctions',
|
|
5960
|
+
]);
|
|
5961
|
+
if (fromExcludedPredefinedFunctions != null) {
|
|
5962
|
+
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
5963
|
+
}
|
|
5964
|
+
const fromEnablePromptInjectionDetection = getValueByPath(fromObject, [
|
|
5965
|
+
'enablePromptInjectionDetection',
|
|
5966
|
+
]);
|
|
5967
|
+
if (fromEnablePromptInjectionDetection != null) {
|
|
5968
|
+
setValueByPath(toObject, ['enablePromptInjectionDetection'], fromEnablePromptInjectionDetection);
|
|
5969
|
+
}
|
|
5970
|
+
if (getValueByPath(fromObject, ['disabledSafetyPolicies']) !== undefined) {
|
|
5971
|
+
throw new Error('disabledSafetyPolicies parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
5972
|
+
}
|
|
5973
|
+
return toObject;
|
|
5974
|
+
}
|
|
5916
5975
|
function contentToMldev$3(fromObject) {
|
|
5917
5976
|
const toObject = {};
|
|
5918
5977
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
@@ -6588,7 +6647,7 @@ function toolToVertex$2(fromObject) {
|
|
|
6588
6647
|
}
|
|
6589
6648
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
6590
6649
|
if (fromComputerUse != null) {
|
|
6591
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
6650
|
+
setValueByPath(toObject, ['computerUse'], computerUseToVertex$2(fromComputerUse));
|
|
6592
6651
|
}
|
|
6593
6652
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
6594
6653
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -7739,7 +7798,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
7739
7798
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
7740
7799
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
7741
7800
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
7742
|
-
const SDK_VERSION = '2.
|
|
7801
|
+
const SDK_VERSION = '2.10.0'; // x-release-please-version
|
|
7743
7802
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
7744
7803
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
7745
7804
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -8748,7 +8807,7 @@ class Files extends BaseModule {
|
|
|
8748
8807
|
* file extension.
|
|
8749
8808
|
* - For Blob object inputs, the `mimeType` will be set to the Blob's `type`
|
|
8750
8809
|
* property.
|
|
8751
|
-
*
|
|
8810
|
+
* Some examples for file extension to mimeType mapping:
|
|
8752
8811
|
* .txt -> text/plain
|
|
8753
8812
|
* .json -> application/json
|
|
8754
8813
|
* .jpg -> image/jpeg
|
|
@@ -9880,15 +9939,6 @@ class GoogleGenAiError extends Error {
|
|
|
9880
9939
|
* g3-prettier-ignore-file
|
|
9881
9940
|
*/
|
|
9882
9941
|
class GeminiNextGenAPIClientError extends Error {
|
|
9883
|
-
static [Symbol.hasInstance](instance) {
|
|
9884
|
-
if (Function.prototype[Symbol.hasInstance].call(this, instance)) {
|
|
9885
|
-
return true;
|
|
9886
|
-
}
|
|
9887
|
-
if (this === GeminiNextGenAPIClientError) {
|
|
9888
|
-
return isKnownLegacyErrorLike(instance);
|
|
9889
|
-
}
|
|
9890
|
-
return isNamedLegacyErrorLike(instance, this.name);
|
|
9891
|
-
}
|
|
9892
9942
|
}
|
|
9893
9943
|
/** General errors raised by the GenAI API. */
|
|
9894
9944
|
class APIError extends GeminiNextGenAPIClientError {
|
|
@@ -9903,6 +9953,7 @@ class APIError extends GeminiNextGenAPIClientError {
|
|
|
9903
9953
|
this.rawResponse = undefined;
|
|
9904
9954
|
this.cause = undefined;
|
|
9905
9955
|
this.name = this.constructor.name;
|
|
9956
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
9906
9957
|
}
|
|
9907
9958
|
static makeMessage(status, error, message) {
|
|
9908
9959
|
var _a;
|
|
@@ -9914,15 +9965,6 @@ class APIError extends GeminiNextGenAPIClientError {
|
|
|
9914
9965
|
const statusText = status ? `${status} ` : "";
|
|
9915
9966
|
return `${statusText}${msg}`;
|
|
9916
9967
|
}
|
|
9917
|
-
static [Symbol.hasInstance](instance) {
|
|
9918
|
-
if (Function.prototype[Symbol.hasInstance].call(this, instance)) {
|
|
9919
|
-
return true;
|
|
9920
|
-
}
|
|
9921
|
-
if (this === APIError) {
|
|
9922
|
-
return isAPIErrorLike(instance);
|
|
9923
|
-
}
|
|
9924
|
-
return isNamedLegacyErrorLike(instance, this.name);
|
|
9925
|
-
}
|
|
9926
9968
|
static generate(status, errorResponse, message, headers) {
|
|
9927
9969
|
if (!status || !headers) {
|
|
9928
9970
|
return new APIConnectionError({
|
|
@@ -10063,57 +10105,12 @@ function stringifyErrorBody(error) {
|
|
|
10063
10105
|
function isPlainObject$2(value) {
|
|
10064
10106
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
10065
10107
|
}
|
|
10066
|
-
function isLegacyErrorLike(value) {
|
|
10067
|
-
if (!(value instanceof Error) || !isPlainObject$2(value)) {
|
|
10068
|
-
return false;
|
|
10069
|
-
}
|
|
10070
|
-
return ("status" in value ||
|
|
10071
|
-
"statusCode" in value ||
|
|
10072
|
-
"error" in value ||
|
|
10073
|
-
"headers" in value);
|
|
10074
|
-
}
|
|
10075
|
-
function isAPIErrorLike(value) {
|
|
10076
|
-
return isLegacyErrorLike(value) && "error" in value;
|
|
10077
|
-
}
|
|
10078
10108
|
function isCompatAPIErrorInstance(value) {
|
|
10109
|
+
// Avoid instanceof here so this guard never depends on Symbol.hasInstance.
|
|
10079
10110
|
return typeof value === "object" && value !== null
|
|
10080
10111
|
? APIError.prototype.isPrototypeOf(value)
|
|
10081
10112
|
: false;
|
|
10082
10113
|
}
|
|
10083
|
-
const knownLegacyErrorNames = [
|
|
10084
|
-
"GeminiNextGenAPIClientError",
|
|
10085
|
-
"APIError",
|
|
10086
|
-
"APIUserAbortError",
|
|
10087
|
-
"APIConnectionError",
|
|
10088
|
-
"APIConnectionTimeoutError",
|
|
10089
|
-
"BadRequestError",
|
|
10090
|
-
"AuthenticationError",
|
|
10091
|
-
"PermissionDeniedError",
|
|
10092
|
-
"NotFoundError",
|
|
10093
|
-
"ConflictError",
|
|
10094
|
-
"UnprocessableEntityError",
|
|
10095
|
-
"RateLimitError",
|
|
10096
|
-
"InternalServerError",
|
|
10097
|
-
];
|
|
10098
|
-
const legacySubclassNamesByBaseName = {
|
|
10099
|
-
GeminiNextGenAPIClientError: knownLegacyErrorNames,
|
|
10100
|
-
APIConnectionError: ["APIConnectionTimeoutError"],
|
|
10101
|
-
};
|
|
10102
|
-
function isKnownLegacyErrorLike(value) {
|
|
10103
|
-
if (!isLegacyErrorLike(value)) {
|
|
10104
|
-
return false;
|
|
10105
|
-
}
|
|
10106
|
-
return knownLegacyErrorNames.includes(value.name);
|
|
10107
|
-
}
|
|
10108
|
-
function isNamedLegacyErrorLike(value, name) {
|
|
10109
|
-
var _a, _b;
|
|
10110
|
-
if (!isLegacyErrorLike(value)) {
|
|
10111
|
-
return false;
|
|
10112
|
-
}
|
|
10113
|
-
const valueName = value.name;
|
|
10114
|
-
return (valueName === name ||
|
|
10115
|
-
((_b = (_a = legacySubclassNamesByBaseName[name]) === null || _a === void 0 ? void 0 : _a.includes(valueName)) !== null && _b !== void 0 ? _b : false));
|
|
10116
|
-
}
|
|
10117
10114
|
function defineReadonly(target, key, value) {
|
|
10118
10115
|
Object.defineProperty(target, key, {
|
|
10119
10116
|
configurable: true,
|
|
@@ -10323,7 +10320,7 @@ function serverURLFromOptions(options) {
|
|
|
10323
10320
|
return new URL(u);
|
|
10324
10321
|
}
|
|
10325
10322
|
const SDK_METADATA = {
|
|
10326
|
-
userAgent: "speakeasy-sdk/typescript 2.4.1-preview.4 2.
|
|
10323
|
+
userAgent: "speakeasy-sdk/typescript 2.4.1-preview.4 2.911.0 v1beta @google/genai",
|
|
10327
10324
|
};
|
|
10328
10325
|
|
|
10329
10326
|
/**
|
|
@@ -10872,14 +10869,19 @@ async function retry(fetchFn, options) {
|
|
|
10872
10869
|
statusCodes: options.statusCodes,
|
|
10873
10870
|
retryConnectionErrors: !!options.config.retryConnectionErrors,
|
|
10874
10871
|
}), (_a = options.config.backoff) !== null && _a !== void 0 ? _a : defaultBackoff);
|
|
10872
|
+
case "attempt-count-backoff":
|
|
10873
|
+
return retryAttemptCountBackoff(wrapFetcher(fetchFn, {
|
|
10874
|
+
statusCodes: options.statusCodes,
|
|
10875
|
+
retryConnectionErrors: !!options.config.retryConnectionErrors,
|
|
10876
|
+
}), Object.assign(Object.assign({}, defaultBackoff), options.config.backoff), options.config);
|
|
10875
10877
|
default:
|
|
10876
|
-
return await fetchFn();
|
|
10878
|
+
return await fetchFn(0);
|
|
10877
10879
|
}
|
|
10878
10880
|
}
|
|
10879
10881
|
function wrapFetcher(fn, options) {
|
|
10880
|
-
return async () => {
|
|
10882
|
+
return async (attempt) => {
|
|
10881
10883
|
try {
|
|
10882
|
-
const res = await fn();
|
|
10884
|
+
const res = await fn(attempt);
|
|
10883
10885
|
if (isRetryableResponse(res, options.statusCodes)) {
|
|
10884
10886
|
throw new TemporaryError("Response failed with retryable status code", res);
|
|
10885
10887
|
}
|
|
@@ -10921,7 +10923,7 @@ async function retryBackoff(fn, strategy) {
|
|
|
10921
10923
|
let x = 0;
|
|
10922
10924
|
while (true) {
|
|
10923
10925
|
try {
|
|
10924
|
-
const res = await fn();
|
|
10926
|
+
const res = await fn(x);
|
|
10925
10927
|
return res;
|
|
10926
10928
|
}
|
|
10927
10929
|
catch (err) {
|
|
@@ -10949,7 +10951,46 @@ async function retryBackoff(fn, strategy) {
|
|
|
10949
10951
|
}
|
|
10950
10952
|
}
|
|
10951
10953
|
}
|
|
10954
|
+
async function retryAttemptCountBackoff(fn, strategy, config) {
|
|
10955
|
+
let attempt = 0;
|
|
10956
|
+
while (true) {
|
|
10957
|
+
try {
|
|
10958
|
+
return await fn(attempt);
|
|
10959
|
+
}
|
|
10960
|
+
catch (err) {
|
|
10961
|
+
if (err instanceof PermanentError) {
|
|
10962
|
+
throw err.cause;
|
|
10963
|
+
}
|
|
10964
|
+
if (attempt >= config.maxRetries) {
|
|
10965
|
+
if (err instanceof TemporaryError) {
|
|
10966
|
+
return err.response;
|
|
10967
|
+
}
|
|
10968
|
+
throw err;
|
|
10969
|
+
}
|
|
10970
|
+
let retryInterval = 0;
|
|
10971
|
+
if (err instanceof TemporaryError) {
|
|
10972
|
+
retryInterval = retryIntervalFromResponse(err.response);
|
|
10973
|
+
}
|
|
10974
|
+
if (retryInterval <= 0) {
|
|
10975
|
+
retryInterval =
|
|
10976
|
+
strategy.initialInterval *
|
|
10977
|
+
Math.pow(strategy.exponent, attempt) *
|
|
10978
|
+
(1 - Math.random() * 0.25);
|
|
10979
|
+
}
|
|
10980
|
+
const d = Math.min(retryInterval, strategy.maxInterval);
|
|
10981
|
+
await delay(d);
|
|
10982
|
+
attempt++;
|
|
10983
|
+
}
|
|
10984
|
+
}
|
|
10985
|
+
}
|
|
10952
10986
|
function retryIntervalFromResponse(res) {
|
|
10987
|
+
const retryAfterMsVal = res.headers.get("retry-after-ms");
|
|
10988
|
+
if (retryAfterMsVal) {
|
|
10989
|
+
const parsedMs = Number(retryAfterMsVal);
|
|
10990
|
+
if (Number.isFinite(parsedMs) && parsedMs >= 0) {
|
|
10991
|
+
return parsedMs;
|
|
10992
|
+
}
|
|
10993
|
+
}
|
|
10953
10994
|
const retryVal = res.headers.get("retry-after") || "";
|
|
10954
10995
|
if (!retryVal) {
|
|
10955
10996
|
return 0;
|
|
@@ -11404,13 +11445,12 @@ class Stream extends ReadableStream {
|
|
|
11404
11445
|
cancel: reason => upstream.cancel(reason),
|
|
11405
11446
|
});
|
|
11406
11447
|
}
|
|
11407
|
-
|
|
11408
|
-
[Symbol.asyncIterator]() {
|
|
11448
|
+
[Symbol.asyncIterator](options) {
|
|
11409
11449
|
const fn = ReadableStream.prototype[Symbol.asyncIterator];
|
|
11410
11450
|
if (typeof fn === "function")
|
|
11411
|
-
return fn.call(this);
|
|
11451
|
+
return fn.call(this, options);
|
|
11412
11452
|
const reader = this.getReader();
|
|
11413
|
-
|
|
11453
|
+
const iterator = {
|
|
11414
11454
|
next: async () => {
|
|
11415
11455
|
const r = await reader.read();
|
|
11416
11456
|
if (r.done) {
|
|
@@ -11433,6 +11473,17 @@ class Stream extends ReadableStream {
|
|
|
11433
11473
|
return this;
|
|
11434
11474
|
},
|
|
11435
11475
|
};
|
|
11476
|
+
const asyncDispose = Symbol.asyncDispose;
|
|
11477
|
+
if (asyncDispose) {
|
|
11478
|
+
iterator[asyncDispose] = async () => {
|
|
11479
|
+
var _a;
|
|
11480
|
+
await ((_a = iterator.return) === null || _a === void 0 ? void 0 : _a.call(iterator));
|
|
11481
|
+
};
|
|
11482
|
+
}
|
|
11483
|
+
return iterator;
|
|
11484
|
+
}
|
|
11485
|
+
values(options) {
|
|
11486
|
+
return this[Symbol.asyncIterator](options);
|
|
11436
11487
|
}
|
|
11437
11488
|
}
|
|
11438
11489
|
const CR = 13;
|
|
@@ -11573,7 +11624,16 @@ function match(...matchers) {
|
|
|
11573
11624
|
switch (encoding) {
|
|
11574
11625
|
case "json":
|
|
11575
11626
|
body = await response.text();
|
|
11576
|
-
|
|
11627
|
+
try {
|
|
11628
|
+
raw = JSON.parse(body);
|
|
11629
|
+
}
|
|
11630
|
+
catch (err) {
|
|
11631
|
+
// Passthrough for malformed error bodies; success bodies must be valid.
|
|
11632
|
+
if (!("err" in matcher)) {
|
|
11633
|
+
throw err;
|
|
11634
|
+
}
|
|
11635
|
+
raw = body;
|
|
11636
|
+
}
|
|
11577
11637
|
break;
|
|
11578
11638
|
case "jsonl":
|
|
11579
11639
|
raw = response.body;
|
|
@@ -11931,7 +11991,7 @@ async function $do$e(client, body, api_version, options) {
|
|
|
11931
11991
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
11932
11992
|
|| client._options.retry_config
|
|
11933
11993
|
|| {
|
|
11934
|
-
strategy: "backoff",
|
|
11994
|
+
strategy: "attempt-count-backoff",
|
|
11935
11995
|
backoff: {
|
|
11936
11996
|
initialInterval: 500,
|
|
11937
11997
|
maxInterval: 8000,
|
|
@@ -11939,6 +11999,7 @@ async function $do$e(client, body, api_version, options) {
|
|
|
11939
11999
|
maxElapsedTime: 30000,
|
|
11940
12000
|
},
|
|
11941
12001
|
retryConnectionErrors: true,
|
|
12002
|
+
maxRetries: 4,
|
|
11942
12003
|
}
|
|
11943
12004
|
|| { strategy: "none" },
|
|
11944
12005
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -12018,7 +12079,7 @@ async function $do$d(client, id, api_version, options) {
|
|
|
12018
12079
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
12019
12080
|
|| client._options.retry_config
|
|
12020
12081
|
|| {
|
|
12021
|
-
strategy: "backoff",
|
|
12082
|
+
strategy: "attempt-count-backoff",
|
|
12022
12083
|
backoff: {
|
|
12023
12084
|
initialInterval: 500,
|
|
12024
12085
|
maxInterval: 8000,
|
|
@@ -12026,6 +12087,7 @@ async function $do$d(client, id, api_version, options) {
|
|
|
12026
12087
|
maxElapsedTime: 30000,
|
|
12027
12088
|
},
|
|
12028
12089
|
retryConnectionErrors: true,
|
|
12090
|
+
maxRetries: 4,
|
|
12029
12091
|
}
|
|
12030
12092
|
|| { strategy: "none" },
|
|
12031
12093
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -12105,7 +12167,7 @@ async function $do$c(client, id, api_version, options) {
|
|
|
12105
12167
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
12106
12168
|
|| client._options.retry_config
|
|
12107
12169
|
|| {
|
|
12108
|
-
strategy: "backoff",
|
|
12170
|
+
strategy: "attempt-count-backoff",
|
|
12109
12171
|
backoff: {
|
|
12110
12172
|
initialInterval: 500,
|
|
12111
12173
|
maxInterval: 8000,
|
|
@@ -12113,6 +12175,7 @@ async function $do$c(client, id, api_version, options) {
|
|
|
12113
12175
|
maxElapsedTime: 30000,
|
|
12114
12176
|
},
|
|
12115
12177
|
retryConnectionErrors: true,
|
|
12178
|
+
maxRetries: 4,
|
|
12116
12179
|
}
|
|
12117
12180
|
|| { strategy: "none" },
|
|
12118
12181
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -12195,7 +12258,7 @@ async function $do$b(client, api_version, page_size, page_token, parent, options
|
|
|
12195
12258
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
12196
12259
|
|| client._options.retry_config
|
|
12197
12260
|
|| {
|
|
12198
|
-
strategy: "backoff",
|
|
12261
|
+
strategy: "attempt-count-backoff",
|
|
12199
12262
|
backoff: {
|
|
12200
12263
|
initialInterval: 500,
|
|
12201
12264
|
maxInterval: 8000,
|
|
@@ -12203,6 +12266,7 @@ async function $do$b(client, api_version, page_size, page_token, parent, options
|
|
|
12203
12266
|
maxElapsedTime: 30000,
|
|
12204
12267
|
},
|
|
12205
12268
|
retryConnectionErrors: true,
|
|
12269
|
+
maxRetries: 4,
|
|
12206
12270
|
}
|
|
12207
12271
|
|| { strategy: "none" },
|
|
12208
12272
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -12465,7 +12529,7 @@ async function $do$a(client, id, api_version, options) {
|
|
|
12465
12529
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
12466
12530
|
|| client._options.retry_config
|
|
12467
12531
|
|| {
|
|
12468
|
-
strategy: "backoff",
|
|
12532
|
+
strategy: "attempt-count-backoff",
|
|
12469
12533
|
backoff: {
|
|
12470
12534
|
initialInterval: 500,
|
|
12471
12535
|
maxInterval: 8000,
|
|
@@ -12473,6 +12537,7 @@ async function $do$a(client, id, api_version, options) {
|
|
|
12473
12537
|
maxElapsedTime: 30000,
|
|
12474
12538
|
},
|
|
12475
12539
|
retryConnectionErrors: true,
|
|
12540
|
+
maxRetries: 4,
|
|
12476
12541
|
}
|
|
12477
12542
|
|| { strategy: "none" },
|
|
12478
12543
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -12549,7 +12614,7 @@ async function $do$9(client, body, api_version, options) {
|
|
|
12549
12614
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
12550
12615
|
|| client._options.retry_config
|
|
12551
12616
|
|| {
|
|
12552
|
-
strategy: "backoff",
|
|
12617
|
+
strategy: "attempt-count-backoff",
|
|
12553
12618
|
backoff: {
|
|
12554
12619
|
initialInterval: 500,
|
|
12555
12620
|
maxInterval: 8000,
|
|
@@ -12557,6 +12622,7 @@ async function $do$9(client, body, api_version, options) {
|
|
|
12557
12622
|
maxElapsedTime: 30000,
|
|
12558
12623
|
},
|
|
12559
12624
|
retryConnectionErrors: true,
|
|
12625
|
+
maxRetries: 4,
|
|
12560
12626
|
}
|
|
12561
12627
|
|| { strategy: "none" },
|
|
12562
12628
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -12645,7 +12711,7 @@ async function $do$8(client, id, api_version, options) {
|
|
|
12645
12711
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
12646
12712
|
|| client._options.retry_config
|
|
12647
12713
|
|| {
|
|
12648
|
-
strategy: "backoff",
|
|
12714
|
+
strategy: "attempt-count-backoff",
|
|
12649
12715
|
backoff: {
|
|
12650
12716
|
initialInterval: 500,
|
|
12651
12717
|
maxInterval: 8000,
|
|
@@ -12653,6 +12719,7 @@ async function $do$8(client, id, api_version, options) {
|
|
|
12653
12719
|
maxElapsedTime: 30000,
|
|
12654
12720
|
},
|
|
12655
12721
|
retryConnectionErrors: true,
|
|
12722
|
+
maxRetries: 4,
|
|
12656
12723
|
}
|
|
12657
12724
|
|| { strategy: "none" },
|
|
12658
12725
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -12740,7 +12807,7 @@ async function $do$7(client, id, stream, last_event_id, include_input, api_versi
|
|
|
12740
12807
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
12741
12808
|
|| client._options.retry_config
|
|
12742
12809
|
|| {
|
|
12743
|
-
strategy: "backoff",
|
|
12810
|
+
strategy: "attempt-count-backoff",
|
|
12744
12811
|
backoff: {
|
|
12745
12812
|
initialInterval: 500,
|
|
12746
12813
|
maxInterval: 8000,
|
|
@@ -12748,6 +12815,7 @@ async function $do$7(client, id, stream, last_event_id, include_input, api_versi
|
|
|
12748
12815
|
maxElapsedTime: 30000,
|
|
12749
12816
|
},
|
|
12750
12817
|
retryConnectionErrors: true,
|
|
12818
|
+
maxRetries: 4,
|
|
12751
12819
|
}
|
|
12752
12820
|
|| { strategy: "none" },
|
|
12753
12821
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -12866,7 +12934,7 @@ async function $do$6(client, body, api_version, options) {
|
|
|
12866
12934
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
12867
12935
|
|| client._options.retry_config
|
|
12868
12936
|
|| {
|
|
12869
|
-
strategy: "backoff",
|
|
12937
|
+
strategy: "attempt-count-backoff",
|
|
12870
12938
|
backoff: {
|
|
12871
12939
|
initialInterval: 500,
|
|
12872
12940
|
maxInterval: 8000,
|
|
@@ -12874,6 +12942,7 @@ async function $do$6(client, body, api_version, options) {
|
|
|
12874
12942
|
maxElapsedTime: 30000,
|
|
12875
12943
|
},
|
|
12876
12944
|
retryConnectionErrors: true,
|
|
12945
|
+
maxRetries: 4,
|
|
12877
12946
|
}
|
|
12878
12947
|
|| { strategy: "none" },
|
|
12879
12948
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -12953,7 +13022,7 @@ async function $do$5(client, id, api_version, options) {
|
|
|
12953
13022
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
12954
13023
|
|| client._options.retry_config
|
|
12955
13024
|
|| {
|
|
12956
|
-
strategy: "backoff",
|
|
13025
|
+
strategy: "attempt-count-backoff",
|
|
12957
13026
|
backoff: {
|
|
12958
13027
|
initialInterval: 500,
|
|
12959
13028
|
maxInterval: 8000,
|
|
@@ -12961,6 +13030,7 @@ async function $do$5(client, id, api_version, options) {
|
|
|
12961
13030
|
maxElapsedTime: 30000,
|
|
12962
13031
|
},
|
|
12963
13032
|
retryConnectionErrors: true,
|
|
13033
|
+
maxRetries: 4,
|
|
12964
13034
|
}
|
|
12965
13035
|
|| { strategy: "none" },
|
|
12966
13036
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -13040,7 +13110,7 @@ async function $do$4(client, id, api_version, options) {
|
|
|
13040
13110
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
13041
13111
|
|| client._options.retry_config
|
|
13042
13112
|
|| {
|
|
13043
|
-
strategy: "backoff",
|
|
13113
|
+
strategy: "attempt-count-backoff",
|
|
13044
13114
|
backoff: {
|
|
13045
13115
|
initialInterval: 500,
|
|
13046
13116
|
maxInterval: 8000,
|
|
@@ -13048,6 +13118,7 @@ async function $do$4(client, id, api_version, options) {
|
|
|
13048
13118
|
maxElapsedTime: 30000,
|
|
13049
13119
|
},
|
|
13050
13120
|
retryConnectionErrors: true,
|
|
13121
|
+
maxRetries: 4,
|
|
13051
13122
|
}
|
|
13052
13123
|
|| { strategy: "none" },
|
|
13053
13124
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -13128,7 +13199,7 @@ async function $do$3(client, api_version, page_size, page_token, options) {
|
|
|
13128
13199
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
13129
13200
|
|| client._options.retry_config
|
|
13130
13201
|
|| {
|
|
13131
|
-
strategy: "backoff",
|
|
13202
|
+
strategy: "attempt-count-backoff",
|
|
13132
13203
|
backoff: {
|
|
13133
13204
|
initialInterval: 500,
|
|
13134
13205
|
maxInterval: 8000,
|
|
@@ -13136,6 +13207,7 @@ async function $do$3(client, api_version, page_size, page_token, options) {
|
|
|
13136
13207
|
maxElapsedTime: 30000,
|
|
13137
13208
|
},
|
|
13138
13209
|
retryConnectionErrors: true,
|
|
13210
|
+
maxRetries: 4,
|
|
13139
13211
|
}
|
|
13140
13212
|
|| { strategy: "none" },
|
|
13141
13213
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -13218,7 +13290,7 @@ async function $do$2(client, id, api_version, body, options) {
|
|
|
13218
13290
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
13219
13291
|
|| client._options.retry_config
|
|
13220
13292
|
|| {
|
|
13221
|
-
strategy: "backoff",
|
|
13293
|
+
strategy: "attempt-count-backoff",
|
|
13222
13294
|
backoff: {
|
|
13223
13295
|
initialInterval: 500,
|
|
13224
13296
|
maxInterval: 8000,
|
|
@@ -13226,6 +13298,7 @@ async function $do$2(client, id, api_version, body, options) {
|
|
|
13226
13298
|
maxElapsedTime: 30000,
|
|
13227
13299
|
},
|
|
13228
13300
|
retryConnectionErrors: true,
|
|
13301
|
+
maxRetries: 4,
|
|
13229
13302
|
}
|
|
13230
13303
|
|| { strategy: "none" },
|
|
13231
13304
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -13307,7 +13380,7 @@ async function $do$1(client, id, api_version, body, options) {
|
|
|
13307
13380
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
13308
13381
|
|| client._options.retry_config
|
|
13309
13382
|
|| {
|
|
13310
|
-
strategy: "backoff",
|
|
13383
|
+
strategy: "attempt-count-backoff",
|
|
13311
13384
|
backoff: {
|
|
13312
13385
|
initialInterval: 500,
|
|
13313
13386
|
maxInterval: 8000,
|
|
@@ -13315,6 +13388,7 @@ async function $do$1(client, id, api_version, body, options) {
|
|
|
13315
13388
|
maxElapsedTime: 30000,
|
|
13316
13389
|
},
|
|
13317
13390
|
retryConnectionErrors: true,
|
|
13391
|
+
maxRetries: 4,
|
|
13318
13392
|
}
|
|
13319
13393
|
|| { strategy: "none" },
|
|
13320
13394
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -13400,7 +13474,7 @@ async function $do(client, id, api_version, update_mask, body, options) {
|
|
|
13400
13474
|
retry_config: (options === null || options === void 0 ? void 0 : options.retries)
|
|
13401
13475
|
|| client._options.retry_config
|
|
13402
13476
|
|| {
|
|
13403
|
-
strategy: "backoff",
|
|
13477
|
+
strategy: "attempt-count-backoff",
|
|
13404
13478
|
backoff: {
|
|
13405
13479
|
initialInterval: 500,
|
|
13406
13480
|
maxInterval: 8000,
|
|
@@ -13408,6 +13482,7 @@ async function $do(client, id, api_version, update_mask, body, options) {
|
|
|
13408
13482
|
maxElapsedTime: 30000,
|
|
13409
13483
|
},
|
|
13410
13484
|
retryConnectionErrors: true,
|
|
13485
|
+
maxRetries: 4,
|
|
13411
13486
|
}
|
|
13412
13487
|
|| { strategy: "none" },
|
|
13413
13488
|
retry_codes: (options === null || options === void 0 ? void 0 : options.retry_codes) || ["408", "409", "429", "5XX"],
|
|
@@ -13674,7 +13749,7 @@ function toGoogleGenAIRequestOptions(options, streaming = false) {
|
|
|
13674
13749
|
if (!options && !streaming) {
|
|
13675
13750
|
return undefined;
|
|
13676
13751
|
}
|
|
13677
|
-
const _e = options !== null && options !== void 0 ? options : {}, { timeout, maxRetries
|
|
13752
|
+
const _e = options !== null && options !== void 0 ? options : {}, { timeout, maxRetries, defaultBaseURL, query, body, fetchOptions } = _e, rest = __rest(_e, ["timeout", "maxRetries", "defaultBaseURL", "query", "body", "fetchOptions"]);
|
|
13678
13753
|
const nextOptions = Object.assign({}, rest);
|
|
13679
13754
|
if (isPlainObject(query)) {
|
|
13680
13755
|
nextOptions.extra_query = query;
|
|
@@ -13700,6 +13775,13 @@ function toGoogleGenAIRequestOptions(options, streaming = false) {
|
|
|
13700
13775
|
if (timeout_ms !== undefined) {
|
|
13701
13776
|
nextOptions.timeout_ms = timeout_ms;
|
|
13702
13777
|
}
|
|
13778
|
+
if (maxRetries !== undefined) {
|
|
13779
|
+
nextOptions.retries = {
|
|
13780
|
+
strategy: "attempt-count-backoff",
|
|
13781
|
+
retryConnectionErrors: true,
|
|
13782
|
+
maxRetries,
|
|
13783
|
+
};
|
|
13784
|
+
}
|
|
13703
13785
|
if (streaming) {
|
|
13704
13786
|
const headers = new Headers((_d = nextOptions.headers) !== null && _d !== void 0 ? _d : fetch_options === null || fetch_options === void 0 ? void 0 : fetch_options.headers);
|
|
13705
13787
|
headers.set("Accept", "text/event-stream");
|
|
@@ -13897,6 +13979,22 @@ function audioTranscriptionConfigToMldev$1(fromObject) {
|
|
|
13897
13979
|
if (getValueByPath(fromObject, ['languageCodes']) !== undefined) {
|
|
13898
13980
|
throw new Error('languageCodes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
13899
13981
|
}
|
|
13982
|
+
const fromLanguageAuto = getValueByPath(fromObject, ['languageAuto']);
|
|
13983
|
+
if (fromLanguageAuto != null) {
|
|
13984
|
+
setValueByPath(toObject, ['languageAuto'], fromLanguageAuto);
|
|
13985
|
+
}
|
|
13986
|
+
const fromLanguageHints = getValueByPath(fromObject, [
|
|
13987
|
+
'languageHints',
|
|
13988
|
+
]);
|
|
13989
|
+
if (fromLanguageHints != null) {
|
|
13990
|
+
setValueByPath(toObject, ['languageHints'], fromLanguageHints);
|
|
13991
|
+
}
|
|
13992
|
+
const fromAdaptationPhrases = getValueByPath(fromObject, [
|
|
13993
|
+
'adaptationPhrases',
|
|
13994
|
+
]);
|
|
13995
|
+
if (fromAdaptationPhrases != null) {
|
|
13996
|
+
setValueByPath(toObject, ['adaptationPhrases'], fromAdaptationPhrases);
|
|
13997
|
+
}
|
|
13900
13998
|
return toObject;
|
|
13901
13999
|
}
|
|
13902
14000
|
function authConfigToMldev$2(fromObject) {
|
|
@@ -13956,6 +14054,29 @@ function codeExecutionResultToVertex$2(fromObject) {
|
|
|
13956
14054
|
}
|
|
13957
14055
|
return toObject;
|
|
13958
14056
|
}
|
|
14057
|
+
function computerUseToVertex$1(fromObject) {
|
|
14058
|
+
const toObject = {};
|
|
14059
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
14060
|
+
if (fromEnvironment != null) {
|
|
14061
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
14062
|
+
}
|
|
14063
|
+
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
14064
|
+
'excludedPredefinedFunctions',
|
|
14065
|
+
]);
|
|
14066
|
+
if (fromExcludedPredefinedFunctions != null) {
|
|
14067
|
+
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
14068
|
+
}
|
|
14069
|
+
const fromEnablePromptInjectionDetection = getValueByPath(fromObject, [
|
|
14070
|
+
'enablePromptInjectionDetection',
|
|
14071
|
+
]);
|
|
14072
|
+
if (fromEnablePromptInjectionDetection != null) {
|
|
14073
|
+
setValueByPath(toObject, ['enablePromptInjectionDetection'], fromEnablePromptInjectionDetection);
|
|
14074
|
+
}
|
|
14075
|
+
if (getValueByPath(fromObject, ['disabledSafetyPolicies']) !== undefined) {
|
|
14076
|
+
throw new Error('disabledSafetyPolicies parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
14077
|
+
}
|
|
14078
|
+
return toObject;
|
|
14079
|
+
}
|
|
13959
14080
|
function contentToMldev$2(fromObject) {
|
|
13960
14081
|
const toObject = {};
|
|
13961
14082
|
const fromParts = getValueByPath(fromObject, ['parts']);
|
|
@@ -14914,7 +15035,7 @@ function toolToVertex$1(fromObject) {
|
|
|
14914
15035
|
}
|
|
14915
15036
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
14916
15037
|
if (fromComputerUse != null) {
|
|
14917
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
15038
|
+
setValueByPath(toObject, ['computerUse'], computerUseToVertex$1(fromComputerUse));
|
|
14918
15039
|
}
|
|
14919
15040
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
14920
15041
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -15077,6 +15198,10 @@ function voiceActivityFromVertex(fromObject) {
|
|
|
15077
15198
|
if (fromVoiceActivityType != null) {
|
|
15078
15199
|
setValueByPath(toObject, ['voiceActivityType'], fromVoiceActivityType);
|
|
15079
15200
|
}
|
|
15201
|
+
const fromAudioOffset = getValueByPath(fromObject, ['audioOffset']);
|
|
15202
|
+
if (fromAudioOffset != null) {
|
|
15203
|
+
setValueByPath(toObject, ['audioOffset'], fromAudioOffset);
|
|
15204
|
+
}
|
|
15080
15205
|
return toObject;
|
|
15081
15206
|
}
|
|
15082
15207
|
|
|
@@ -15254,6 +15379,29 @@ function computeTokensResponseFromVertex(fromObject, _rootObject) {
|
|
|
15254
15379
|
}
|
|
15255
15380
|
return toObject;
|
|
15256
15381
|
}
|
|
15382
|
+
function computerUseToVertex(fromObject, _rootObject) {
|
|
15383
|
+
const toObject = {};
|
|
15384
|
+
const fromEnvironment = getValueByPath(fromObject, ['environment']);
|
|
15385
|
+
if (fromEnvironment != null) {
|
|
15386
|
+
setValueByPath(toObject, ['environment'], fromEnvironment);
|
|
15387
|
+
}
|
|
15388
|
+
const fromExcludedPredefinedFunctions = getValueByPath(fromObject, [
|
|
15389
|
+
'excludedPredefinedFunctions',
|
|
15390
|
+
]);
|
|
15391
|
+
if (fromExcludedPredefinedFunctions != null) {
|
|
15392
|
+
setValueByPath(toObject, ['excludedPredefinedFunctions'], fromExcludedPredefinedFunctions);
|
|
15393
|
+
}
|
|
15394
|
+
const fromEnablePromptInjectionDetection = getValueByPath(fromObject, [
|
|
15395
|
+
'enablePromptInjectionDetection',
|
|
15396
|
+
]);
|
|
15397
|
+
if (fromEnablePromptInjectionDetection != null) {
|
|
15398
|
+
setValueByPath(toObject, ['enablePromptInjectionDetection'], fromEnablePromptInjectionDetection);
|
|
15399
|
+
}
|
|
15400
|
+
if (getValueByPath(fromObject, ['disabledSafetyPolicies']) !== undefined) {
|
|
15401
|
+
throw new Error('disabledSafetyPolicies parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
15402
|
+
}
|
|
15403
|
+
return toObject;
|
|
15404
|
+
}
|
|
15257
15405
|
function contentEmbeddingFromVertex(fromObject, rootObject) {
|
|
15258
15406
|
const toObject = {};
|
|
15259
15407
|
const fromValues = getValueByPath(fromObject, ['values']);
|
|
@@ -18332,7 +18480,7 @@ function toolToVertex(fromObject, rootObject) {
|
|
|
18332
18480
|
}
|
|
18333
18481
|
const fromComputerUse = getValueByPath(fromObject, ['computerUse']);
|
|
18334
18482
|
if (fromComputerUse != null) {
|
|
18335
|
-
setValueByPath(toObject, ['computerUse'], fromComputerUse);
|
|
18483
|
+
setValueByPath(toObject, ['computerUse'], computerUseToVertex(fromComputerUse));
|
|
18336
18484
|
}
|
|
18337
18485
|
if (getValueByPath(fromObject, ['fileSearch']) !== undefined) {
|
|
18338
18486
|
throw new Error('fileSearch parameter is only supported in Gemini Developer API mode, not in Gemini Enterprise Agent Platform mode.');
|
|
@@ -19728,7 +19876,7 @@ class Models extends BaseModule {
|
|
|
19728
19876
|
this.generateContent = async (params) => {
|
|
19729
19877
|
var _a, _b, _c, _d, _e;
|
|
19730
19878
|
const transformedParams = await this.processParamsMaybeAddMcpUsage(params);
|
|
19731
|
-
this.
|
|
19879
|
+
this.maybeMoveToResponseJsonSchema(params);
|
|
19732
19880
|
if (!hasCallableTools(params) || shouldDisableAfc(params.config)) {
|
|
19733
19881
|
return await this.generateContentInternal(transformedParams);
|
|
19734
19882
|
}
|
|
@@ -19820,7 +19968,7 @@ class Models extends BaseModule {
|
|
|
19820
19968
|
*/
|
|
19821
19969
|
this.generateContentStream = async (params) => {
|
|
19822
19970
|
var _a, _b, _c, _d, _e;
|
|
19823
|
-
this.
|
|
19971
|
+
this.maybeMoveToResponseJsonSchema(params);
|
|
19824
19972
|
if (shouldDisableAfc(params.config)) {
|
|
19825
19973
|
const transformedParams = await this.processParamsMaybeAddMcpUsage(params);
|
|
19826
19974
|
return await this.generateContentStreamInternal(transformedParams);
|
|
@@ -20045,7 +20193,7 @@ class Models extends BaseModule {
|
|
|
20045
20193
|
* To maintain backward compatibility, we move the data that was treated as
|
|
20046
20194
|
* JSON schema from the responseSchema field to the responseJsonSchema field.
|
|
20047
20195
|
*/
|
|
20048
|
-
|
|
20196
|
+
maybeMoveToResponseJsonSchema(params) {
|
|
20049
20197
|
if (params.config && params.config.responseSchema) {
|
|
20050
20198
|
if (!params.config.responseJsonSchema) {
|
|
20051
20199
|
if (Object.keys(params.config.responseSchema).includes('$schema')) {
|
|
@@ -20147,7 +20295,7 @@ class Models extends BaseModule {
|
|
|
20147
20295
|
throw new Error('Function call name was not returned by the model.');
|
|
20148
20296
|
}
|
|
20149
20297
|
if (!afcTools.has(part.functionCall.name)) {
|
|
20150
|
-
throw new Error(`Automatic function calling was requested, but not all the tools the model used implement the CallableTool interface. Available tools: ${afcTools.keys()},
|
|
20298
|
+
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}`);
|
|
20151
20299
|
}
|
|
20152
20300
|
else {
|
|
20153
20301
|
const responseParts = yield __await(afcTools
|
|
@@ -21368,6 +21516,22 @@ function audioTranscriptionConfigToMldev(fromObject) {
|
|
|
21368
21516
|
if (getValueByPath(fromObject, ['languageCodes']) !== undefined) {
|
|
21369
21517
|
throw new Error('languageCodes parameter is only supported in Gemini Enterprise Agent Platform mode, not in Gemini Developer API mode.');
|
|
21370
21518
|
}
|
|
21519
|
+
const fromLanguageAuto = getValueByPath(fromObject, ['languageAuto']);
|
|
21520
|
+
if (fromLanguageAuto != null) {
|
|
21521
|
+
setValueByPath(toObject, ['languageAuto'], fromLanguageAuto);
|
|
21522
|
+
}
|
|
21523
|
+
const fromLanguageHints = getValueByPath(fromObject, [
|
|
21524
|
+
'languageHints',
|
|
21525
|
+
]);
|
|
21526
|
+
if (fromLanguageHints != null) {
|
|
21527
|
+
setValueByPath(toObject, ['languageHints'], fromLanguageHints);
|
|
21528
|
+
}
|
|
21529
|
+
const fromAdaptationPhrases = getValueByPath(fromObject, [
|
|
21530
|
+
'adaptationPhrases',
|
|
21531
|
+
]);
|
|
21532
|
+
if (fromAdaptationPhrases != null) {
|
|
21533
|
+
setValueByPath(toObject, ['adaptationPhrases'], fromAdaptationPhrases);
|
|
21534
|
+
}
|
|
21371
21535
|
return toObject;
|
|
21372
21536
|
}
|
|
21373
21537
|
function authConfigToMldev(fromObject) {
|
|
@@ -24008,7 +24172,6 @@ class GoogleGenAI {
|
|
|
24008
24172
|
if (this._interactions !== undefined) {
|
|
24009
24173
|
return this._interactions;
|
|
24010
24174
|
}
|
|
24011
|
-
console.warn('GoogleGenAI.interactions: Interactions usage is experimental and may change in future versions.');
|
|
24012
24175
|
this._interactions = new GeminiNextGenInteractions(this.apiClient);
|
|
24013
24176
|
return this._interactions;
|
|
24014
24177
|
}
|
|
@@ -24065,5 +24228,5 @@ class GoogleGenAI {
|
|
|
24065
24228
|
}
|
|
24066
24229
|
}
|
|
24067
24230
|
|
|
24068
|
-
export { ActivityHandling, AdapterSize, AggregationMetric, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, CancelTuningJobResponse, Chat, Chats, ComputeTokensResponse, ContentReferenceImage, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DocumentState, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EmbeddingApiType, EndSensitivity, Environment, EvaluateDatasetResponse, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseBlob, FunctionResponseFileData, FunctionResponsePart, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosOperation, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpElementLocation, HttpResponse, ImagePromptLanguage, ImageResizeMode, ImportFileOperation, ImportFileResponse, InlinedEmbedContentResponse, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListDocumentsResponse, ListFileSearchStoresResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MatchOperation, MediaModality, MediaResolution, Modality, ModelStage, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PairwiseChoice, PartMediaResolutionLevel, PersonGeneration, PhishBlockThreshold, ProminentPeople, RawReferenceImage, RecontextImageResponse, RegisterFilesResponse, ReinforcementTuningAutoraterScorerParsedResponseConversionScorer, ReinforcementTuningParseResponseConfig, ReinforcementTuningThinkingLevel, ReplayResponse, ResourceScope, ResponseParseType, SafetyFilterLevel, Scale, SegmentImageResponse, SegmentMode, ServiceTier, Session, SingleEmbedContentResponse, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, ThinkingLevel, Tokens, ToolResponse, ToolType, TrafficType, TuningJobState, TuningMethod, TuningMode, TuningSpeed, TuningTask, TurnCompleteReason, TurnCoverage, Type, UploadToFileSearchStoreOperation, UploadToFileSearchStoreResponse, UploadToFileSearchStoreResumableResponse, UpscaleImageResponse, UrlRetrievalStatus, VadSignalType, ValidateRewardResponse, VideoCompressionQuality, VideoGenerationMaskMode, VideoGenerationReferenceType, VideoOrientation, VoiceActivityType, createFunctionResponsePartFromBase64, createFunctionResponsePartFromUri, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
|
|
24231
|
+
export { ActivityHandling, AdapterSize, AggregationMetric, ApiError, ApiSpec, AuthType, Batches, Behavior, BlockedReason, Caches, CancelTuningJobResponse, Chat, Chats, ComputeTokensResponse, ContentReferenceImage, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DocumentState, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EmbeddingApiType, EndSensitivity, Environment, EvaluateDatasetResponse, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseBlob, FunctionResponseFileData, FunctionResponsePart, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosOperation, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpElementLocation, HttpResponse, ImagePromptLanguage, ImageResizeMode, ImportFileOperation, ImportFileResponse, InlinedEmbedContentResponse, InlinedResponse, JobState, Language, ListBatchJobsResponse, ListCachedContentsResponse, ListDocumentsResponse, ListFileSearchStoresResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MatchOperation, MediaModality, MediaResolution, Modality, ModelStage, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PairwiseChoice, PartMediaResolutionLevel, PersonGeneration, PhishBlockThreshold, ProminentPeople, RawReferenceImage, RecontextImageResponse, RegisterFilesResponse, ReinforcementTuningAutoraterScorerParsedResponseConversionScorer, ReinforcementTuningParseResponseConfig, ReinforcementTuningThinkingLevel, ReplayResponse, ResourceScope, ResponseParseType, SafetyFilterLevel, SafetyPolicy, Scale, SegmentImageResponse, SegmentMode, ServiceTier, Session, SingleEmbedContentResponse, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, ThinkingLevel, Tokens, ToolResponse, ToolType, TrafficType, TuningJobState, TuningMethod, TuningMode, TuningSpeed, TuningTask, TurnCompleteReason, TurnCoverage, Type, UploadToFileSearchStoreOperation, UploadToFileSearchStoreResponse, UploadToFileSearchStoreResumableResponse, UpscaleImageResponse, UrlRetrievalStatus, VadSignalType, ValidateRewardResponse, VideoCompressionQuality, VideoGenerationMaskMode, VideoGenerationReferenceType, VideoOrientation, VoiceActivityType, createFunctionResponsePartFromBase64, createFunctionResponsePartFromUri, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
|
|
24069
24232
|
//# sourceMappingURL=index.mjs.map
|