@firebase/ai 2.3.0-canary.ea8512812 → 2.4.0-20251007135320
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 +28 -19
- package/dist/ai.d.ts +28 -19
- package/dist/esm/index.esm.js +31 -12
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/esm/src/api.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 +10 -1
- package/dist/esm/src/models/imagen-model.d.ts +2 -2
- package/dist/esm/src/requests/imagen-image-format.d.ts +3 -3
- 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 +9 -1
- package/dist/index.cjs.js +31 -12
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.node.cjs.js +31 -12
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +31 -12
- package/dist/index.node.mjs.map +1 -1
- package/dist/src/api.d.ts +1 -1
- package/dist/src/methods/live-session-helpers.d.ts +2 -2
- package/dist/src/methods/live-session.d.ts +10 -1
- package/dist/src/models/imagen-model.d.ts +2 -2
- package/dist/src/requests/imagen-image-format.d.ts +3 -3
- 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 +9 -1
- package/package.json +8 -8
package/dist/ai-public.d.ts
CHANGED
|
@@ -1045,7 +1045,7 @@ export declare function getGenerativeModel(ai: AI, modelParams: ModelParams | Hy
|
|
|
1045
1045
|
* @throws If the `apiKey` or `projectId` fields are missing in your
|
|
1046
1046
|
* Firebase config.
|
|
1047
1047
|
*
|
|
1048
|
-
* @
|
|
1048
|
+
* @public
|
|
1049
1049
|
*/
|
|
1050
1050
|
export declare function getImagenModel(ai: AI, modelParams: ImagenModelParams, requestOptions?: RequestOptions): ImagenModel;
|
|
1051
1051
|
|
|
@@ -1361,7 +1361,7 @@ export declare interface HybridParams {
|
|
|
1361
1361
|
* See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation }
|
|
1362
1362
|
* for more details and examples of the supported aspect ratios.
|
|
1363
1363
|
*
|
|
1364
|
-
* @
|
|
1364
|
+
* @public
|
|
1365
1365
|
*/
|
|
1366
1366
|
export declare const ImagenAspectRatio: {
|
|
1367
1367
|
/**
|
|
@@ -1395,7 +1395,7 @@ export declare const ImagenAspectRatio: {
|
|
|
1395
1395
|
* See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation }
|
|
1396
1396
|
* for more details and examples of the supported aspect ratios.
|
|
1397
1397
|
*
|
|
1398
|
-
* @
|
|
1398
|
+
* @public
|
|
1399
1399
|
*/
|
|
1400
1400
|
export declare type ImagenAspectRatio = (typeof ImagenAspectRatio)[keyof typeof ImagenAspectRatio];
|
|
1401
1401
|
|
|
@@ -1403,7 +1403,7 @@ export declare type ImagenAspectRatio = (typeof ImagenAspectRatio)[keyof typeof
|
|
|
1403
1403
|
* An image generated by Imagen, stored in a Cloud Storage for Firebase bucket.
|
|
1404
1404
|
*
|
|
1405
1405
|
* This feature is not available yet.
|
|
1406
|
-
* @
|
|
1406
|
+
* @public
|
|
1407
1407
|
*/
|
|
1408
1408
|
export declare interface ImagenGCSImage {
|
|
1409
1409
|
/**
|
|
@@ -1426,7 +1426,7 @@ export declare interface ImagenGCSImage {
|
|
|
1426
1426
|
* See the {@link http://firebase.google.com/docs/vertex-ai/generate-images-imagen | documentation} for
|
|
1427
1427
|
* more details.
|
|
1428
1428
|
*
|
|
1429
|
-
* @
|
|
1429
|
+
* @public
|
|
1430
1430
|
*/
|
|
1431
1431
|
export declare interface ImagenGenerationConfig {
|
|
1432
1432
|
/**
|
|
@@ -1478,7 +1478,7 @@ export declare interface ImagenGenerationConfig {
|
|
|
1478
1478
|
/**
|
|
1479
1479
|
* The response from a request to generate images with Imagen.
|
|
1480
1480
|
*
|
|
1481
|
-
* @
|
|
1481
|
+
* @public
|
|
1482
1482
|
*/
|
|
1483
1483
|
export declare interface ImagenGenerationResponse<T extends ImagenInlineImage | ImagenGCSImage> {
|
|
1484
1484
|
/**
|
|
@@ -1533,7 +1533,7 @@ export declare interface ImagenGenerationResponse<T extends ImagenInlineImage |
|
|
|
1533
1533
|
* }
|
|
1534
1534
|
* ```
|
|
1535
1535
|
*
|
|
1536
|
-
* @
|
|
1536
|
+
* @public
|
|
1537
1537
|
*/
|
|
1538
1538
|
export declare class ImagenImageFormat {
|
|
1539
1539
|
/**
|
|
@@ -1551,7 +1551,7 @@ export declare class ImagenImageFormat {
|
|
|
1551
1551
|
* @param compressionQuality - The level of compression (a number between 0 and 100).
|
|
1552
1552
|
* @returns An {@link ImagenImageFormat} object for a JPEG image.
|
|
1553
1553
|
*
|
|
1554
|
-
* @
|
|
1554
|
+
* @public
|
|
1555
1555
|
*/
|
|
1556
1556
|
static jpeg(compressionQuality?: number): ImagenImageFormat;
|
|
1557
1557
|
/**
|
|
@@ -1559,7 +1559,7 @@ export declare class ImagenImageFormat {
|
|
|
1559
1559
|
*
|
|
1560
1560
|
* @returns An {@link ImagenImageFormat} object for a PNG image.
|
|
1561
1561
|
*
|
|
1562
|
-
* @
|
|
1562
|
+
* @public
|
|
1563
1563
|
*/
|
|
1564
1564
|
static png(): ImagenImageFormat;
|
|
1565
1565
|
}
|
|
@@ -1583,7 +1583,7 @@ export declare class ImagenImageFormat {
|
|
|
1583
1583
|
/**
|
|
1584
1584
|
* An image generated by Imagen, represented as inline data.
|
|
1585
1585
|
*
|
|
1586
|
-
* @
|
|
1586
|
+
* @public
|
|
1587
1587
|
*/
|
|
1588
1588
|
export declare interface ImagenInlineImage {
|
|
1589
1589
|
/**
|
|
@@ -1618,7 +1618,7 @@ export declare interface ImagenInlineImage {
|
|
|
1618
1618
|
* }
|
|
1619
1619
|
* ```
|
|
1620
1620
|
*
|
|
1621
|
-
* @
|
|
1621
|
+
* @public
|
|
1622
1622
|
*/
|
|
1623
1623
|
export declare class ImagenModel extends AIModel {
|
|
1624
1624
|
requestOptions?: RequestOptions | undefined;
|
|
@@ -1657,7 +1657,7 @@ export declare class ImagenModel extends AIModel {
|
|
|
1657
1657
|
* returned object will have a `filteredReason` property.
|
|
1658
1658
|
* If all images are filtered, the `images` array will be empty.
|
|
1659
1659
|
*
|
|
1660
|
-
* @
|
|
1660
|
+
* @public
|
|
1661
1661
|
*/
|
|
1662
1662
|
generateImages(prompt: string): Promise<ImagenGenerationResponse<ImagenInlineImage>>;
|
|
1663
1663
|
/* Excluded from this release type: generateImagesGCS */
|
|
@@ -1666,7 +1666,7 @@ export declare class ImagenModel extends AIModel {
|
|
|
1666
1666
|
/**
|
|
1667
1667
|
* Parameters for configuring an {@link ImagenModel}.
|
|
1668
1668
|
*
|
|
1669
|
-
* @
|
|
1669
|
+
* @public
|
|
1670
1670
|
*/
|
|
1671
1671
|
export declare interface ImagenModelParams {
|
|
1672
1672
|
/**
|
|
@@ -1695,7 +1695,7 @@ export declare interface ImagenModelParams {
|
|
|
1695
1695
|
* See the <a href="http://firebase.google.com/docs/vertex-ai/generate-images">personGeneration</a>
|
|
1696
1696
|
* documentation for more details.
|
|
1697
1697
|
*
|
|
1698
|
-
* @
|
|
1698
|
+
* @public
|
|
1699
1699
|
*/
|
|
1700
1700
|
export declare const ImagenPersonFilterLevel: {
|
|
1701
1701
|
/**
|
|
@@ -1726,7 +1726,7 @@ export declare const ImagenPersonFilterLevel: {
|
|
|
1726
1726
|
* See the <a href="http://firebase.google.com/docs/vertex-ai/generate-images">personGeneration</a>
|
|
1727
1727
|
* documentation for more details.
|
|
1728
1728
|
*
|
|
1729
|
-
* @
|
|
1729
|
+
* @public
|
|
1730
1730
|
*/
|
|
1731
1731
|
export declare type ImagenPersonFilterLevel = (typeof ImagenPersonFilterLevel)[keyof typeof ImagenPersonFilterLevel];
|
|
1732
1732
|
|
|
@@ -1740,7 +1740,7 @@ export declare type ImagenPersonFilterLevel = (typeof ImagenPersonFilterLevel)[k
|
|
|
1740
1740
|
* and the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters | Responsible AI and usage guidelines}
|
|
1741
1741
|
* for more details.
|
|
1742
1742
|
*
|
|
1743
|
-
* @
|
|
1743
|
+
* @public
|
|
1744
1744
|
*/
|
|
1745
1745
|
export declare const ImagenSafetyFilterLevel: {
|
|
1746
1746
|
/**
|
|
@@ -1774,7 +1774,7 @@ export declare const ImagenSafetyFilterLevel: {
|
|
|
1774
1774
|
* and the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters | Responsible AI and usage guidelines}
|
|
1775
1775
|
* for more details.
|
|
1776
1776
|
*
|
|
1777
|
-
* @
|
|
1777
|
+
* @public
|
|
1778
1778
|
*/
|
|
1779
1779
|
export declare type ImagenSafetyFilterLevel = (typeof ImagenSafetyFilterLevel)[keyof typeof ImagenSafetyFilterLevel];
|
|
1780
1780
|
|
|
@@ -1784,7 +1784,7 @@ export declare type ImagenSafetyFilterLevel = (typeof ImagenSafetyFilterLevel)[k
|
|
|
1784
1784
|
* See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation }
|
|
1785
1785
|
* for more details.
|
|
1786
1786
|
*
|
|
1787
|
-
* @
|
|
1787
|
+
* @public
|
|
1788
1788
|
*/
|
|
1789
1789
|
export declare interface ImagenSafetySettings {
|
|
1790
1790
|
/**
|
|
@@ -2148,6 +2148,15 @@ export declare class LiveSession {
|
|
|
2148
2148
|
* @beta
|
|
2149
2149
|
*/
|
|
2150
2150
|
sendMediaChunks(mediaChunks: GenerativeContentBlob[]): Promise<void>;
|
|
2151
|
+
/**
|
|
2152
|
+
* Sends function responses to the server.
|
|
2153
|
+
*
|
|
2154
|
+
* @param functionResponses - The function responses to send.
|
|
2155
|
+
* @throws If this session has been closed.
|
|
2156
|
+
*
|
|
2157
|
+
* @beta
|
|
2158
|
+
*/
|
|
2159
|
+
sendFunctionResponses(functionResponses: FunctionResponse[]): Promise<void>;
|
|
2151
2160
|
/**
|
|
2152
2161
|
* Sends a stream of {@link GenerativeContentBlob}.
|
|
2153
2162
|
*
|
|
@@ -2777,7 +2786,7 @@ export declare interface StartAudioConversationOptions {
|
|
|
2777
2786
|
* The handler should perform the function call and return the result as a `Part`,
|
|
2778
2787
|
* which will then be sent back to the model.
|
|
2779
2788
|
*/
|
|
2780
|
-
functionCallingHandler?: (functionCalls:
|
|
2789
|
+
functionCallingHandler?: (functionCalls: FunctionCall[]) => Promise<FunctionResponse>;
|
|
2781
2790
|
}
|
|
2782
2791
|
|
|
2783
2792
|
/**
|
package/dist/ai.d.ts
CHANGED
|
@@ -1103,7 +1103,7 @@ export declare function getGenerativeModel(ai: AI, modelParams: ModelParams | Hy
|
|
|
1103
1103
|
* @throws If the `apiKey` or `projectId` fields are missing in your
|
|
1104
1104
|
* Firebase config.
|
|
1105
1105
|
*
|
|
1106
|
-
* @
|
|
1106
|
+
* @public
|
|
1107
1107
|
*/
|
|
1108
1108
|
export declare function getImagenModel(ai: AI, modelParams: ImagenModelParams, requestOptions?: RequestOptions): ImagenModel;
|
|
1109
1109
|
|
|
@@ -1454,7 +1454,7 @@ export declare interface HybridParams {
|
|
|
1454
1454
|
* See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation }
|
|
1455
1455
|
* for more details and examples of the supported aspect ratios.
|
|
1456
1456
|
*
|
|
1457
|
-
* @
|
|
1457
|
+
* @public
|
|
1458
1458
|
*/
|
|
1459
1459
|
export declare const ImagenAspectRatio: {
|
|
1460
1460
|
/**
|
|
@@ -1488,7 +1488,7 @@ export declare const ImagenAspectRatio: {
|
|
|
1488
1488
|
* See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation }
|
|
1489
1489
|
* for more details and examples of the supported aspect ratios.
|
|
1490
1490
|
*
|
|
1491
|
-
* @
|
|
1491
|
+
* @public
|
|
1492
1492
|
*/
|
|
1493
1493
|
export declare type ImagenAspectRatio = (typeof ImagenAspectRatio)[keyof typeof ImagenAspectRatio];
|
|
1494
1494
|
|
|
@@ -1496,7 +1496,7 @@ export declare type ImagenAspectRatio = (typeof ImagenAspectRatio)[keyof typeof
|
|
|
1496
1496
|
* An image generated by Imagen, stored in a Cloud Storage for Firebase bucket.
|
|
1497
1497
|
*
|
|
1498
1498
|
* This feature is not available yet.
|
|
1499
|
-
* @
|
|
1499
|
+
* @public
|
|
1500
1500
|
*/
|
|
1501
1501
|
export declare interface ImagenGCSImage {
|
|
1502
1502
|
/**
|
|
@@ -1519,7 +1519,7 @@ export declare interface ImagenGCSImage {
|
|
|
1519
1519
|
* See the {@link http://firebase.google.com/docs/vertex-ai/generate-images-imagen | documentation} for
|
|
1520
1520
|
* more details.
|
|
1521
1521
|
*
|
|
1522
|
-
* @
|
|
1522
|
+
* @public
|
|
1523
1523
|
*/
|
|
1524
1524
|
export declare interface ImagenGenerationConfig {
|
|
1525
1525
|
/**
|
|
@@ -1571,7 +1571,7 @@ export declare interface ImagenGenerationConfig {
|
|
|
1571
1571
|
/**
|
|
1572
1572
|
* The response from a request to generate images with Imagen.
|
|
1573
1573
|
*
|
|
1574
|
-
* @
|
|
1574
|
+
* @public
|
|
1575
1575
|
*/
|
|
1576
1576
|
export declare interface ImagenGenerationResponse<T extends ImagenInlineImage | ImagenGCSImage> {
|
|
1577
1577
|
/**
|
|
@@ -1626,7 +1626,7 @@ export declare interface ImagenGenerationResponse<T extends ImagenInlineImage |
|
|
|
1626
1626
|
* }
|
|
1627
1627
|
* ```
|
|
1628
1628
|
*
|
|
1629
|
-
* @
|
|
1629
|
+
* @public
|
|
1630
1630
|
*/
|
|
1631
1631
|
export declare class ImagenImageFormat {
|
|
1632
1632
|
/**
|
|
@@ -1644,7 +1644,7 @@ export declare class ImagenImageFormat {
|
|
|
1644
1644
|
* @param compressionQuality - The level of compression (a number between 0 and 100).
|
|
1645
1645
|
* @returns An {@link ImagenImageFormat} object for a JPEG image.
|
|
1646
1646
|
*
|
|
1647
|
-
* @
|
|
1647
|
+
* @public
|
|
1648
1648
|
*/
|
|
1649
1649
|
static jpeg(compressionQuality?: number): ImagenImageFormat;
|
|
1650
1650
|
/**
|
|
@@ -1652,7 +1652,7 @@ export declare class ImagenImageFormat {
|
|
|
1652
1652
|
*
|
|
1653
1653
|
* @returns An {@link ImagenImageFormat} object for a PNG image.
|
|
1654
1654
|
*
|
|
1655
|
-
* @
|
|
1655
|
+
* @public
|
|
1656
1656
|
*/
|
|
1657
1657
|
static png(): ImagenImageFormat;
|
|
1658
1658
|
}
|
|
@@ -1676,7 +1676,7 @@ export declare class ImagenImageFormat {
|
|
|
1676
1676
|
/**
|
|
1677
1677
|
* An image generated by Imagen, represented as inline data.
|
|
1678
1678
|
*
|
|
1679
|
-
* @
|
|
1679
|
+
* @public
|
|
1680
1680
|
*/
|
|
1681
1681
|
export declare interface ImagenInlineImage {
|
|
1682
1682
|
/**
|
|
@@ -1711,7 +1711,7 @@ export declare interface ImagenInlineImage {
|
|
|
1711
1711
|
* }
|
|
1712
1712
|
* ```
|
|
1713
1713
|
*
|
|
1714
|
-
* @
|
|
1714
|
+
* @public
|
|
1715
1715
|
*/
|
|
1716
1716
|
export declare class ImagenModel extends AIModel {
|
|
1717
1717
|
requestOptions?: RequestOptions | undefined;
|
|
@@ -1750,7 +1750,7 @@ export declare class ImagenModel extends AIModel {
|
|
|
1750
1750
|
* returned object will have a `filteredReason` property.
|
|
1751
1751
|
* If all images are filtered, the `images` array will be empty.
|
|
1752
1752
|
*
|
|
1753
|
-
* @
|
|
1753
|
+
* @public
|
|
1754
1754
|
*/
|
|
1755
1755
|
generateImages(prompt: string): Promise<ImagenGenerationResponse<ImagenInlineImage>>;
|
|
1756
1756
|
/**
|
|
@@ -1778,7 +1778,7 @@ export declare class ImagenModel extends AIModel {
|
|
|
1778
1778
|
/**
|
|
1779
1779
|
* Parameters for configuring an {@link ImagenModel}.
|
|
1780
1780
|
*
|
|
1781
|
-
* @
|
|
1781
|
+
* @public
|
|
1782
1782
|
*/
|
|
1783
1783
|
export declare interface ImagenModelParams {
|
|
1784
1784
|
/**
|
|
@@ -1807,7 +1807,7 @@ export declare interface ImagenModelParams {
|
|
|
1807
1807
|
* See the <a href="http://firebase.google.com/docs/vertex-ai/generate-images">personGeneration</a>
|
|
1808
1808
|
* documentation for more details.
|
|
1809
1809
|
*
|
|
1810
|
-
* @
|
|
1810
|
+
* @public
|
|
1811
1811
|
*/
|
|
1812
1812
|
export declare const ImagenPersonFilterLevel: {
|
|
1813
1813
|
/**
|
|
@@ -1838,7 +1838,7 @@ export declare const ImagenPersonFilterLevel: {
|
|
|
1838
1838
|
* See the <a href="http://firebase.google.com/docs/vertex-ai/generate-images">personGeneration</a>
|
|
1839
1839
|
* documentation for more details.
|
|
1840
1840
|
*
|
|
1841
|
-
* @
|
|
1841
|
+
* @public
|
|
1842
1842
|
*/
|
|
1843
1843
|
export declare type ImagenPersonFilterLevel = (typeof ImagenPersonFilterLevel)[keyof typeof ImagenPersonFilterLevel];
|
|
1844
1844
|
|
|
@@ -1852,7 +1852,7 @@ export declare type ImagenPersonFilterLevel = (typeof ImagenPersonFilterLevel)[k
|
|
|
1852
1852
|
* and the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters | Responsible AI and usage guidelines}
|
|
1853
1853
|
* for more details.
|
|
1854
1854
|
*
|
|
1855
|
-
* @
|
|
1855
|
+
* @public
|
|
1856
1856
|
*/
|
|
1857
1857
|
export declare const ImagenSafetyFilterLevel: {
|
|
1858
1858
|
/**
|
|
@@ -1886,7 +1886,7 @@ export declare const ImagenSafetyFilterLevel: {
|
|
|
1886
1886
|
* and the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters | Responsible AI and usage guidelines}
|
|
1887
1887
|
* for more details.
|
|
1888
1888
|
*
|
|
1889
|
-
* @
|
|
1889
|
+
* @public
|
|
1890
1890
|
*/
|
|
1891
1891
|
export declare type ImagenSafetyFilterLevel = (typeof ImagenSafetyFilterLevel)[keyof typeof ImagenSafetyFilterLevel];
|
|
1892
1892
|
|
|
@@ -1896,7 +1896,7 @@ export declare type ImagenSafetyFilterLevel = (typeof ImagenSafetyFilterLevel)[k
|
|
|
1896
1896
|
* See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation }
|
|
1897
1897
|
* for more details.
|
|
1898
1898
|
*
|
|
1899
|
-
* @
|
|
1899
|
+
* @public
|
|
1900
1900
|
*/
|
|
1901
1901
|
export declare interface ImagenSafetySettings {
|
|
1902
1902
|
/**
|
|
@@ -2276,6 +2276,15 @@ export declare class LiveSession {
|
|
|
2276
2276
|
* @beta
|
|
2277
2277
|
*/
|
|
2278
2278
|
sendMediaChunks(mediaChunks: GenerativeContentBlob[]): Promise<void>;
|
|
2279
|
+
/**
|
|
2280
|
+
* Sends function responses to the server.
|
|
2281
|
+
*
|
|
2282
|
+
* @param functionResponses - The function responses to send.
|
|
2283
|
+
* @throws If this session has been closed.
|
|
2284
|
+
*
|
|
2285
|
+
* @beta
|
|
2286
|
+
*/
|
|
2287
|
+
sendFunctionResponses(functionResponses: FunctionResponse[]): Promise<void>;
|
|
2279
2288
|
/**
|
|
2280
2289
|
* Sends a stream of {@link GenerativeContentBlob}.
|
|
2281
2290
|
*
|
|
@@ -2913,7 +2922,7 @@ export declare interface StartAudioConversationOptions {
|
|
|
2913
2922
|
* The handler should perform the function call and return the result as a `Part`,
|
|
2914
2923
|
* which will then be sent back to the model.
|
|
2915
2924
|
*/
|
|
2916
|
-
functionCallingHandler?: (functionCalls:
|
|
2925
|
+
functionCallingHandler?: (functionCalls: FunctionCall[]) => Promise<FunctionResponse>;
|
|
2917
2926
|
}
|
|
2918
2927
|
|
|
2919
2928
|
/**
|
package/dist/esm/index.esm.js
CHANGED
|
@@ -4,7 +4,7 @@ import { FirebaseError, Deferred, getModularInstance } from '@firebase/util';
|
|
|
4
4
|
import { Logger } from '@firebase/logger';
|
|
5
5
|
|
|
6
6
|
var name = "@firebase/ai";
|
|
7
|
-
var version = "2.
|
|
7
|
+
var version = "2.4.0-20251007135320";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* @license
|
|
@@ -581,7 +581,7 @@ const SchemaType = {
|
|
|
581
581
|
* and the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters | Responsible AI and usage guidelines}
|
|
582
582
|
* for more details.
|
|
583
583
|
*
|
|
584
|
-
* @
|
|
584
|
+
* @public
|
|
585
585
|
*/
|
|
586
586
|
const ImagenSafetyFilterLevel = {
|
|
587
587
|
/**
|
|
@@ -610,7 +610,7 @@ const ImagenSafetyFilterLevel = {
|
|
|
610
610
|
* See the <a href="http://firebase.google.com/docs/vertex-ai/generate-images">personGeneration</a>
|
|
611
611
|
* documentation for more details.
|
|
612
612
|
*
|
|
613
|
-
* @
|
|
613
|
+
* @public
|
|
614
614
|
*/
|
|
615
615
|
const ImagenPersonFilterLevel = {
|
|
616
616
|
/**
|
|
@@ -643,7 +643,7 @@ const ImagenPersonFilterLevel = {
|
|
|
643
643
|
* See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation }
|
|
644
644
|
* for more details and examples of the supported aspect ratios.
|
|
645
645
|
*
|
|
646
|
-
* @
|
|
646
|
+
* @public
|
|
647
647
|
*/
|
|
648
648
|
const ImagenAspectRatio = {
|
|
649
649
|
/**
|
|
@@ -2846,6 +2846,25 @@ class LiveSession {
|
|
|
2846
2846
|
this.webSocketHandler.send(JSON.stringify(message));
|
|
2847
2847
|
});
|
|
2848
2848
|
}
|
|
2849
|
+
/**
|
|
2850
|
+
* Sends function responses to the server.
|
|
2851
|
+
*
|
|
2852
|
+
* @param functionResponses - The function responses to send.
|
|
2853
|
+
* @throws If this session has been closed.
|
|
2854
|
+
*
|
|
2855
|
+
* @beta
|
|
2856
|
+
*/
|
|
2857
|
+
async sendFunctionResponses(functionResponses) {
|
|
2858
|
+
if (this.isClosed) {
|
|
2859
|
+
throw new AIError(AIErrorCode.REQUEST_ERROR, 'This LiveSession has been closed and cannot be used.');
|
|
2860
|
+
}
|
|
2861
|
+
const message = {
|
|
2862
|
+
toolResponse: {
|
|
2863
|
+
functionResponses
|
|
2864
|
+
}
|
|
2865
|
+
};
|
|
2866
|
+
this.webSocketHandler.send(JSON.stringify(message));
|
|
2867
|
+
}
|
|
2849
2868
|
/**
|
|
2850
2869
|
* Sends a stream of {@link GenerativeContentBlob}.
|
|
2851
2870
|
*
|
|
@@ -3060,7 +3079,7 @@ class LiveGenerativeModel extends AIModel {
|
|
|
3060
3079
|
* }
|
|
3061
3080
|
* ```
|
|
3062
3081
|
*
|
|
3063
|
-
* @
|
|
3082
|
+
* @public
|
|
3064
3083
|
*/
|
|
3065
3084
|
class ImagenModel extends AIModel {
|
|
3066
3085
|
/**
|
|
@@ -3096,7 +3115,7 @@ class ImagenModel extends AIModel {
|
|
|
3096
3115
|
* returned object will have a `filteredReason` property.
|
|
3097
3116
|
* If all images are filtered, the `images` array will be empty.
|
|
3098
3117
|
*
|
|
3099
|
-
* @
|
|
3118
|
+
* @public
|
|
3100
3119
|
*/
|
|
3101
3120
|
async generateImages(prompt) {
|
|
3102
3121
|
const body = createPredictRequestBody(prompt, {
|
|
@@ -3559,7 +3578,7 @@ class AnyOfSchema extends Schema {
|
|
|
3559
3578
|
* }
|
|
3560
3579
|
* ```
|
|
3561
3580
|
*
|
|
3562
|
-
* @
|
|
3581
|
+
* @public
|
|
3563
3582
|
*/
|
|
3564
3583
|
class ImagenImageFormat {
|
|
3565
3584
|
constructor() {
|
|
@@ -3571,7 +3590,7 @@ class ImagenImageFormat {
|
|
|
3571
3590
|
* @param compressionQuality - The level of compression (a number between 0 and 100).
|
|
3572
3591
|
* @returns An {@link ImagenImageFormat} object for a JPEG image.
|
|
3573
3592
|
*
|
|
3574
|
-
* @
|
|
3593
|
+
* @public
|
|
3575
3594
|
*/
|
|
3576
3595
|
static jpeg(compressionQuality) {
|
|
3577
3596
|
if (compressionQuality &&
|
|
@@ -3585,7 +3604,7 @@ class ImagenImageFormat {
|
|
|
3585
3604
|
*
|
|
3586
3605
|
* @returns An {@link ImagenImageFormat} object for a PNG image.
|
|
3587
3606
|
*
|
|
3588
|
-
* @
|
|
3607
|
+
* @public
|
|
3589
3608
|
*/
|
|
3590
3609
|
static png() {
|
|
3591
3610
|
return { mimeType: 'image/png' };
|
|
@@ -3827,9 +3846,9 @@ class AudioConversationRunner {
|
|
|
3827
3846
|
}
|
|
3828
3847
|
else {
|
|
3829
3848
|
try {
|
|
3830
|
-
const
|
|
3849
|
+
const functionResponse = await this.options.functionCallingHandler(message.functionCalls);
|
|
3831
3850
|
if (!this.isStopped) {
|
|
3832
|
-
void this.liveSession.
|
|
3851
|
+
void this.liveSession.sendFunctionResponses([functionResponse]);
|
|
3833
3852
|
}
|
|
3834
3853
|
}
|
|
3835
3854
|
catch (e) {
|
|
@@ -4049,7 +4068,7 @@ function getGenerativeModel(ai, modelParams, requestOptions) {
|
|
|
4049
4068
|
* @throws If the `apiKey` or `projectId` fields are missing in your
|
|
4050
4069
|
* Firebase config.
|
|
4051
4070
|
*
|
|
4052
|
-
* @
|
|
4071
|
+
* @public
|
|
4053
4072
|
*/
|
|
4054
4073
|
function getImagenModel(ai, modelParams, requestOptions) {
|
|
4055
4074
|
if (!modelParams.model) {
|