@firebase/ai 2.3.0 → 2.4.0-canary.22e0a1adb
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/ai-public.d.ts +240 -35
- package/dist/ai.d.ts +241 -35
- package/dist/esm/index.esm.js +295 -92
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/esm/src/api.d.ts +1 -1
- package/dist/esm/src/methods/chrome-adapter.d.ts +1 -1
- package/dist/esm/src/methods/live-session-helpers.d.ts +2 -2
- package/dist/esm/src/methods/live-session.d.ts +71 -7
- package/dist/esm/src/models/imagen-model.d.ts +2 -2
- package/dist/esm/src/requests/hybrid-helpers.d.ts +7 -2
- package/dist/esm/src/requests/imagen-image-format.d.ts +3 -3
- package/dist/esm/src/requests/response-helpers.d.ts +2 -2
- package/dist/esm/src/requests/stream-reader.d.ts +2 -1
- package/dist/esm/src/types/content.d.ts +4 -4
- package/dist/esm/src/types/enums.d.ts +19 -4
- package/dist/esm/src/types/googleai.d.ts +2 -1
- package/dist/esm/src/types/imagen/requests.d.ts +9 -9
- package/dist/esm/src/types/imagen/responses.d.ts +3 -3
- package/dist/esm/src/types/live-responses.d.ts +16 -2
- package/dist/esm/src/types/requests.d.ts +22 -2
- package/dist/esm/src/types/responses.d.ts +99 -1
- package/dist/index.cjs.js +296 -91
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.node.cjs.js +276 -84
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +275 -85
- package/dist/index.node.mjs.map +1 -1
- package/dist/src/api.d.ts +1 -1
- package/dist/src/methods/chrome-adapter.d.ts +1 -1
- package/dist/src/methods/live-session-helpers.d.ts +2 -2
- package/dist/src/methods/live-session.d.ts +71 -7
- package/dist/src/models/imagen-model.d.ts +2 -2
- package/dist/src/requests/hybrid-helpers.d.ts +7 -2
- package/dist/src/requests/imagen-image-format.d.ts +3 -3
- package/dist/src/requests/response-helpers.d.ts +2 -2
- package/dist/src/requests/stream-reader.d.ts +2 -1
- package/dist/src/types/content.d.ts +4 -4
- package/dist/src/types/enums.d.ts +19 -4
- package/dist/src/types/googleai.d.ts +2 -1
- package/dist/src/types/imagen/requests.d.ts +9 -9
- package/dist/src/types/imagen/responses.d.ts +3 -3
- package/dist/src/types/live-responses.d.ts +16 -2
- package/dist/src/types/requests.d.ts +22 -2
- package/dist/src/types/responses.d.ts +99 -1
- package/package.json +8 -8
package/dist/ai-public.d.ts
CHANGED
|
@@ -396,7 +396,7 @@ export declare interface CitationMetadata {
|
|
|
396
396
|
/**
|
|
397
397
|
* The results of code execution run by the model.
|
|
398
398
|
*
|
|
399
|
-
* @
|
|
399
|
+
* @beta
|
|
400
400
|
*/
|
|
401
401
|
export declare interface CodeExecutionResult {
|
|
402
402
|
/**
|
|
@@ -413,7 +413,7 @@ export declare interface CodeExecutionResult {
|
|
|
413
413
|
/**
|
|
414
414
|
* Represents the code execution result from the model.
|
|
415
415
|
*
|
|
416
|
-
* @
|
|
416
|
+
* @beta
|
|
417
417
|
*/
|
|
418
418
|
export declare interface CodeExecutionResultPart {
|
|
419
419
|
text?: never;
|
|
@@ -430,7 +430,7 @@ export declare interface CodeExecutionResultPart {
|
|
|
430
430
|
/**
|
|
431
431
|
* A tool that enables the model to use code execution.
|
|
432
432
|
*
|
|
433
|
-
* @
|
|
433
|
+
* @beta
|
|
434
434
|
*/
|
|
435
435
|
export declare interface CodeExecutionTool {
|
|
436
436
|
/**
|
|
@@ -558,6 +558,12 @@ export declare interface EnhancedGenerateContentResponse extends GenerateContent
|
|
|
558
558
|
* set to `true`.
|
|
559
559
|
*/
|
|
560
560
|
thoughtSummary: () => string | undefined;
|
|
561
|
+
/**
|
|
562
|
+
* Indicates whether inference happened on-device or in-cloud.
|
|
563
|
+
*
|
|
564
|
+
* @beta
|
|
565
|
+
*/
|
|
566
|
+
inferenceSource?: InferenceSource;
|
|
561
567
|
}
|
|
562
568
|
|
|
563
569
|
/**
|
|
@@ -580,7 +586,7 @@ export declare interface ErrorDetails {
|
|
|
580
586
|
/**
|
|
581
587
|
* An interface for executable code returned by the model.
|
|
582
588
|
*
|
|
583
|
-
* @
|
|
589
|
+
* @beta
|
|
584
590
|
*/
|
|
585
591
|
export declare interface ExecutableCode {
|
|
586
592
|
/**
|
|
@@ -596,7 +602,7 @@ export declare interface ExecutableCode {
|
|
|
596
602
|
/**
|
|
597
603
|
* Represents the code that is executed by the model.
|
|
598
604
|
*
|
|
599
|
-
* @
|
|
605
|
+
* @beta
|
|
600
606
|
*/
|
|
601
607
|
export declare interface ExecutableCodePart {
|
|
602
608
|
text?: never;
|
|
@@ -853,6 +859,7 @@ export declare interface GenerateContentCandidate {
|
|
|
853
859
|
safetyRatings?: SafetyRating[];
|
|
854
860
|
citationMetadata?: CitationMetadata;
|
|
855
861
|
groundingMetadata?: GroundingMetadata;
|
|
862
|
+
urlContextMetadata?: URLContextMetadata;
|
|
856
863
|
}
|
|
857
864
|
|
|
858
865
|
/**
|
|
@@ -1044,7 +1051,7 @@ export declare function getGenerativeModel(ai: AI, modelParams: ModelParams | Hy
|
|
|
1044
1051
|
* @throws If the `apiKey` or `projectId` fields are missing in your
|
|
1045
1052
|
* Firebase config.
|
|
1046
1053
|
*
|
|
1047
|
-
* @
|
|
1054
|
+
* @public
|
|
1048
1055
|
*/
|
|
1049
1056
|
export declare function getImagenModel(ai: AI, modelParams: ImagenModelParams, requestOptions?: RequestOptions): ImagenModel;
|
|
1050
1057
|
|
|
@@ -1360,7 +1367,7 @@ export declare interface HybridParams {
|
|
|
1360
1367
|
* See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation }
|
|
1361
1368
|
* for more details and examples of the supported aspect ratios.
|
|
1362
1369
|
*
|
|
1363
|
-
* @
|
|
1370
|
+
* @public
|
|
1364
1371
|
*/
|
|
1365
1372
|
export declare const ImagenAspectRatio: {
|
|
1366
1373
|
/**
|
|
@@ -1394,7 +1401,7 @@ export declare const ImagenAspectRatio: {
|
|
|
1394
1401
|
* See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation }
|
|
1395
1402
|
* for more details and examples of the supported aspect ratios.
|
|
1396
1403
|
*
|
|
1397
|
-
* @
|
|
1404
|
+
* @public
|
|
1398
1405
|
*/
|
|
1399
1406
|
export declare type ImagenAspectRatio = (typeof ImagenAspectRatio)[keyof typeof ImagenAspectRatio];
|
|
1400
1407
|
|
|
@@ -1402,7 +1409,7 @@ export declare type ImagenAspectRatio = (typeof ImagenAspectRatio)[keyof typeof
|
|
|
1402
1409
|
* An image generated by Imagen, stored in a Cloud Storage for Firebase bucket.
|
|
1403
1410
|
*
|
|
1404
1411
|
* This feature is not available yet.
|
|
1405
|
-
* @
|
|
1412
|
+
* @public
|
|
1406
1413
|
*/
|
|
1407
1414
|
export declare interface ImagenGCSImage {
|
|
1408
1415
|
/**
|
|
@@ -1425,7 +1432,7 @@ export declare interface ImagenGCSImage {
|
|
|
1425
1432
|
* See the {@link http://firebase.google.com/docs/vertex-ai/generate-images-imagen | documentation} for
|
|
1426
1433
|
* more details.
|
|
1427
1434
|
*
|
|
1428
|
-
* @
|
|
1435
|
+
* @public
|
|
1429
1436
|
*/
|
|
1430
1437
|
export declare interface ImagenGenerationConfig {
|
|
1431
1438
|
/**
|
|
@@ -1477,7 +1484,7 @@ export declare interface ImagenGenerationConfig {
|
|
|
1477
1484
|
/**
|
|
1478
1485
|
* The response from a request to generate images with Imagen.
|
|
1479
1486
|
*
|
|
1480
|
-
* @
|
|
1487
|
+
* @public
|
|
1481
1488
|
*/
|
|
1482
1489
|
export declare interface ImagenGenerationResponse<T extends ImagenInlineImage | ImagenGCSImage> {
|
|
1483
1490
|
/**
|
|
@@ -1532,7 +1539,7 @@ export declare interface ImagenGenerationResponse<T extends ImagenInlineImage |
|
|
|
1532
1539
|
* }
|
|
1533
1540
|
* ```
|
|
1534
1541
|
*
|
|
1535
|
-
* @
|
|
1542
|
+
* @public
|
|
1536
1543
|
*/
|
|
1537
1544
|
export declare class ImagenImageFormat {
|
|
1538
1545
|
/**
|
|
@@ -1550,7 +1557,7 @@ export declare class ImagenImageFormat {
|
|
|
1550
1557
|
* @param compressionQuality - The level of compression (a number between 0 and 100).
|
|
1551
1558
|
* @returns An {@link ImagenImageFormat} object for a JPEG image.
|
|
1552
1559
|
*
|
|
1553
|
-
* @
|
|
1560
|
+
* @public
|
|
1554
1561
|
*/
|
|
1555
1562
|
static jpeg(compressionQuality?: number): ImagenImageFormat;
|
|
1556
1563
|
/**
|
|
@@ -1558,7 +1565,7 @@ export declare class ImagenImageFormat {
|
|
|
1558
1565
|
*
|
|
1559
1566
|
* @returns An {@link ImagenImageFormat} object for a PNG image.
|
|
1560
1567
|
*
|
|
1561
|
-
* @
|
|
1568
|
+
* @public
|
|
1562
1569
|
*/
|
|
1563
1570
|
static png(): ImagenImageFormat;
|
|
1564
1571
|
}
|
|
@@ -1582,7 +1589,7 @@ export declare class ImagenImageFormat {
|
|
|
1582
1589
|
/**
|
|
1583
1590
|
* An image generated by Imagen, represented as inline data.
|
|
1584
1591
|
*
|
|
1585
|
-
* @
|
|
1592
|
+
* @public
|
|
1586
1593
|
*/
|
|
1587
1594
|
export declare interface ImagenInlineImage {
|
|
1588
1595
|
/**
|
|
@@ -1617,7 +1624,7 @@ export declare interface ImagenInlineImage {
|
|
|
1617
1624
|
* }
|
|
1618
1625
|
* ```
|
|
1619
1626
|
*
|
|
1620
|
-
* @
|
|
1627
|
+
* @public
|
|
1621
1628
|
*/
|
|
1622
1629
|
export declare class ImagenModel extends AIModel {
|
|
1623
1630
|
requestOptions?: RequestOptions | undefined;
|
|
@@ -1656,7 +1663,7 @@ export declare class ImagenModel extends AIModel {
|
|
|
1656
1663
|
* returned object will have a `filteredReason` property.
|
|
1657
1664
|
* If all images are filtered, the `images` array will be empty.
|
|
1658
1665
|
*
|
|
1659
|
-
* @
|
|
1666
|
+
* @public
|
|
1660
1667
|
*/
|
|
1661
1668
|
generateImages(prompt: string): Promise<ImagenGenerationResponse<ImagenInlineImage>>;
|
|
1662
1669
|
/* Excluded from this release type: generateImagesGCS */
|
|
@@ -1665,7 +1672,7 @@ export declare class ImagenModel extends AIModel {
|
|
|
1665
1672
|
/**
|
|
1666
1673
|
* Parameters for configuring an {@link ImagenModel}.
|
|
1667
1674
|
*
|
|
1668
|
-
* @
|
|
1675
|
+
* @public
|
|
1669
1676
|
*/
|
|
1670
1677
|
export declare interface ImagenModelParams {
|
|
1671
1678
|
/**
|
|
@@ -1694,7 +1701,7 @@ export declare interface ImagenModelParams {
|
|
|
1694
1701
|
* See the <a href="http://firebase.google.com/docs/vertex-ai/generate-images">personGeneration</a>
|
|
1695
1702
|
* documentation for more details.
|
|
1696
1703
|
*
|
|
1697
|
-
* @
|
|
1704
|
+
* @public
|
|
1698
1705
|
*/
|
|
1699
1706
|
export declare const ImagenPersonFilterLevel: {
|
|
1700
1707
|
/**
|
|
@@ -1725,7 +1732,7 @@ export declare const ImagenPersonFilterLevel: {
|
|
|
1725
1732
|
* See the <a href="http://firebase.google.com/docs/vertex-ai/generate-images">personGeneration</a>
|
|
1726
1733
|
* documentation for more details.
|
|
1727
1734
|
*
|
|
1728
|
-
* @
|
|
1735
|
+
* @public
|
|
1729
1736
|
*/
|
|
1730
1737
|
export declare type ImagenPersonFilterLevel = (typeof ImagenPersonFilterLevel)[keyof typeof ImagenPersonFilterLevel];
|
|
1731
1738
|
|
|
@@ -1739,7 +1746,7 @@ export declare type ImagenPersonFilterLevel = (typeof ImagenPersonFilterLevel)[k
|
|
|
1739
1746
|
* and the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters | Responsible AI and usage guidelines}
|
|
1740
1747
|
* for more details.
|
|
1741
1748
|
*
|
|
1742
|
-
* @
|
|
1749
|
+
* @public
|
|
1743
1750
|
*/
|
|
1744
1751
|
export declare const ImagenSafetyFilterLevel: {
|
|
1745
1752
|
/**
|
|
@@ -1773,7 +1780,7 @@ export declare const ImagenSafetyFilterLevel: {
|
|
|
1773
1780
|
* and the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters | Responsible AI and usage guidelines}
|
|
1774
1781
|
* for more details.
|
|
1775
1782
|
*
|
|
1776
|
-
* @
|
|
1783
|
+
* @public
|
|
1777
1784
|
*/
|
|
1778
1785
|
export declare type ImagenSafetyFilterLevel = (typeof ImagenSafetyFilterLevel)[keyof typeof ImagenSafetyFilterLevel];
|
|
1779
1786
|
|
|
@@ -1783,7 +1790,7 @@ export declare type ImagenSafetyFilterLevel = (typeof ImagenSafetyFilterLevel)[k
|
|
|
1783
1790
|
* See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation }
|
|
1784
1791
|
* for more details.
|
|
1785
1792
|
*
|
|
1786
|
-
* @
|
|
1793
|
+
* @public
|
|
1787
1794
|
*/
|
|
1788
1795
|
export declare interface ImagenSafetySettings {
|
|
1789
1796
|
/**
|
|
@@ -1832,6 +1839,23 @@ export declare const InferenceMode: {
|
|
|
1832
1839
|
*/
|
|
1833
1840
|
export declare type InferenceMode = (typeof InferenceMode)[keyof typeof InferenceMode];
|
|
1834
1841
|
|
|
1842
|
+
/**
|
|
1843
|
+
* Indicates whether inference happened on-device or in-cloud.
|
|
1844
|
+
*
|
|
1845
|
+
* @beta
|
|
1846
|
+
*/
|
|
1847
|
+
export declare const InferenceSource: {
|
|
1848
|
+
readonly ON_DEVICE: "on_device";
|
|
1849
|
+
readonly IN_CLOUD: "in_cloud";
|
|
1850
|
+
};
|
|
1851
|
+
|
|
1852
|
+
/**
|
|
1853
|
+
* Indicates whether inference happened on-device or in-cloud.
|
|
1854
|
+
*
|
|
1855
|
+
* @beta
|
|
1856
|
+
*/
|
|
1857
|
+
export declare type InferenceSource = (typeof InferenceSource)[keyof typeof InferenceSource];
|
|
1858
|
+
|
|
1835
1859
|
/**
|
|
1836
1860
|
* Content part interface if the part represents an image.
|
|
1837
1861
|
* @public
|
|
@@ -1862,7 +1886,7 @@ export declare class IntegerSchema extends Schema {
|
|
|
1862
1886
|
/**
|
|
1863
1887
|
* The programming language of the code.
|
|
1864
1888
|
*
|
|
1865
|
-
* @
|
|
1889
|
+
* @beta
|
|
1866
1890
|
*/
|
|
1867
1891
|
export declare const Language: {
|
|
1868
1892
|
UNSPECIFIED: string;
|
|
@@ -1872,7 +1896,7 @@ export declare const Language: {
|
|
|
1872
1896
|
/**
|
|
1873
1897
|
* The programming language of the code.
|
|
1874
1898
|
*
|
|
1875
|
-
* @
|
|
1899
|
+
* @beta
|
|
1876
1900
|
*/
|
|
1877
1901
|
export declare type Language = (typeof Language)[keyof typeof Language];
|
|
1878
1902
|
|
|
@@ -2139,23 +2163,65 @@ export declare class LiveSession {
|
|
|
2139
2163
|
*/
|
|
2140
2164
|
send(request: string | Array<string | Part>, turnComplete?: boolean): Promise<void>;
|
|
2141
2165
|
/**
|
|
2142
|
-
* Sends
|
|
2166
|
+
* Sends text to the server in realtime.
|
|
2143
2167
|
*
|
|
2144
|
-
* @
|
|
2168
|
+
* @example
|
|
2169
|
+
* ```javascript
|
|
2170
|
+
* liveSession.sendTextRealtime("Hello, how are you?");
|
|
2171
|
+
* ```
|
|
2172
|
+
*
|
|
2173
|
+
* @param text - The text data to send.
|
|
2145
2174
|
* @throws If this session has been closed.
|
|
2146
2175
|
*
|
|
2147
2176
|
* @beta
|
|
2148
2177
|
*/
|
|
2149
|
-
|
|
2178
|
+
sendTextRealtime(text: string): Promise<void>;
|
|
2150
2179
|
/**
|
|
2151
|
-
* Sends
|
|
2180
|
+
* Sends audio data to the server in realtime.
|
|
2152
2181
|
*
|
|
2153
|
-
* @
|
|
2182
|
+
* @remarks The server requires that the audio data is base64-encoded 16-bit PCM at 16kHz
|
|
2183
|
+
* little-endian.
|
|
2184
|
+
*
|
|
2185
|
+
* @example
|
|
2186
|
+
* ```javascript
|
|
2187
|
+
* // const pcmData = ... base64-encoded 16-bit PCM at 16kHz little-endian.
|
|
2188
|
+
* const blob = { mimeType: "audio/pcm", data: pcmData };
|
|
2189
|
+
* liveSession.sendAudioRealtime(blob);
|
|
2190
|
+
* ```
|
|
2191
|
+
*
|
|
2192
|
+
* @param blob - The base64-encoded PCM data to send to the server in realtime.
|
|
2154
2193
|
* @throws If this session has been closed.
|
|
2155
2194
|
*
|
|
2156
2195
|
* @beta
|
|
2157
2196
|
*/
|
|
2158
|
-
|
|
2197
|
+
sendAudioRealtime(blob: GenerativeContentBlob): Promise<void>;
|
|
2198
|
+
/**
|
|
2199
|
+
* Sends video data to the server in realtime.
|
|
2200
|
+
*
|
|
2201
|
+
* @remarks The server requires that the video is sent as individual video frames at 1 FPS. It
|
|
2202
|
+
* is recommended to set `mimeType` to `image/jpeg`.
|
|
2203
|
+
*
|
|
2204
|
+
* @example
|
|
2205
|
+
* ```javascript
|
|
2206
|
+
* // const videoFrame = ... base64-encoded JPEG data
|
|
2207
|
+
* const blob = { mimeType: "image/jpeg", data: videoFrame };
|
|
2208
|
+
* liveSession.sendVideoRealtime(blob);
|
|
2209
|
+
* ```
|
|
2210
|
+
* @param blob - The base64-encoded video data to send to the server in realtime.
|
|
2211
|
+
* @throws If this session has been closed.
|
|
2212
|
+
*
|
|
2213
|
+
* @beta
|
|
2214
|
+
*/
|
|
2215
|
+
sendVideoRealtime(blob: GenerativeContentBlob): Promise<void>;
|
|
2216
|
+
/**
|
|
2217
|
+
* Sends function responses to the server.
|
|
2218
|
+
*
|
|
2219
|
+
* @param functionResponses - The function responses to send.
|
|
2220
|
+
* @throws If this session has been closed.
|
|
2221
|
+
*
|
|
2222
|
+
* @beta
|
|
2223
|
+
*/
|
|
2224
|
+
sendFunctionResponses(functionResponses: FunctionResponse[]): Promise<void>;
|
|
2159
2225
|
/**
|
|
2160
2226
|
* Yields messages received from the server.
|
|
2161
2227
|
* This can only be used by one consumer at a time.
|
|
@@ -2173,6 +2239,28 @@ export declare class LiveSession {
|
|
|
2173
2239
|
* @beta
|
|
2174
2240
|
*/
|
|
2175
2241
|
close(): Promise<void>;
|
|
2242
|
+
/**
|
|
2243
|
+
* Sends realtime input to the server.
|
|
2244
|
+
*
|
|
2245
|
+
* @deprecated Use `sendTextRealtime()`, `sendAudioRealtime()`, and `sendVideoRealtime()` instead.
|
|
2246
|
+
*
|
|
2247
|
+
* @param mediaChunks - The media chunks to send.
|
|
2248
|
+
* @throws If this session has been closed.
|
|
2249
|
+
*
|
|
2250
|
+
* @beta
|
|
2251
|
+
*/
|
|
2252
|
+
sendMediaChunks(mediaChunks: GenerativeContentBlob[]): Promise<void>;
|
|
2253
|
+
/**
|
|
2254
|
+
* @deprecated Use `sendTextRealtime()`, `sendAudioRealtime()`, and `sendVideoRealtime()` instead.
|
|
2255
|
+
*
|
|
2256
|
+
* Sends a stream of {@link GenerativeContentBlob}.
|
|
2257
|
+
*
|
|
2258
|
+
* @param mediaChunkStream - The stream of {@link GenerativeContentBlob} to send.
|
|
2259
|
+
* @throws If this session has been closed.
|
|
2260
|
+
*
|
|
2261
|
+
* @beta
|
|
2262
|
+
*/
|
|
2263
|
+
sendMediaStream(mediaChunkStream: ReadableStream<GenerativeContentBlob>): Promise<void>;
|
|
2176
2264
|
}
|
|
2177
2265
|
|
|
2178
2266
|
/**
|
|
@@ -2289,7 +2377,7 @@ export declare interface OnDeviceParams {
|
|
|
2289
2377
|
/**
|
|
2290
2378
|
* Represents the result of the code execution.
|
|
2291
2379
|
*
|
|
2292
|
-
* @
|
|
2380
|
+
* @beta
|
|
2293
2381
|
*/
|
|
2294
2382
|
export declare const Outcome: {
|
|
2295
2383
|
UNSPECIFIED: string;
|
|
@@ -2301,7 +2389,7 @@ export declare const Outcome: {
|
|
|
2301
2389
|
/**
|
|
2302
2390
|
* Represents the result of the code execution.
|
|
2303
2391
|
*
|
|
2304
|
-
* @
|
|
2392
|
+
* @beta
|
|
2305
2393
|
*/
|
|
2306
2394
|
export declare type Outcome = (typeof Outcome)[keyof typeof Outcome];
|
|
2307
2395
|
|
|
@@ -2776,7 +2864,7 @@ export declare interface StartAudioConversationOptions {
|
|
|
2776
2864
|
* The handler should perform the function call and return the result as a `Part`,
|
|
2777
2865
|
* which will then be sent back to the model.
|
|
2778
2866
|
*/
|
|
2779
|
-
functionCallingHandler?: (functionCalls:
|
|
2867
|
+
functionCallingHandler?: (functionCalls: FunctionCall[]) => Promise<FunctionResponse>;
|
|
2780
2868
|
}
|
|
2781
2869
|
|
|
2782
2870
|
/**
|
|
@@ -2854,7 +2942,7 @@ export declare interface ThinkingConfig {
|
|
|
2854
2942
|
* Defines a tool that model can call to access external knowledge.
|
|
2855
2943
|
* @public
|
|
2856
2944
|
*/
|
|
2857
|
-
export declare type Tool = FunctionDeclarationsTool | GoogleSearchTool | CodeExecutionTool;
|
|
2945
|
+
export declare type Tool = FunctionDeclarationsTool | GoogleSearchTool | CodeExecutionTool | URLContextTool;
|
|
2858
2946
|
|
|
2859
2947
|
/**
|
|
2860
2948
|
* Tool config. This config is shared for all tools provided in the request.
|
|
@@ -2870,6 +2958,115 @@ export declare interface ToolConfig {
|
|
|
2870
2958
|
*/
|
|
2871
2959
|
export declare type TypedSchema = IntegerSchema | NumberSchema | StringSchema | BooleanSchema | ObjectSchema | ArraySchema | AnyOfSchema;
|
|
2872
2960
|
|
|
2961
|
+
/**
|
|
2962
|
+
* Specifies the URL Context configuration.
|
|
2963
|
+
*
|
|
2964
|
+
* @beta
|
|
2965
|
+
*/
|
|
2966
|
+
export declare interface URLContext {
|
|
2967
|
+
}
|
|
2968
|
+
|
|
2969
|
+
/**
|
|
2970
|
+
* Metadata related to {@link URLContextTool}.
|
|
2971
|
+
*
|
|
2972
|
+
* @beta
|
|
2973
|
+
*/
|
|
2974
|
+
export declare interface URLContextMetadata {
|
|
2975
|
+
/**
|
|
2976
|
+
* List of URL metadata used to provide context to the Gemini model.
|
|
2977
|
+
*/
|
|
2978
|
+
urlMetadata: URLMetadata[];
|
|
2979
|
+
}
|
|
2980
|
+
|
|
2981
|
+
/**
|
|
2982
|
+
* A tool that allows you to provide additional context to the models in the form of public web
|
|
2983
|
+
* URLs. By including URLs in your request, the Gemini model will access the content from those
|
|
2984
|
+
* pages to inform and enhance its response.
|
|
2985
|
+
*
|
|
2986
|
+
* @beta
|
|
2987
|
+
*/
|
|
2988
|
+
export declare interface URLContextTool {
|
|
2989
|
+
/**
|
|
2990
|
+
* Specifies the URL Context configuration.
|
|
2991
|
+
*/
|
|
2992
|
+
urlContext: URLContext;
|
|
2993
|
+
}
|
|
2994
|
+
|
|
2995
|
+
/**
|
|
2996
|
+
* Metadata for a single URL retrieved by the {@link URLContextTool} tool.
|
|
2997
|
+
*
|
|
2998
|
+
* @beta
|
|
2999
|
+
*/
|
|
3000
|
+
export declare interface URLMetadata {
|
|
3001
|
+
/**
|
|
3002
|
+
* The retrieved URL.
|
|
3003
|
+
*/
|
|
3004
|
+
retrievedUrl?: string;
|
|
3005
|
+
/**
|
|
3006
|
+
* The status of the URL retrieval.
|
|
3007
|
+
*/
|
|
3008
|
+
urlRetrievalStatus?: URLRetrievalStatus;
|
|
3009
|
+
}
|
|
3010
|
+
|
|
3011
|
+
/**
|
|
3012
|
+
* The status of a URL retrieval.
|
|
3013
|
+
*
|
|
3014
|
+
* @remarks
|
|
3015
|
+
* <b>URL_RETRIEVAL_STATUS_UNSPECIFIED:</b> Unspecified retrieval status.
|
|
3016
|
+
* <br/>
|
|
3017
|
+
* <b>URL_RETRIEVAL_STATUS_SUCCESS:</b> The URL retrieval was successful.
|
|
3018
|
+
* <br/>
|
|
3019
|
+
* <b>URL_RETRIEVAL_STATUS_ERROR:</b> The URL retrieval failed.
|
|
3020
|
+
* <br/>
|
|
3021
|
+
* <b>URL_RETRIEVAL_STATUS_PAYWALL:</b> The URL retrieval failed because the content is behind a paywall.
|
|
3022
|
+
* <br/>
|
|
3023
|
+
* <b>URL_RETRIEVAL_STATUS_UNSAFE:</b> The URL retrieval failed because the content is unsafe.
|
|
3024
|
+
* <br/>
|
|
3025
|
+
*
|
|
3026
|
+
* @beta
|
|
3027
|
+
*/
|
|
3028
|
+
export declare const URLRetrievalStatus: {
|
|
3029
|
+
/**
|
|
3030
|
+
* Unspecified retrieval status.
|
|
3031
|
+
*/
|
|
3032
|
+
URL_RETRIEVAL_STATUS_UNSPECIFIED: string;
|
|
3033
|
+
/**
|
|
3034
|
+
* The URL retrieval was successful.
|
|
3035
|
+
*/
|
|
3036
|
+
URL_RETRIEVAL_STATUS_SUCCESS: string;
|
|
3037
|
+
/**
|
|
3038
|
+
* The URL retrieval failed.
|
|
3039
|
+
*/
|
|
3040
|
+
URL_RETRIEVAL_STATUS_ERROR: string;
|
|
3041
|
+
/**
|
|
3042
|
+
* The URL retrieval failed because the content is behind a paywall.
|
|
3043
|
+
*/
|
|
3044
|
+
URL_RETRIEVAL_STATUS_PAYWALL: string;
|
|
3045
|
+
/**
|
|
3046
|
+
* The URL retrieval failed because the content is unsafe.
|
|
3047
|
+
*/
|
|
3048
|
+
URL_RETRIEVAL_STATUS_UNSAFE: string;
|
|
3049
|
+
};
|
|
3050
|
+
|
|
3051
|
+
/**
|
|
3052
|
+
* The status of a URL retrieval.
|
|
3053
|
+
*
|
|
3054
|
+
* @remarks
|
|
3055
|
+
* <b>URL_RETRIEVAL_STATUS_UNSPECIFIED:</b> Unspecified retrieval status.
|
|
3056
|
+
* <br/>
|
|
3057
|
+
* <b>URL_RETRIEVAL_STATUS_SUCCESS:</b> The URL retrieval was successful.
|
|
3058
|
+
* <br/>
|
|
3059
|
+
* <b>URL_RETRIEVAL_STATUS_ERROR:</b> The URL retrieval failed.
|
|
3060
|
+
* <br/>
|
|
3061
|
+
* <b>URL_RETRIEVAL_STATUS_PAYWALL:</b> The URL retrieval failed because the content is behind a paywall.
|
|
3062
|
+
* <br/>
|
|
3063
|
+
* <b>URL_RETRIEVAL_STATUS_UNSAFE:</b> The URL retrieval failed because the content is unsafe.
|
|
3064
|
+
* <br/>
|
|
3065
|
+
*
|
|
3066
|
+
* @beta
|
|
3067
|
+
*/
|
|
3068
|
+
export declare type URLRetrievalStatus = (typeof URLRetrievalStatus)[keyof typeof URLRetrievalStatus];
|
|
3069
|
+
|
|
2873
3070
|
/**
|
|
2874
3071
|
* Usage metadata about a {@link GenerateContentResponse}.
|
|
2875
3072
|
*
|
|
@@ -2883,8 +3080,16 @@ export declare interface UsageMetadata {
|
|
|
2883
3080
|
*/
|
|
2884
3081
|
thoughtsTokenCount?: number;
|
|
2885
3082
|
totalTokenCount: number;
|
|
3083
|
+
/**
|
|
3084
|
+
* The number of tokens used by tools.
|
|
3085
|
+
*/
|
|
3086
|
+
toolUsePromptTokenCount?: number;
|
|
2886
3087
|
promptTokensDetails?: ModalityTokenCount[];
|
|
2887
3088
|
candidatesTokensDetails?: ModalityTokenCount[];
|
|
3089
|
+
/**
|
|
3090
|
+
* A list of tokens used by tools, broken down by modality.
|
|
3091
|
+
*/
|
|
3092
|
+
toolUsePromptTokensDetails?: ModalityTokenCount[];
|
|
2888
3093
|
}
|
|
2889
3094
|
|
|
2890
3095
|
/**
|