@google/genai 1.23.0 → 1.24.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/dist/genai.d.ts +19 -0
- package/dist/index.cjs +75 -11
- package/dist/index.mjs +75 -11
- package/dist/index.mjs.map +1 -1
- package/dist/node/index.cjs +75 -11
- package/dist/node/index.mjs +75 -11
- package/dist/node/index.mjs.map +1 -1
- package/dist/node/node.d.ts +19 -0
- package/dist/web/index.mjs +75 -11
- package/dist/web/index.mjs.map +1 -1
- package/dist/web/web.d.ts +19 -0
- package/package.json +1 -1
package/dist/node/node.d.ts
CHANGED
|
@@ -3435,6 +3435,8 @@ export declare interface GoogleGenAIOptions {
|
|
|
3435
3435
|
export declare interface GoogleMaps {
|
|
3436
3436
|
/** Optional. Auth config for the Google Maps tool. */
|
|
3437
3437
|
authConfig?: AuthConfig;
|
|
3438
|
+
/** Optional. If true, include the widget context token in the response. */
|
|
3439
|
+
enableWidget?: boolean;
|
|
3438
3440
|
}
|
|
3439
3441
|
|
|
3440
3442
|
/** The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors). */
|
|
@@ -3528,6 +3530,10 @@ export declare interface GroundingChunkMapsPlaceAnswerSourcesReviewSnippet {
|
|
|
3528
3530
|
relativePublishTimeDescription?: string;
|
|
3529
3531
|
/** A reference representing this place review which may be used to look up this place review again. */
|
|
3530
3532
|
review?: string;
|
|
3533
|
+
/** Id of the review referencing the place. */
|
|
3534
|
+
reviewId?: string;
|
|
3535
|
+
/** Title of the review. */
|
|
3536
|
+
title?: string;
|
|
3531
3537
|
}
|
|
3532
3538
|
|
|
3533
3539
|
/** Chunk from context retrieved by the retrieval tools. */
|
|
@@ -3568,10 +3574,20 @@ export declare interface GroundingMetadata {
|
|
|
3568
3574
|
retrievalQueries?: string[];
|
|
3569
3575
|
/** Optional. Google search entry for the following-up web searches. */
|
|
3570
3576
|
searchEntryPoint?: SearchEntryPoint;
|
|
3577
|
+
/** Optional. Output only. List of source flagging uris. This is currently populated only for Google Maps grounding. */
|
|
3578
|
+
sourceFlaggingUris?: GroundingMetadataSourceFlaggingUri[];
|
|
3571
3579
|
/** Optional. Web search queries for the following-up web search. */
|
|
3572
3580
|
webSearchQueries?: string[];
|
|
3573
3581
|
}
|
|
3574
3582
|
|
|
3583
|
+
/** Source content flagging uri for a place or review. This is currently populated only for Google Maps grounding. */
|
|
3584
|
+
export declare interface GroundingMetadataSourceFlaggingUri {
|
|
3585
|
+
/** A link where users can flag a problem with the source (place or review). */
|
|
3586
|
+
flagContentUri?: string;
|
|
3587
|
+
/** Id of the place or review. */
|
|
3588
|
+
sourceId?: string;
|
|
3589
|
+
}
|
|
3590
|
+
|
|
3575
3591
|
/** Grounding support. */
|
|
3576
3592
|
export declare interface GroundingSupport {
|
|
3577
3593
|
/** Confidence score of the support references. Ranges from 0 to 1. 1 is the most confident. For Gemini 2.0 and before, this list must have the same size as the grounding_chunk_indices. For Gemini 2.5 and after, this list will be empty and should be ignored. */
|
|
@@ -3871,6 +3887,8 @@ export declare interface InlinedRequest {
|
|
|
3871
3887
|
/** Content of the request.
|
|
3872
3888
|
*/
|
|
3873
3889
|
contents?: ContentListUnion;
|
|
3890
|
+
/** The metadata to be associated with the request. */
|
|
3891
|
+
metadata?: Record<string, string>;
|
|
3874
3892
|
/** Configuration that contains optional model parameters.
|
|
3875
3893
|
*/
|
|
3876
3894
|
config?: GenerateContentConfig;
|
|
@@ -7341,6 +7359,7 @@ declare namespace types {
|
|
|
7341
7359
|
GroundingSupport,
|
|
7342
7360
|
RetrievalMetadata,
|
|
7343
7361
|
SearchEntryPoint,
|
|
7362
|
+
GroundingMetadataSourceFlaggingUri,
|
|
7344
7363
|
GroundingMetadata,
|
|
7345
7364
|
LogprobsResultCandidate,
|
|
7346
7365
|
LogprobsResultTopCandidates,
|
package/dist/web/index.mjs
CHANGED
|
@@ -3776,6 +3776,17 @@ function getBatchJobParametersToVertex(apiClient, fromObject) {
|
|
|
3776
3776
|
}
|
|
3777
3777
|
return toObject;
|
|
3778
3778
|
}
|
|
3779
|
+
function googleMapsToMldev$4(fromObject) {
|
|
3780
|
+
const toObject = {};
|
|
3781
|
+
if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
|
|
3782
|
+
throw new Error('authConfig parameter is not supported in Gemini API.');
|
|
3783
|
+
}
|
|
3784
|
+
const fromEnableWidget = getValueByPath(fromObject, ['enableWidget']);
|
|
3785
|
+
if (fromEnableWidget != null) {
|
|
3786
|
+
setValueByPath(toObject, ['enableWidget'], fromEnableWidget);
|
|
3787
|
+
}
|
|
3788
|
+
return toObject;
|
|
3789
|
+
}
|
|
3779
3790
|
function googleSearchToMldev$4(fromObject) {
|
|
3780
3791
|
const toObject = {};
|
|
3781
3792
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
@@ -3805,6 +3816,10 @@ function inlinedRequestToMldev(apiClient, fromObject) {
|
|
|
3805
3816
|
}
|
|
3806
3817
|
setValueByPath(toObject, ['request', 'contents'], transformedList);
|
|
3807
3818
|
}
|
|
3819
|
+
const fromMetadata = getValueByPath(fromObject, ['metadata']);
|
|
3820
|
+
if (fromMetadata != null) {
|
|
3821
|
+
setValueByPath(toObject, ['metadata'], fromMetadata);
|
|
3822
|
+
}
|
|
3808
3823
|
const fromConfig = getValueByPath(fromObject, ['config']);
|
|
3809
3824
|
if (fromConfig != null) {
|
|
3810
3825
|
setValueByPath(toObject, ['request', 'generationConfig'], generateContentConfigToMldev$1(apiClient, fromConfig, getValueByPath(toObject, ['request'], {})));
|
|
@@ -4023,8 +4038,9 @@ function toolToMldev$4(fromObject) {
|
|
|
4023
4038
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
4024
4039
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
4025
4040
|
}
|
|
4026
|
-
|
|
4027
|
-
|
|
4041
|
+
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
4042
|
+
if (fromGoogleMaps != null) {
|
|
4043
|
+
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$4(fromGoogleMaps));
|
|
4028
4044
|
}
|
|
4029
4045
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
4030
4046
|
if (fromUrlContext != null) {
|
|
@@ -5047,6 +5063,17 @@ function getCachedContentParametersToVertex(apiClient, fromObject) {
|
|
|
5047
5063
|
}
|
|
5048
5064
|
return toObject;
|
|
5049
5065
|
}
|
|
5066
|
+
function googleMapsToMldev$3(fromObject) {
|
|
5067
|
+
const toObject = {};
|
|
5068
|
+
if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
|
|
5069
|
+
throw new Error('authConfig parameter is not supported in Gemini API.');
|
|
5070
|
+
}
|
|
5071
|
+
const fromEnableWidget = getValueByPath(fromObject, ['enableWidget']);
|
|
5072
|
+
if (fromEnableWidget != null) {
|
|
5073
|
+
setValueByPath(toObject, ['enableWidget'], fromEnableWidget);
|
|
5074
|
+
}
|
|
5075
|
+
return toObject;
|
|
5076
|
+
}
|
|
5050
5077
|
function googleSearchToMldev$3(fromObject) {
|
|
5051
5078
|
const toObject = {};
|
|
5052
5079
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
@@ -5240,8 +5267,9 @@ function toolToMldev$3(fromObject) {
|
|
|
5240
5267
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
5241
5268
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
5242
5269
|
}
|
|
5243
|
-
|
|
5244
|
-
|
|
5270
|
+
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
5271
|
+
if (fromGoogleMaps != null) {
|
|
5272
|
+
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$3(fromGoogleMaps));
|
|
5245
5273
|
}
|
|
5246
5274
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
5247
5275
|
if (fromUrlContext != null) {
|
|
@@ -6724,6 +6752,17 @@ function generationConfigToVertex$1(fromObject) {
|
|
|
6724
6752
|
}
|
|
6725
6753
|
return toObject;
|
|
6726
6754
|
}
|
|
6755
|
+
function googleMapsToMldev$2(fromObject) {
|
|
6756
|
+
const toObject = {};
|
|
6757
|
+
if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
|
|
6758
|
+
throw new Error('authConfig parameter is not supported in Gemini API.');
|
|
6759
|
+
}
|
|
6760
|
+
const fromEnableWidget = getValueByPath(fromObject, ['enableWidget']);
|
|
6761
|
+
if (fromEnableWidget != null) {
|
|
6762
|
+
setValueByPath(toObject, ['enableWidget'], fromEnableWidget);
|
|
6763
|
+
}
|
|
6764
|
+
return toObject;
|
|
6765
|
+
}
|
|
6727
6766
|
function googleSearchToMldev$2(fromObject) {
|
|
6728
6767
|
const toObject = {};
|
|
6729
6768
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
@@ -7243,8 +7282,9 @@ function toolToMldev$2(fromObject) {
|
|
|
7243
7282
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
7244
7283
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
7245
7284
|
}
|
|
7246
|
-
|
|
7247
|
-
|
|
7285
|
+
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
7286
|
+
if (fromGoogleMaps != null) {
|
|
7287
|
+
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$2(fromGoogleMaps));
|
|
7248
7288
|
}
|
|
7249
7289
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
7250
7290
|
if (fromUrlContext != null) {
|
|
@@ -9387,6 +9427,17 @@ function getModelParametersToVertex(apiClient, fromObject) {
|
|
|
9387
9427
|
}
|
|
9388
9428
|
return toObject;
|
|
9389
9429
|
}
|
|
9430
|
+
function googleMapsToMldev$1(fromObject) {
|
|
9431
|
+
const toObject = {};
|
|
9432
|
+
if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
|
|
9433
|
+
throw new Error('authConfig parameter is not supported in Gemini API.');
|
|
9434
|
+
}
|
|
9435
|
+
const fromEnableWidget = getValueByPath(fromObject, ['enableWidget']);
|
|
9436
|
+
if (fromEnableWidget != null) {
|
|
9437
|
+
setValueByPath(toObject, ['enableWidget'], fromEnableWidget);
|
|
9438
|
+
}
|
|
9439
|
+
return toObject;
|
|
9440
|
+
}
|
|
9390
9441
|
function googleSearchToMldev$1(fromObject) {
|
|
9391
9442
|
const toObject = {};
|
|
9392
9443
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
@@ -10101,8 +10152,9 @@ function toolToMldev$1(fromObject) {
|
|
|
10101
10152
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
10102
10153
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
10103
10154
|
}
|
|
10104
|
-
|
|
10105
|
-
|
|
10155
|
+
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
10156
|
+
if (fromGoogleMaps != null) {
|
|
10157
|
+
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev$1(fromGoogleMaps));
|
|
10106
10158
|
}
|
|
10107
10159
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
10108
10160
|
if (fromUrlContext != null) {
|
|
@@ -10484,7 +10536,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
|
|
|
10484
10536
|
const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
|
|
10485
10537
|
const USER_AGENT_HEADER = 'User-Agent';
|
|
10486
10538
|
const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
|
|
10487
|
-
const SDK_VERSION = '1.
|
|
10539
|
+
const SDK_VERSION = '1.24.0'; // x-release-please-version
|
|
10488
10540
|
const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
|
|
10489
10541
|
const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
|
|
10490
10542
|
const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
|
|
@@ -13690,6 +13742,17 @@ function fileDataToMldev(fromObject) {
|
|
|
13690
13742
|
}
|
|
13691
13743
|
return toObject;
|
|
13692
13744
|
}
|
|
13745
|
+
function googleMapsToMldev(fromObject) {
|
|
13746
|
+
const toObject = {};
|
|
13747
|
+
if (getValueByPath(fromObject, ['authConfig']) !== undefined) {
|
|
13748
|
+
throw new Error('authConfig parameter is not supported in Gemini API.');
|
|
13749
|
+
}
|
|
13750
|
+
const fromEnableWidget = getValueByPath(fromObject, ['enableWidget']);
|
|
13751
|
+
if (fromEnableWidget != null) {
|
|
13752
|
+
setValueByPath(toObject, ['enableWidget'], fromEnableWidget);
|
|
13753
|
+
}
|
|
13754
|
+
return toObject;
|
|
13755
|
+
}
|
|
13693
13756
|
function googleSearchToMldev(fromObject) {
|
|
13694
13757
|
const toObject = {};
|
|
13695
13758
|
const fromTimeRangeFilter = getValueByPath(fromObject, [
|
|
@@ -13920,8 +13983,9 @@ function toolToMldev(fromObject) {
|
|
|
13920
13983
|
if (getValueByPath(fromObject, ['enterpriseWebSearch']) !== undefined) {
|
|
13921
13984
|
throw new Error('enterpriseWebSearch parameter is not supported in Gemini API.');
|
|
13922
13985
|
}
|
|
13923
|
-
|
|
13924
|
-
|
|
13986
|
+
const fromGoogleMaps = getValueByPath(fromObject, ['googleMaps']);
|
|
13987
|
+
if (fromGoogleMaps != null) {
|
|
13988
|
+
setValueByPath(toObject, ['googleMaps'], googleMapsToMldev(fromGoogleMaps));
|
|
13925
13989
|
}
|
|
13926
13990
|
const fromUrlContext = getValueByPath(fromObject, ['urlContext']);
|
|
13927
13991
|
if (fromUrlContext != null) {
|