@google/genai 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -1
- package/dist/index.cjs +67 -15
- package/dist/index.mjs +67 -15
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +76 -16
- package/dist/node/index.mjs +76 -16
- package/dist/node/index.mjs.map +1 -1
- package/dist/web/index.mjs +67 -15
- package/dist/web/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,7 +21,21 @@ The Google Gen AI SDK is designed to work with Gemini 2.0 features.
|
|
|
21
21
|
|
|
22
22
|
## Prerequisites
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
1. Node.js version 20 or later
|
|
25
|
+
|
|
26
|
+
### The following are required for Vertex AI users (excluding Vertex AI Studio)
|
|
27
|
+
1. [Select](https://console.cloud.google.com/project) or [create](https://cloud.google.com/resource-manager/docs/creating-managing-projects#creating_a_project) a Google Cloud project.
|
|
28
|
+
1. [Enable billing for your project](https://cloud.google.com/billing/docs/how-to/modify-project).
|
|
29
|
+
1. [Enable the Vertex AI API](https://console.cloud.google.com/flows/enableapi?apiid=aiplatform.googleapis.com).
|
|
30
|
+
1. [Configure authentication](https://cloud.google.com/docs/authentication) for your project.
|
|
31
|
+
* [Install the gcloud CLI](https://cloud.google.com/sdk/docs/install).
|
|
32
|
+
* [Initialize the gcloud CLI](https://cloud.google.com/sdk/docs/initializing).
|
|
33
|
+
* Create local authentication credentials for your user account:
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
gcloud auth application-default login
|
|
37
|
+
```
|
|
38
|
+
A list of accepted authentication options are listed in [GoogleAuthOptions](https://github.com/googleapis/google-auth-library-nodejs/blob/3ae120d0a45c95e36c59c9ac8286483938781f30/src/auth/googleauth.ts#L87) interface of google-auth-library-node.js GitHub repo.
|
|
25
39
|
|
|
26
40
|
## Installation
|
|
27
41
|
|
|
@@ -98,6 +112,33 @@ const ai = new GoogleGenAI({
|
|
|
98
112
|
});
|
|
99
113
|
```
|
|
100
114
|
|
|
115
|
+
### (Optional) (NodeJS only) Using environment variables:
|
|
116
|
+
|
|
117
|
+
For NodeJS environments, you can create a client by configuring the necessary
|
|
118
|
+
environment variables. Configuration setup instructions depends on whether
|
|
119
|
+
you're using the Gemini Developer API or the Gemini API in Vertex AI.
|
|
120
|
+
|
|
121
|
+
**Gemini Developer API:** Set `GOOGLE_API_KEY` as shown below:
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
export GOOGLE_API_KEY='your-api-key'
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**Gemini API on Vertex AI:** Set `GOOGLE_GENAI_USE_VERTEXAI`,
|
|
128
|
+
`GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION`, as shown below:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
export GOOGLE_GENAI_USE_VERTEXAI=true
|
|
132
|
+
export GOOGLE_CLOUD_PROJECT='your-project-id'
|
|
133
|
+
export GOOGLE_CLOUD_LOCATION='us-central1'
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
```typescript
|
|
137
|
+
import {GoogleGenAI} from '@google/genai';
|
|
138
|
+
|
|
139
|
+
const ai = new GoogleGenAI();
|
|
140
|
+
```
|
|
141
|
+
|
|
101
142
|
## API Selection
|
|
102
143
|
|
|
103
144
|
By default, the SDK uses the beta API endpoints provided by Google to support
|
package/dist/index.cjs
CHANGED
|
@@ -1925,16 +1925,16 @@ function flattenTypeArrayToAnyOf(typeList, resultingSchema) {
|
|
|
1925
1925
|
}
|
|
1926
1926
|
const listWithoutNull = typeList.filter((type) => type !== 'null');
|
|
1927
1927
|
if (listWithoutNull.length === 1) {
|
|
1928
|
-
resultingSchema['type'] = Object.
|
|
1929
|
-
?
|
|
1928
|
+
resultingSchema['type'] = Object.values(exports.Type).includes(listWithoutNull[0].toUpperCase())
|
|
1929
|
+
? listWithoutNull[0].toUpperCase()
|
|
1930
1930
|
: exports.Type.TYPE_UNSPECIFIED;
|
|
1931
1931
|
}
|
|
1932
1932
|
else {
|
|
1933
1933
|
resultingSchema['anyOf'] = [];
|
|
1934
1934
|
for (const i of listWithoutNull) {
|
|
1935
1935
|
resultingSchema['anyOf'].push({
|
|
1936
|
-
'type': Object.
|
|
1937
|
-
?
|
|
1936
|
+
'type': Object.values(exports.Type).includes(i.toUpperCase())
|
|
1937
|
+
? i.toUpperCase()
|
|
1938
1938
|
: exports.Type.TYPE_UNSPECIFIED,
|
|
1939
1939
|
});
|
|
1940
1940
|
}
|
|
@@ -2018,7 +2018,7 @@ function processJsonSchema(_jsonSchema) {
|
|
|
2018
2018
|
// beginning of this function.
|
|
2019
2019
|
continue;
|
|
2020
2020
|
}
|
|
2021
|
-
genAISchema['type'] = Object.
|
|
2021
|
+
genAISchema['type'] = Object.values(exports.Type).includes(fieldValue.toUpperCase())
|
|
2022
2022
|
? fieldValue.toUpperCase()
|
|
2023
2023
|
: exports.Type.TYPE_UNSPECIFIED;
|
|
2024
2024
|
}
|
|
@@ -2377,7 +2377,7 @@ function filterToJsonSchema(schema) {
|
|
|
2377
2377
|
}
|
|
2378
2378
|
else if (fieldName === 'type') {
|
|
2379
2379
|
const typeValue = fieldValue.toUpperCase();
|
|
2380
|
-
filteredSchema[fieldName] = Object.
|
|
2380
|
+
filteredSchema[fieldName] = Object.values(exports.Type).includes(typeValue)
|
|
2381
2381
|
? typeValue
|
|
2382
2382
|
: exports.Type.TYPE_UNSPECIFIED;
|
|
2383
2383
|
}
|
|
@@ -3054,6 +3054,10 @@ function googleMapsToVertex$2(apiClient, fromObject) {
|
|
|
3054
3054
|
}
|
|
3055
3055
|
return toObject;
|
|
3056
3056
|
}
|
|
3057
|
+
function urlContextToVertex$2() {
|
|
3058
|
+
const toObject = {};
|
|
3059
|
+
return toObject;
|
|
3060
|
+
}
|
|
3057
3061
|
function toolToVertex$2(apiClient, fromObject) {
|
|
3058
3062
|
const toObject = {};
|
|
3059
3063
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -3092,8 +3096,9 @@ function toolToVertex$2(apiClient, fromObject) {
|
|
|
3092
3096
|
if (fromGoogleMaps != null) {
|
|
3093
3097
|
setValueByPath(toObject, ['googleMaps'], googleMapsToVertex$2(apiClient, fromGoogleMaps));
|
|
3094
3098
|
}
|
|
3095
|
-
|
|
3096
|
-
|
|
3099
|
+
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
3100
|
+
if (fromUrlContext != null) {
|
|
3101
|
+
setValueByPath(toObject, ['urlContext'], urlContextToVertex$2());
|
|
3097
3102
|
}
|
|
3098
3103
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
3099
3104
|
'codeExecution',
|
|
@@ -4348,7 +4353,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
4348
4353
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
4349
4354
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
4350
4355
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
4351
|
-
const SDK_VERSION = '1.
|
|
4356
|
+
const SDK_VERSION = '1.4.0'; // x-release-please-version
|
|
4352
4357
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
4353
4358
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
4354
4359
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -6042,6 +6047,10 @@ function urlContextToMldev$2() {
|
|
|
6042
6047
|
const toObject = {};
|
|
6043
6048
|
return toObject;
|
|
6044
6049
|
}
|
|
6050
|
+
function urlContextToVertex$1() {
|
|
6051
|
+
const toObject = {};
|
|
6052
|
+
return toObject;
|
|
6053
|
+
}
|
|
6045
6054
|
function toolToMldev$2(apiClient, fromObject) {
|
|
6046
6055
|
const toObject = {};
|
|
6047
6056
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -6125,8 +6134,9 @@ function toolToVertex$1(apiClient, fromObject) {
|
|
|
6125
6134
|
if (fromGoogleMaps != null) {
|
|
6126
6135
|
setValueByPath(toObject, ['googleMaps'], googleMapsToVertex$1(apiClient, fromGoogleMaps));
|
|
6127
6136
|
}
|
|
6128
|
-
|
|
6129
|
-
|
|
6137
|
+
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
6138
|
+
if (fromUrlContext != null) {
|
|
6139
|
+
setValueByPath(toObject, ['urlContext'], urlContextToVertex$1());
|
|
6130
6140
|
}
|
|
6131
6141
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
6132
6142
|
'codeExecution',
|
|
@@ -8722,8 +8732,11 @@ function generateVideosConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
8722
8732
|
if (parentObject !== undefined && fromNegativePrompt != null) {
|
|
8723
8733
|
setValueByPath(parentObject, ['parameters', 'negativePrompt'], fromNegativePrompt);
|
|
8724
8734
|
}
|
|
8725
|
-
|
|
8726
|
-
|
|
8735
|
+
const fromEnhancePrompt = getValueByPath(fromObject, [
|
|
8736
|
+
'enhancePrompt',
|
|
8737
|
+
]);
|
|
8738
|
+
if (parentObject !== undefined && fromEnhancePrompt != null) {
|
|
8739
|
+
setValueByPath(parentObject, ['parameters', 'enhancePrompt'], fromEnhancePrompt);
|
|
8727
8740
|
}
|
|
8728
8741
|
if (getValueByPath(fromObject, ['generateAudio']) !== undefined) {
|
|
8729
8742
|
throw new Error('generateAudio parameter is not supported in Gemini API.');
|
|
@@ -9115,6 +9128,10 @@ function googleMapsToVertex(apiClient, fromObject) {
|
|
|
9115
9128
|
}
|
|
9116
9129
|
return toObject;
|
|
9117
9130
|
}
|
|
9131
|
+
function urlContextToVertex() {
|
|
9132
|
+
const toObject = {};
|
|
9133
|
+
return toObject;
|
|
9134
|
+
}
|
|
9118
9135
|
function toolToVertex(apiClient, fromObject) {
|
|
9119
9136
|
const toObject = {};
|
|
9120
9137
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -9153,8 +9170,9 @@ function toolToVertex(apiClient, fromObject) {
|
|
|
9153
9170
|
if (fromGoogleMaps != null) {
|
|
9154
9171
|
setValueByPath(toObject, ['googleMaps'], googleMapsToVertex(apiClient, fromGoogleMaps));
|
|
9155
9172
|
}
|
|
9156
|
-
|
|
9157
|
-
|
|
9173
|
+
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
9174
|
+
if (fromUrlContext != null) {
|
|
9175
|
+
setValueByPath(toObject, ['urlContext'], urlContextToVertex());
|
|
9158
9176
|
}
|
|
9159
9177
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
9160
9178
|
'codeExecution',
|
|
@@ -10745,6 +10763,34 @@ function citationMetadataFromVertex(apiClient, fromObject) {
|
|
|
10745
10763
|
}
|
|
10746
10764
|
return toObject;
|
|
10747
10765
|
}
|
|
10766
|
+
function urlMetadataFromVertex(apiClient, fromObject) {
|
|
10767
|
+
const toObject = {};
|
|
10768
|
+
const fromRetrievedUrl = getValueByPath(fromObject, ['retrievedUrl']);
|
|
10769
|
+
if (fromRetrievedUrl != null) {
|
|
10770
|
+
setValueByPath(toObject, ['retrievedUrl'], fromRetrievedUrl);
|
|
10771
|
+
}
|
|
10772
|
+
const fromUrlRetrievalStatus = getValueByPath(fromObject, [
|
|
10773
|
+
'urlRetrievalStatus',
|
|
10774
|
+
]);
|
|
10775
|
+
if (fromUrlRetrievalStatus != null) {
|
|
10776
|
+
setValueByPath(toObject, ['urlRetrievalStatus'], fromUrlRetrievalStatus);
|
|
10777
|
+
}
|
|
10778
|
+
return toObject;
|
|
10779
|
+
}
|
|
10780
|
+
function urlContextMetadataFromVertex(apiClient, fromObject) {
|
|
10781
|
+
const toObject = {};
|
|
10782
|
+
const fromUrlMetadata = getValueByPath(fromObject, ['urlMetadata']);
|
|
10783
|
+
if (fromUrlMetadata != null) {
|
|
10784
|
+
let transformedList = fromUrlMetadata;
|
|
10785
|
+
if (Array.isArray(transformedList)) {
|
|
10786
|
+
transformedList = transformedList.map((item) => {
|
|
10787
|
+
return urlMetadataFromVertex(apiClient, item);
|
|
10788
|
+
});
|
|
10789
|
+
}
|
|
10790
|
+
setValueByPath(toObject, ['urlMetadata'], transformedList);
|
|
10791
|
+
}
|
|
10792
|
+
return toObject;
|
|
10793
|
+
}
|
|
10748
10794
|
function candidateFromVertex(apiClient, fromObject) {
|
|
10749
10795
|
const toObject = {};
|
|
10750
10796
|
const fromContent = getValueByPath(fromObject, ['content']);
|
|
@@ -10767,6 +10813,12 @@ function candidateFromVertex(apiClient, fromObject) {
|
|
|
10767
10813
|
if (fromFinishReason != null) {
|
|
10768
10814
|
setValueByPath(toObject, ['finishReason'], fromFinishReason);
|
|
10769
10815
|
}
|
|
10816
|
+
const fromUrlContextMetadata = getValueByPath(fromObject, [
|
|
10817
|
+
'urlContextMetadata',
|
|
10818
|
+
]);
|
|
10819
|
+
if (fromUrlContextMetadata != null) {
|
|
10820
|
+
setValueByPath(toObject, ['urlContextMetadata'], urlContextMetadataFromVertex(apiClient, fromUrlContextMetadata));
|
|
10821
|
+
}
|
|
10770
10822
|
const fromAvgLogprobs = getValueByPath(fromObject, ['avgLogprobs']);
|
|
10771
10823
|
if (fromAvgLogprobs != null) {
|
|
10772
10824
|
setValueByPath(toObject, ['avgLogprobs'], fromAvgLogprobs);
|
package/dist/index.mjs
CHANGED
|
@@ -1923,16 +1923,16 @@ function flattenTypeArrayToAnyOf(typeList, resultingSchema) {
|
|
|
1923
1923
|
}
|
|
1924
1924
|
const listWithoutNull = typeList.filter((type) => type !== 'null');
|
|
1925
1925
|
if (listWithoutNull.length === 1) {
|
|
1926
|
-
resultingSchema['type'] = Object.
|
|
1927
|
-
?
|
|
1926
|
+
resultingSchema['type'] = Object.values(Type).includes(listWithoutNull[0].toUpperCase())
|
|
1927
|
+
? listWithoutNull[0].toUpperCase()
|
|
1928
1928
|
: Type.TYPE_UNSPECIFIED;
|
|
1929
1929
|
}
|
|
1930
1930
|
else {
|
|
1931
1931
|
resultingSchema['anyOf'] = [];
|
|
1932
1932
|
for (const i of listWithoutNull) {
|
|
1933
1933
|
resultingSchema['anyOf'].push({
|
|
1934
|
-
'type': Object.
|
|
1935
|
-
?
|
|
1934
|
+
'type': Object.values(Type).includes(i.toUpperCase())
|
|
1935
|
+
? i.toUpperCase()
|
|
1936
1936
|
: Type.TYPE_UNSPECIFIED,
|
|
1937
1937
|
});
|
|
1938
1938
|
}
|
|
@@ -2016,7 +2016,7 @@ function processJsonSchema(_jsonSchema) {
|
|
|
2016
2016
|
// beginning of this function.
|
|
2017
2017
|
continue;
|
|
2018
2018
|
}
|
|
2019
|
-
genAISchema['type'] = Object.
|
|
2019
|
+
genAISchema['type'] = Object.values(Type).includes(fieldValue.toUpperCase())
|
|
2020
2020
|
? fieldValue.toUpperCase()
|
|
2021
2021
|
: Type.TYPE_UNSPECIFIED;
|
|
2022
2022
|
}
|
|
@@ -2375,7 +2375,7 @@ function filterToJsonSchema(schema) {
|
|
|
2375
2375
|
}
|
|
2376
2376
|
else if (fieldName === 'type') {
|
|
2377
2377
|
const typeValue = fieldValue.toUpperCase();
|
|
2378
|
-
filteredSchema[fieldName] = Object.
|
|
2378
|
+
filteredSchema[fieldName] = Object.values(Type).includes(typeValue)
|
|
2379
2379
|
? typeValue
|
|
2380
2380
|
: Type.TYPE_UNSPECIFIED;
|
|
2381
2381
|
}
|
|
@@ -3052,6 +3052,10 @@ function googleMapsToVertex$2(apiClient, fromObject) {
|
|
|
3052
3052
|
}
|
|
3053
3053
|
return toObject;
|
|
3054
3054
|
}
|
|
3055
|
+
function urlContextToVertex$2() {
|
|
3056
|
+
const toObject = {};
|
|
3057
|
+
return toObject;
|
|
3058
|
+
}
|
|
3055
3059
|
function toolToVertex$2(apiClient, fromObject) {
|
|
3056
3060
|
const toObject = {};
|
|
3057
3061
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -3090,8 +3094,9 @@ function toolToVertex$2(apiClient, fromObject) {
|
|
|
3090
3094
|
if (fromGoogleMaps != null) {
|
|
3091
3095
|
setValueByPath(toObject, ['googleMaps'], googleMapsToVertex$2(apiClient, fromGoogleMaps));
|
|
3092
3096
|
}
|
|
3093
|
-
|
|
3094
|
-
|
|
3097
|
+
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
3098
|
+
if (fromUrlContext != null) {
|
|
3099
|
+
setValueByPath(toObject, ['urlContext'], urlContextToVertex$2());
|
|
3095
3100
|
}
|
|
3096
3101
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
3097
3102
|
'codeExecution',
|
|
@@ -4346,7 +4351,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
4346
4351
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
4347
4352
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
4348
4353
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
4349
|
-
const SDK_VERSION = '1.
|
|
4354
|
+
const SDK_VERSION = '1.4.0'; // x-release-please-version
|
|
4350
4355
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
4351
4356
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
4352
4357
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -6040,6 +6045,10 @@ function urlContextToMldev$2() {
|
|
|
6040
6045
|
const toObject = {};
|
|
6041
6046
|
return toObject;
|
|
6042
6047
|
}
|
|
6048
|
+
function urlContextToVertex$1() {
|
|
6049
|
+
const toObject = {};
|
|
6050
|
+
return toObject;
|
|
6051
|
+
}
|
|
6043
6052
|
function toolToMldev$2(apiClient, fromObject) {
|
|
6044
6053
|
const toObject = {};
|
|
6045
6054
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -6123,8 +6132,9 @@ function toolToVertex$1(apiClient, fromObject) {
|
|
|
6123
6132
|
if (fromGoogleMaps != null) {
|
|
6124
6133
|
setValueByPath(toObject, ['googleMaps'], googleMapsToVertex$1(apiClient, fromGoogleMaps));
|
|
6125
6134
|
}
|
|
6126
|
-
|
|
6127
|
-
|
|
6135
|
+
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
6136
|
+
if (fromUrlContext != null) {
|
|
6137
|
+
setValueByPath(toObject, ['urlContext'], urlContextToVertex$1());
|
|
6128
6138
|
}
|
|
6129
6139
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
6130
6140
|
'codeExecution',
|
|
@@ -8720,8 +8730,11 @@ function generateVideosConfigToMldev(apiClient, fromObject, parentObject) {
|
|
|
8720
8730
|
if (parentObject !== undefined && fromNegativePrompt != null) {
|
|
8721
8731
|
setValueByPath(parentObject, ['parameters', 'negativePrompt'], fromNegativePrompt);
|
|
8722
8732
|
}
|
|
8723
|
-
|
|
8724
|
-
|
|
8733
|
+
const fromEnhancePrompt = getValueByPath(fromObject, [
|
|
8734
|
+
'enhancePrompt',
|
|
8735
|
+
]);
|
|
8736
|
+
if (parentObject !== undefined && fromEnhancePrompt != null) {
|
|
8737
|
+
setValueByPath(parentObject, ['parameters', 'enhancePrompt'], fromEnhancePrompt);
|
|
8725
8738
|
}
|
|
8726
8739
|
if (getValueByPath(fromObject, ['generateAudio']) !== undefined) {
|
|
8727
8740
|
throw new Error('generateAudio parameter is not supported in Gemini API.');
|
|
@@ -9113,6 +9126,10 @@ function googleMapsToVertex(apiClient, fromObject) {
|
|
|
9113
9126
|
}
|
|
9114
9127
|
return toObject;
|
|
9115
9128
|
}
|
|
9129
|
+
function urlContextToVertex() {
|
|
9130
|
+
const toObject = {};
|
|
9131
|
+
return toObject;
|
|
9132
|
+
}
|
|
9116
9133
|
function toolToVertex(apiClient, fromObject) {
|
|
9117
9134
|
const toObject = {};
|
|
9118
9135
|
const fromFunctionDeclarations = getValueByPath(fromObject, [
|
|
@@ -9151,8 +9168,9 @@ function toolToVertex(apiClient, fromObject) {
|
|
|
9151
9168
|
if (fromGoogleMaps != null) {
|
|
9152
9169
|
setValueByPath(toObject, ['googleMaps'], googleMapsToVertex(apiClient, fromGoogleMaps));
|
|
9153
9170
|
}
|
|
9154
|
-
|
|
9155
|
-
|
|
9171
|
+
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
9172
|
+
if (fromUrlContext != null) {
|
|
9173
|
+
setValueByPath(toObject, ['urlContext'], urlContextToVertex());
|
|
9156
9174
|
}
|
|
9157
9175
|
const fromCodeExecution = getValueByPath(fromObject, [
|
|
9158
9176
|
'codeExecution',
|
|
@@ -10743,6 +10761,34 @@ function citationMetadataFromVertex(apiClient, fromObject) {
|
|
|
10743
10761
|
}
|
|
10744
10762
|
return toObject;
|
|
10745
10763
|
}
|
|
10764
|
+
function urlMetadataFromVertex(apiClient, fromObject) {
|
|
10765
|
+
const toObject = {};
|
|
10766
|
+
const fromRetrievedUrl = getValueByPath(fromObject, ['retrievedUrl']);
|
|
10767
|
+
if (fromRetrievedUrl != null) {
|
|
10768
|
+
setValueByPath(toObject, ['retrievedUrl'], fromRetrievedUrl);
|
|
10769
|
+
}
|
|
10770
|
+
const fromUrlRetrievalStatus = getValueByPath(fromObject, [
|
|
10771
|
+
'urlRetrievalStatus',
|
|
10772
|
+
]);
|
|
10773
|
+
if (fromUrlRetrievalStatus != null) {
|
|
10774
|
+
setValueByPath(toObject, ['urlRetrievalStatus'], fromUrlRetrievalStatus);
|
|
10775
|
+
}
|
|
10776
|
+
return toObject;
|
|
10777
|
+
}
|
|
10778
|
+
function urlContextMetadataFromVertex(apiClient, fromObject) {
|
|
10779
|
+
const toObject = {};
|
|
10780
|
+
const fromUrlMetadata = getValueByPath(fromObject, ['urlMetadata']);
|
|
10781
|
+
if (fromUrlMetadata != null) {
|
|
10782
|
+
let transformedList = fromUrlMetadata;
|
|
10783
|
+
if (Array.isArray(transformedList)) {
|
|
10784
|
+
transformedList = transformedList.map((item) => {
|
|
10785
|
+
return urlMetadataFromVertex(apiClient, item);
|
|
10786
|
+
});
|
|
10787
|
+
}
|
|
10788
|
+
setValueByPath(toObject, ['urlMetadata'], transformedList);
|
|
10789
|
+
}
|
|
10790
|
+
return toObject;
|
|
10791
|
+
}
|
|
10746
10792
|
function candidateFromVertex(apiClient, fromObject) {
|
|
10747
10793
|
const toObject = {};
|
|
10748
10794
|
const fromContent = getValueByPath(fromObject, ['content']);
|
|
@@ -10765,6 +10811,12 @@ function candidateFromVertex(apiClient, fromObject) {
|
|
|
10765
10811
|
if (fromFinishReason != null) {
|
|
10766
10812
|
setValueByPath(toObject, ['finishReason'], fromFinishReason);
|
|
10767
10813
|
}
|
|
10814
|
+
const fromUrlContextMetadata = getValueByPath(fromObject, [
|
|
10815
|
+
'urlContextMetadata',
|
|
10816
|
+
]);
|
|
10817
|
+
if (fromUrlContextMetadata != null) {
|
|
10818
|
+
setValueByPath(toObject, ['urlContextMetadata'], urlContextMetadataFromVertex(apiClient, fromUrlContextMetadata));
|
|
10819
|
+
}
|
|
10768
10820
|
const fromAvgLogprobs = getValueByPath(fromObject, ['avgLogprobs']);
|
|
10769
10821
|
if (fromAvgLogprobs != null) {
|
|
10770
10822
|
setValueByPath(toObject, ['avgLogprobs'], fromAvgLogprobs);
|