@google/genai 1.3.0 → 1.5.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 +42 -1
- package/dist/genai.d.ts +26 -4
- package/dist/index.cjs +108 -16
- package/dist/index.mjs +108 -16
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +124 -18
- package/dist/node/index.mjs +124 -18
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +26 -4
- package/dist/web/index.mjs +108 -16
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +26 -4
- package/package.json +6 -1
package/dist/node/node.d.ts
CHANGED
|
@@ -456,7 +456,7 @@ export declare class Caches extends BaseModule {
|
|
|
456
456
|
* @example
|
|
457
457
|
* ```ts
|
|
458
458
|
* const cachedContents = await ai.caches.list({config: {'pageSize': 2}});
|
|
459
|
-
* for (const cachedContent of cachedContents) {
|
|
459
|
+
* for await (const cachedContent of cachedContents) {
|
|
460
460
|
* console.log(cachedContent);
|
|
461
461
|
* }
|
|
462
462
|
* ```
|
|
@@ -556,6 +556,10 @@ export declare interface CallableToolConfig {
|
|
|
556
556
|
* Specifies the model's behavior after invoking this tool.
|
|
557
557
|
*/
|
|
558
558
|
behavior?: Behavior;
|
|
559
|
+
/**
|
|
560
|
+
* Timeout for remote calls in milliseconds. Note this timeout applies only to
|
|
561
|
+
* tool remote calls, and not making HTTP requests to the API. */
|
|
562
|
+
timeout?: number;
|
|
559
563
|
}
|
|
560
564
|
|
|
561
565
|
/** A response candidate generated from the model. */
|
|
@@ -2426,6 +2430,8 @@ export declare interface GenerateVideosConfig {
|
|
|
2426
2430
|
enhancePrompt?: boolean;
|
|
2427
2431
|
/** Whether to generate audio along with the video. */
|
|
2428
2432
|
generateAudio?: boolean;
|
|
2433
|
+
/** Image to use as the last frame of generated videos. Only supported for image to video use cases. */
|
|
2434
|
+
lastFrame?: Image_2;
|
|
2429
2435
|
}
|
|
2430
2436
|
|
|
2431
2437
|
/** A video generation operation. */
|
|
@@ -2442,7 +2448,7 @@ export declare interface GenerateVideosOperation {
|
|
|
2442
2448
|
response?: GenerateVideosResponse;
|
|
2443
2449
|
}
|
|
2444
2450
|
|
|
2445
|
-
/** Class that represents the parameters for generating
|
|
2451
|
+
/** Class that represents the parameters for generating videos. */
|
|
2446
2452
|
export declare interface GenerateVideosParameters {
|
|
2447
2453
|
/** ID of the model to use. For a list of models, see `Google models
|
|
2448
2454
|
<https://cloud.google.com/vertex-ai/generative-ai/docs/learn/models>`_. */
|
|
@@ -2450,8 +2456,11 @@ export declare interface GenerateVideosParameters {
|
|
|
2450
2456
|
/** The text prompt for generating the videos. Optional for image to video use cases. */
|
|
2451
2457
|
prompt?: string;
|
|
2452
2458
|
/** The input image for generating the videos.
|
|
2453
|
-
Optional if prompt is provided. */
|
|
2459
|
+
Optional if prompt or video is provided. */
|
|
2454
2460
|
image?: Image_2;
|
|
2461
|
+
/** The input video for video extension use cases.
|
|
2462
|
+
Optional if prompt or image is provided. */
|
|
2463
|
+
video?: Video;
|
|
2455
2464
|
/** Configuration for generating videos. */
|
|
2456
2465
|
config?: GenerateVideosConfig;
|
|
2457
2466
|
}
|
|
@@ -5997,6 +6006,7 @@ declare namespace types {
|
|
|
5997
6006
|
AuthConfig,
|
|
5998
6007
|
GoogleMaps,
|
|
5999
6008
|
UrlContext,
|
|
6009
|
+
VertexAISearchDataStoreSpec,
|
|
6000
6010
|
VertexAISearch,
|
|
6001
6011
|
VertexRagStoreRagResource,
|
|
6002
6012
|
RagRetrievalConfigFilter,
|
|
@@ -6093,9 +6103,9 @@ declare namespace types {
|
|
|
6093
6103
|
ComputeTokensParameters,
|
|
6094
6104
|
TokensInfo,
|
|
6095
6105
|
ComputeTokensResponse,
|
|
6106
|
+
Video,
|
|
6096
6107
|
GenerateVideosConfig,
|
|
6097
6108
|
GenerateVideosParameters,
|
|
6098
|
-
Video,
|
|
6099
6109
|
GeneratedVideo,
|
|
6100
6110
|
GenerateVideosResponse,
|
|
6101
6111
|
GenerateVideosOperation,
|
|
@@ -6447,6 +6457,8 @@ export declare interface UsageMetadata {
|
|
|
6447
6457
|
|
|
6448
6458
|
/** Retrieve from Vertex AI Search datastore or engine for grounding. datastore and engine are mutually exclusive. See https://cloud.google.com/products/agent-builder */
|
|
6449
6459
|
export declare interface VertexAISearch {
|
|
6460
|
+
/** Specifications that define the specific DataStores to be searched, along with configurations for those data stores. This is only considered for Engines with multiple data stores. It should only be set if engine is used. */
|
|
6461
|
+
dataStoreSpecs?: VertexAISearchDataStoreSpec[];
|
|
6450
6462
|
/** Optional. Fully-qualified Vertex AI Search data store resource ID. Format: `projects/{project}/locations/{location}/collections/{collection}/dataStores/{dataStore}` */
|
|
6451
6463
|
datastore?: string;
|
|
6452
6464
|
/** Optional. Fully-qualified Vertex AI Search engine resource ID. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}` */
|
|
@@ -6457,6 +6469,14 @@ export declare interface VertexAISearch {
|
|
|
6457
6469
|
maxResults?: number;
|
|
6458
6470
|
}
|
|
6459
6471
|
|
|
6472
|
+
/** Define data stores within engine to filter on in a search call and configurations for those data stores. For more information, see https://cloud.google.com/generative-ai-app-builder/docs/reference/rpc/google.cloud.discoveryengine.v1#datastorespec */
|
|
6473
|
+
export declare interface VertexAISearchDataStoreSpec {
|
|
6474
|
+
/** Full resource name of DataStore, such as Format: `projects/{project}/locations/{location}/collections/{collection}/dataStores/{dataStore}` */
|
|
6475
|
+
dataStore?: string;
|
|
6476
|
+
/** Optional. Filter specification to filter documents in the data store specified by data_store field. For more information on filtering, see [Filtering](https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata) */
|
|
6477
|
+
filter?: string;
|
|
6478
|
+
}
|
|
6479
|
+
|
|
6460
6480
|
/** Retrieve from Vertex RAG Store for grounding. */
|
|
6461
6481
|
export declare interface VertexRagStore {
|
|
6462
6482
|
/** Optional. Deprecated. Please use rag_resources instead. */
|
|
@@ -6467,6 +6487,8 @@ export declare interface VertexRagStore {
|
|
|
6467
6487
|
ragRetrievalConfig?: RagRetrievalConfig;
|
|
6468
6488
|
/** Optional. Number of top k results to return from the selected corpora. */
|
|
6469
6489
|
similarityTopK?: number;
|
|
6490
|
+
/** Optional. Currently only supported for Gemini Multimodal Live API. In Gemini Multimodal Live API, if `store_context` bool is specified, Gemini will leverage it to automatically memorize the interactions between the client and Gemini, and retrieve context when needed to augment the response generation for users' ongoing and future interactions. */
|
|
6491
|
+
storeContext?: boolean;
|
|
6470
6492
|
/** Optional. Only return results with vector distance smaller than the threshold. */
|
|
6471
6493
|
vectorDistanceThreshold?: number;
|
|
6472
6494
|
}
|
package/dist/web/index.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { CallToolResultSchema } from '@modelcontextprotocol/sdk/types.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* @license
|
|
@@ -1953,16 +1954,16 @@ function flattenTypeArrayToAnyOf(typeList, resultingSchema) {
|
|
|
1953
1954
|
}
|
|
1954
1955
|
const listWithoutNull = typeList.filter((type) => type !== 'null');
|
|
1955
1956
|
if (listWithoutNull.length === 1) {
|
|
1956
|
-
resultingSchema['type'] = Object.
|
|
1957
|
-
?
|
|
1957
|
+
resultingSchema['type'] = Object.values(Type).includes(listWithoutNull[0].toUpperCase())
|
|
1958
|
+
? listWithoutNull[0].toUpperCase()
|
|
1958
1959
|
: Type.TYPE_UNSPECIFIED;
|
|
1959
1960
|
}
|
|
1960
1961
|
else {
|
|
1961
1962
|
resultingSchema['anyOf'] = [];
|
|
1962
1963
|
for (const i of listWithoutNull) {
|
|
1963
1964
|
resultingSchema['anyOf'].push({
|
|
1964
|
-
'type': Object.
|
|
1965
|
-
?
|
|
1965
|
+
'type': Object.values(Type).includes(i.toUpperCase())
|
|
1966
|
+
? i.toUpperCase()
|
|
1966
1967
|
: Type.TYPE_UNSPECIFIED,
|
|
1967
1968
|
});
|
|
1968
1969
|
}
|
|
@@ -2046,7 +2047,7 @@ function processJsonSchema(_jsonSchema) {
|
|
|
2046
2047
|
// beginning of this function.
|
|
2047
2048
|
continue;
|
|
2048
2049
|
}
|
|
2049
|
-
genAISchema['type'] = Object.
|
|
2050
|
+
genAISchema['type'] = Object.values(Type).includes(fieldValue.toUpperCase())
|
|
2050
2051
|
? fieldValue.toUpperCase()
|
|
2051
2052
|
: Type.TYPE_UNSPECIFIED;
|
|
2052
2053
|
}
|
|
@@ -2405,7 +2406,7 @@ function filterToJsonSchema(schema) {
|
|
|
2405
2406
|
}
|
|
2406
2407
|
else if (fieldName === 'type') {
|
|
2407
2408
|
const typeValue = fieldValue.toUpperCase();
|
|
2408
|
-
filteredSchema[fieldName] = Object.
|
|
2409
|
+
filteredSchema[fieldName] = Object.values(Type).includes(typeValue)
|
|
2409
2410
|
? typeValue
|
|
2410
2411
|
: Type.TYPE_UNSPECIFIED;
|
|
2411
2412
|
}
|
|
@@ -3082,6 +3083,10 @@ function googleMapsToVertex$2(apiClient, fromObject) {
|
|
|
3082
3083
|
}
|
|
3083
3084
|
return toObject;
|
|
3084
3085
|
}
|
|
3086
|
+
function urlContextToVertex$2() {
|
|
3087
|
+
const toObject = {};
|
|
3088
|
+
return toObject;
|
|
3089
|
+
}
|
|
3085
3090
|
function toolToVertex$2(apiClient, fromObject) {
|
|
3086
3091
|
const toObject = {};
|
|
3087
3092
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -3120,8 +3125,9 @@ function toolToVertex$2(apiClient, fromObject) {
|
|
|
3120
3125
|
if (fromGoogleMaps != null) {
|
|
3121
3126
|
setValueByPath(toObject, ['googleMaps'], googleMapsToVertex$2(apiClient, fromGoogleMaps));
|
|
3122
3127
|
}
|
|
3123
|
-
|
|
3124
|
-
|
|
3128
|
+
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
3129
|
+
if (fromUrlContext != null) {
|
|
3130
|
+
setValueByPath(toObject, ['urlContext'], urlContextToVertex$2());
|
|
3125
3131
|
}
|
|
3126
3132
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
3127
3133
|
'codeExecution',
|
|
@@ -3631,7 +3637,7 @@ class Caches extends BaseModule {
|
|
|
3631
3637
|
* @example
|
|
3632
3638
|
* ```ts
|
|
3633
3639
|
* const cachedContents = await ai.caches.list({config: {'pageSize': 2}});
|
|
3634
|
-
* for (const cachedContent of cachedContents) {
|
|
3640
|
+
* for await (const cachedContent of cachedContents) {
|
|
3635
3641
|
* console.log(cachedContent);
|
|
3636
3642
|
* }
|
|
3637
3643
|
* ```
|
|
@@ -5423,6 +5429,10 @@ function urlContextToMldev$2() {
|
|
|
5423
5429
|
const toObject = {};
|
|
5424
5430
|
return toObject;
|
|
5425
5431
|
}
|
|
5432
|
+
function urlContextToVertex$1() {
|
|
5433
|
+
const toObject = {};
|
|
5434
|
+
return toObject;
|
|
5435
|
+
}
|
|
5426
5436
|
function toolToMldev$2(apiClient, fromObject) {
|
|
5427
5437
|
const toObject = {};
|
|
5428
5438
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -5506,8 +5516,9 @@ function toolToVertex$1(apiClient, fromObject) {
|
|
|
5506
5516
|
if (fromGoogleMaps != null) {
|
|
5507
5517
|
setValueByPath(toObject, ['googleMaps'], googleMapsToVertex$1(apiClient, fromGoogleMaps));
|
|
5508
5518
|
}
|
|
5509
|
-
|
|
5510
|
-
|
|
5519
|
+
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
5520
|
+
if (fromUrlContext != null) {
|
|
5521
|
+
setValueByPath(toObject, ['urlContext'], urlContextToVertex$1());
|
|
5511
5522
|
}
|
|
5512
5523
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
5513
5524
|
'codeExecution',
|
|
@@ -8103,12 +8114,18 @@ function generateVideosConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
8103
8114
|
if (parentObject !== undefined && fromNegativePrompt != null) {
|
|
8104
8115
|
setValueByPath(parentObject, ['parameters', 'negativePrompt'], fromNegativePrompt);
|
|
8105
8116
|
}
|
|
8106
|
-
|
|
8107
|
-
|
|
8117
|
+
const fromEnhancePrompt = getValueByPath(fromObject, [
|
|
8118
|
+
'enhancePrompt',
|
|
8119
|
+
]);
|
|
8120
|
+
if (parentObject !== undefined && fromEnhancePrompt != null) {
|
|
8121
|
+
setValueByPath(parentObject, ['parameters', 'enhancePrompt'], fromEnhancePrompt);
|
|
8108
8122
|
}
|
|
8109
8123
|
if (getValueByPath(fromObject, ['generateAudio']) !== undefined) {
|
|
8110
8124
|
throw new Error('generateAudio parameter is not supported in Gemini API.');
|
|
8111
8125
|
}
|
|
8126
|
+
if (getValueByPath(fromObject, ['lastFrame']) !== undefined) {
|
|
8127
|
+
throw new Error('lastFrame parameter is not supported in Gemini API.');
|
|
8128
|
+
}
|
|
8112
8129
|
return toObject;
|
|
8113
8130
|
}
|
|
8114
8131
|
function generateVideosParametersToMldev(apiClient, fromObject) {
|
|
@@ -8125,6 +8142,9 @@ function generateVideosParametersToMldev(apiClient, fromObject) {
|
|
|
8125
8142
|
if (fromImage != null) {
|
|
8126
8143
|
setValueByPath(toObject, ['instances[0]', 'image'], imageToMldev(apiClient, fromImage));
|
|
8127
8144
|
}
|
|
8145
|
+
if (getValueByPath(fromObject, ['video']) !== undefined) {
|
|
8146
|
+
throw new Error('video parameter is not supported in Gemini API.');
|
|
8147
|
+
}
|
|
8128
8148
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
8129
8149
|
if (fromConfig != null) {
|
|
8130
8150
|
setValueByPath(toObject, ['config'], generateVideosConfigToMldev(apiClient, fromConfig, toObject));
|
|
@@ -8496,6 +8516,10 @@ function googleMapsToVertex(apiClient, fromObject) {
|
|
|
8496
8516
|
}
|
|
8497
8517
|
return toObject;
|
|
8498
8518
|
}
|
|
8519
|
+
function urlContextToVertex() {
|
|
8520
|
+
const toObject = {};
|
|
8521
|
+
return toObject;
|
|
8522
|
+
}
|
|
8499
8523
|
function toolToVertex(apiClient, fromObject) {
|
|
8500
8524
|
const toObject = {};
|
|
8501
8525
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -8534,8 +8558,9 @@ function toolToVertex(apiClient, fromObject) {
|
|
|
8534
8558
|
if (fromGoogleMaps != null) {
|
|
8535
8559
|
setValueByPath(toObject, ['googleMaps'], googleMapsToVertex(apiClient, fromGoogleMaps));
|
|
8536
8560
|
}
|
|
8537
|
-
|
|
8538
|
-
|
|
8561
|
+
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
8562
|
+
if (fromUrlContext != null) {
|
|
8563
|
+
setValueByPath(toObject, ['urlContext'], urlContextToVertex());
|
|
8539
8564
|
}
|
|
8540
8565
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
8541
8566
|
'codeExecution',
|
|
@@ -9398,6 +9423,22 @@ function computeTokensParametersToVertex(apiClient, fromObject) {
|
|
|
9398
9423
|
}
|
|
9399
9424
|
return toObject;
|
|
9400
9425
|
}
|
|
9426
|
+
function videoToVertex(apiClient, fromObject) {
|
|
9427
|
+
const toObject = {};
|
|
9428
|
+
const fromUri = getValueByPath(fromObject, ['uri']);
|
|
9429
|
+
if (fromUri != null) {
|
|
9430
|
+
setValueByPath(toObject, ['gcsUri'], fromUri);
|
|
9431
|
+
}
|
|
9432
|
+
const fromVideoBytes = getValueByPath(fromObject, ['videoBytes']);
|
|
9433
|
+
if (fromVideoBytes != null) {
|
|
9434
|
+
setValueByPath(toObject, ['bytesBase64Encoded'], tBytes(apiClient, fromVideoBytes));
|
|
9435
|
+
}
|
|
9436
|
+
const fromMimeType = getValueByPath(fromObject, ['mimeType']);
|
|
9437
|
+
if (fromMimeType != null) {
|
|
9438
|
+
setValueByPath(toObject, ['mimeType'], fromMimeType);
|
|
9439
|
+
}
|
|
9440
|
+
return toObject;
|
|
9441
|
+
}
|
|
9401
9442
|
function generateVideosConfigToVertex(apiClient, fromObject, parentObject) {
|
|
9402
9443
|
const toObject = {};
|
|
9403
9444
|
const fromNumberOfVideos = getValueByPath(fromObject, [
|
|
@@ -9460,6 +9501,10 @@ function generateVideosConfigToVertex(apiClient, fromObject, parentObject) {
|
|
|
9460
9501
|
if (parentObject !== undefined && fromGenerateAudio != null) {
|
|
9461
9502
|
setValueByPath(parentObject, ['parameters', 'generateAudio'], fromGenerateAudio);
|
|
9462
9503
|
}
|
|
9504
|
+
const fromLastFrame = getValueByPath(fromObject, ['lastFrame']);
|
|
9505
|
+
if (parentObject !== undefined && fromLastFrame != null) {
|
|
9506
|
+
setValueByPath(parentObject, ['instances[0]', 'lastFrame'], imageToVertex(apiClient, fromLastFrame));
|
|
9507
|
+
}
|
|
9463
9508
|
return toObject;
|
|
9464
9509
|
}
|
|
9465
9510
|
function generateVideosParametersToVertex(apiClient, fromObject) {
|
|
@@ -9476,6 +9521,10 @@ function generateVideosParametersToVertex(apiClient, fromObject) {
|
|
|
9476
9521
|
if (fromImage != null) {
|
|
9477
9522
|
setValueByPath(toObject, ['instances[0]', 'image'], imageToVertex(apiClient, fromImage));
|
|
9478
9523
|
}
|
|
9524
|
+
const fromVideo = getValueByPath(fromObject, ['video']);
|
|
9525
|
+
if (fromVideo != null) {
|
|
9526
|
+
setValueByPath(toObject, ['instances[0]', 'video'], videoToVertex(apiClient, fromVideo));
|
|
9527
|
+
}
|
|
9479
9528
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
9480
9529
|
if (fromConfig != null) {
|
|
9481
9530
|
setValueByPath(toObject, ['config'], generateVideosConfigToVertex(apiClient, fromConfig, toObject));
|
|
@@ -10126,6 +10175,34 @@ function citationMetadataFromVertex(apiClient, fromObject) {
|
|
|
10126
10175
|
}
|
|
10127
10176
|
return toObject;
|
|
10128
10177
|
}
|
|
10178
|
+
function urlMetadataFromVertex(apiClient, fromObject) {
|
|
10179
|
+
const toObject = {};
|
|
10180
|
+
const fromRetrievedUrl = getValueByPath(fromObject, ['retrievedUrl']);
|
|
10181
|
+
if (fromRetrievedUrl != null) {
|
|
10182
|
+
setValueByPath(toObject, ['retrievedUrl'], fromRetrievedUrl);
|
|
10183
|
+
}
|
|
10184
|
+
const fromUrlRetrievalStatus = getValueByPath(fromObject, [
|
|
10185
|
+
'urlRetrievalStatus',
|
|
10186
|
+
]);
|
|
10187
|
+
if (fromUrlRetrievalStatus != null) {
|
|
10188
|
+
setValueByPath(toObject, ['urlRetrievalStatus'], fromUrlRetrievalStatus);
|
|
10189
|
+
}
|
|
10190
|
+
return toObject;
|
|
10191
|
+
}
|
|
10192
|
+
function urlContextMetadataFromVertex(apiClient, fromObject) {
|
|
10193
|
+
const toObject = {};
|
|
10194
|
+
const fromUrlMetadata = getValueByPath(fromObject, ['urlMetadata']);
|
|
10195
|
+
if (fromUrlMetadata != null) {
|
|
10196
|
+
let transformedList = fromUrlMetadata;
|
|
10197
|
+
if (Array.isArray(transformedList)) {
|
|
10198
|
+
transformedList = transformedList.map((item) => {
|
|
10199
|
+
return urlMetadataFromVertex(apiClient, item);
|
|
10200
|
+
});
|
|
10201
|
+
}
|
|
10202
|
+
setValueByPath(toObject, ['urlMetadata'], transformedList);
|
|
10203
|
+
}
|
|
10204
|
+
return toObject;
|
|
10205
|
+
}
|
|
10129
10206
|
function candidateFromVertex(apiClient, fromObject) {
|
|
10130
10207
|
const toObject = {};
|
|
10131
10208
|
const fromContent = getValueByPath(fromObject, ['content']);
|
|
@@ -10148,6 +10225,12 @@ function candidateFromVertex(apiClient, fromObject) {
|
|
|
10148
10225
|
if (fromFinishReason != null) {
|
|
10149
10226
|
setValueByPath(toObject, ['finishReason'], fromFinishReason);
|
|
10150
10227
|
}
|
|
10228
|
+
const fromUrlContextMetadata = getValueByPath(fromObject, [
|
|
10229
|
+
'urlContextMetadata',
|
|
10230
|
+
]);
|
|
10231
|
+
if (fromUrlContextMetadata != null) {
|
|
10232
|
+
setValueByPath(toObject, ['urlContextMetadata'], urlContextMetadataFromVertex(apiClient, fromUrlContextMetadata));
|
|
10233
|
+
}
|
|
10151
10234
|
const fromAvgLogprobs = getValueByPath(fromObject, ['avgLogprobs']);
|
|
10152
10235
|
if (fromAvgLogprobs != null) {
|
|
10153
10236
|
setValueByPath(toObject, ['avgLogprobs'], fromAvgLogprobs);
|
|
@@ -10614,7 +10697,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
10614
10697
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
10615
10698
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
10616
10699
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
10617
|
-
const SDK_VERSION = '1.
|
|
10700
|
+
const SDK_VERSION = '1.5.0'; // x-release-please-version
|
|
10618
10701
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
10619
10702
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
10620
10703
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -11257,9 +11340,18 @@ class McpCallableTool {
|
|
|
11257
11340
|
for (const functionCall of functionCalls) {
|
|
11258
11341
|
if (functionCall.name in this.functionNameToMcpClient) {
|
|
11259
11342
|
const mcpClient = this.functionNameToMcpClient[functionCall.name];
|
|
11343
|
+
let requestOptions = undefined;
|
|
11344
|
+
// TODO: b/424238654 - Add support for finer grained timeout control.
|
|
11345
|
+
if (this.config.timeout) {
|
|
11346
|
+
requestOptions = {
|
|
11347
|
+
timeout: this.config.timeout,
|
|
11348
|
+
};
|
|
11349
|
+
}
|
|
11260
11350
|
const callToolResponse = await mcpClient.callTool({
|
|
11261
11351
|
name: functionCall.name,
|
|
11262
11352
|
arguments: functionCall.args,
|
|
11353
|
+
CallToolResultSchema,
|
|
11354
|
+
requestOptions,
|
|
11263
11355
|
});
|
|
11264
11356
|
functionCallResponseParts.push({
|
|
11265
11357
|
functionResponse: {
|