@firebase/ai 2.10.0 → 2.11.0-20260408201731
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 +246 -20
- package/dist/ai.d.ts +318 -16
- package/dist/esm/index.esm.js +364 -140
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/esm/src/api.d.ts +12 -2
- package/dist/esm/src/methods/chat-session-base.d.ts +89 -0
- package/dist/esm/src/methods/chat-session.d.ts +15 -30
- package/dist/esm/src/methods/generate-content.d.ts +3 -2
- package/dist/esm/src/methods/template-chat-session.d.ts +59 -0
- package/dist/esm/src/models/generative-model.d.ts +5 -0
- package/dist/esm/src/models/imagen-model.d.ts +5 -0
- package/dist/esm/src/models/template-generative-model.d.ts +14 -3
- package/dist/esm/src/models/template-imagen-model.d.ts +4 -1
- package/dist/esm/src/requests/imagen-image-format.d.ts +5 -0
- package/dist/esm/src/types/imagen/requests.d.ts +45 -0
- package/dist/esm/src/types/imagen/responses.d.ts +16 -0
- package/dist/esm/src/types/language-model.d.ts +6 -0
- package/dist/esm/src/types/requests.d.ts +100 -1
- package/dist/index.cjs.js +365 -139
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.node.cjs.js +365 -139
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/index.node.mjs +364 -140
- package/dist/index.node.mjs.map +1 -1
- package/dist/src/api.d.ts +12 -2
- package/dist/src/methods/chat-session-base.d.ts +89 -0
- package/dist/src/methods/chat-session.d.ts +15 -30
- package/dist/src/methods/generate-content.d.ts +3 -2
- package/dist/src/methods/template-chat-session.d.ts +59 -0
- package/dist/src/models/generative-model.d.ts +5 -0
- package/dist/src/models/imagen-model.d.ts +5 -0
- package/dist/src/models/template-generative-model.d.ts +14 -3
- package/dist/src/models/template-imagen-model.d.ts +4 -1
- package/dist/src/requests/imagen-image-format.d.ts +5 -0
- package/dist/src/types/imagen/requests.d.ts +45 -0
- package/dist/src/types/imagen/responses.d.ts +16 -0
- package/dist/src/types/language-model.d.ts +6 -0
- package/dist/src/types/requests.d.ts +100 -1
- package/package.json +2 -2
package/dist/ai-public.d.ts
CHANGED
|
@@ -306,26 +306,15 @@ export declare class BooleanSchema extends Schema {
|
|
|
306
306
|
*
|
|
307
307
|
* @public
|
|
308
308
|
*/
|
|
309
|
-
export declare class ChatSession {
|
|
309
|
+
export declare class ChatSession extends ChatSessionBase<StartChatParams, GenerateContentRequest, FunctionDeclarationsTool> {
|
|
310
310
|
model: string;
|
|
311
311
|
private chromeAdapter?;
|
|
312
312
|
params?: StartChatParams | undefined;
|
|
313
313
|
requestOptions?: RequestOptions | undefined;
|
|
314
|
-
private _apiSettings;
|
|
315
|
-
private _history;
|
|
316
|
-
/**
|
|
317
|
-
* Ensures sequential execution of chat messages to maintain history order.
|
|
318
|
-
* Each call waits for the previous one to settle before proceeding.
|
|
319
|
-
*/
|
|
320
|
-
private _sendPromise;
|
|
321
314
|
constructor(apiSettings: ApiSettings, model: string, chromeAdapter?: ChromeAdapter | undefined, params?: StartChatParams | undefined, requestOptions?: RequestOptions | undefined);
|
|
322
|
-
/**
|
|
323
|
-
* Gets the chat history so far. Blocked prompts are not added to history.
|
|
324
|
-
* Neither blocked candidates nor the prompts that generated them are added
|
|
325
|
-
* to history.
|
|
326
|
-
*/
|
|
327
|
-
getHistory(): Promise<Content[]>;
|
|
328
315
|
/* Excluded from this release type: _formatRequest */
|
|
316
|
+
/* Excluded from this release type: _callGenerateContent */
|
|
317
|
+
/* Excluded from this release type: _callGenerateContentStream */
|
|
329
318
|
/**
|
|
330
319
|
* Sends a chat message and receives a non-streaming
|
|
331
320
|
* {@link GenerateContentResult}
|
|
@@ -337,6 +326,32 @@ export declare class ChatSession {
|
|
|
337
326
|
* and a response promise.
|
|
338
327
|
*/
|
|
339
328
|
sendMessageStream(request: string | Array<string | Part>, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentStreamResult>;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Base class for various `ChatSession` classes that enables sending chat
|
|
333
|
+
* messages and stores history of sent and received messages so far.
|
|
334
|
+
*
|
|
335
|
+
* @public
|
|
336
|
+
*/
|
|
337
|
+
export declare abstract class ChatSessionBase<ParamsType extends StartChatParams | StartTemplateChatParams, RequestType, FunctionDeclarationsToolType extends FunctionDeclarationsTool | TemplateFunctionDeclarationsTool> {
|
|
338
|
+
params?: ParamsType | undefined;
|
|
339
|
+
requestOptions?: RequestOptions | undefined;
|
|
340
|
+
protected _apiSettings: ApiSettings;
|
|
341
|
+
protected _history: Content[];
|
|
342
|
+
/* Excluded from this release type: _sendPromise */
|
|
343
|
+
constructor(apiSettings: ApiSettings, params?: ParamsType | undefined, requestOptions?: RequestOptions | undefined);
|
|
344
|
+
/**
|
|
345
|
+
* Gets the chat history so far. Blocked prompts are not added to history.
|
|
346
|
+
* Neither blocked candidates nor the prompts that generated them are added
|
|
347
|
+
* to history.
|
|
348
|
+
*/
|
|
349
|
+
getHistory(): Promise<Content[]>;
|
|
350
|
+
/* Excluded from this release type: _formatRequest */
|
|
351
|
+
/* Excluded from this release type: _callGenerateContent */
|
|
352
|
+
/* Excluded from this release type: _callGenerateContentStream */
|
|
353
|
+
/* Excluded from this release type: _sendMessage */
|
|
354
|
+
/* Excluded from this release type: _sendMessageStream */
|
|
340
355
|
/* Excluded from this release type: _getCallableFunctionCalls */
|
|
341
356
|
/* Excluded from this release type: _callFunctionsAsNeeded */
|
|
342
357
|
}
|
|
@@ -1077,6 +1092,11 @@ export declare function getGenerativeModel(ai: AI, modelParams: ModelParams | Hy
|
|
|
1077
1092
|
*
|
|
1078
1093
|
* Only Imagen 3 models (named `imagen-3.0-*`) are supported.
|
|
1079
1094
|
*
|
|
1095
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
1096
|
+
* early as June 2026. As a replacement, you can
|
|
1097
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
1098
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
1099
|
+
*
|
|
1080
1100
|
* @param ai - An {@link AI} instance.
|
|
1081
1101
|
* @param modelParams - Parameters to use when making Imagen requests.
|
|
1082
1102
|
* @param requestOptions - Additional options to use when making requests.
|
|
@@ -1117,10 +1137,13 @@ export declare function getTemplateGenerativeModel(ai: AI, requestOptions?: Requ
|
|
|
1117
1137
|
* Returns a {@link TemplateImagenModel} class for executing server-side
|
|
1118
1138
|
* Imagen templates.
|
|
1119
1139
|
*
|
|
1140
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
1141
|
+
* early as June 2026. As a replacement, you can
|
|
1142
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
1143
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
1144
|
+
*
|
|
1120
1145
|
* @param ai - An {@link AI} instance.
|
|
1121
1146
|
* @param requestOptions - Additional options to use when making requests.
|
|
1122
|
-
*
|
|
1123
|
-
* @beta
|
|
1124
1147
|
*/
|
|
1125
1148
|
export declare function getTemplateImagenModel(ai: AI, requestOptions?: RequestOptions): TemplateImagenModel;
|
|
1126
1149
|
|
|
@@ -1424,6 +1447,11 @@ export declare interface HybridParams {
|
|
|
1424
1447
|
* See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation }
|
|
1425
1448
|
* for more details and examples of the supported aspect ratios.
|
|
1426
1449
|
*
|
|
1450
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
1451
|
+
* early as June 2026. As a replacement, you can
|
|
1452
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
1453
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
1454
|
+
*
|
|
1427
1455
|
* @public
|
|
1428
1456
|
*/
|
|
1429
1457
|
export declare const ImagenAspectRatio: {
|
|
@@ -1458,6 +1486,11 @@ export declare const ImagenAspectRatio: {
|
|
|
1458
1486
|
* See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation }
|
|
1459
1487
|
* for more details and examples of the supported aspect ratios.
|
|
1460
1488
|
*
|
|
1489
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
1490
|
+
* early as June 2026. As a replacement, you can
|
|
1491
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
1492
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
1493
|
+
*
|
|
1461
1494
|
* @public
|
|
1462
1495
|
*/
|
|
1463
1496
|
export declare type ImagenAspectRatio = (typeof ImagenAspectRatio)[keyof typeof ImagenAspectRatio];
|
|
@@ -1466,6 +1499,12 @@ export declare type ImagenAspectRatio = (typeof ImagenAspectRatio)[keyof typeof
|
|
|
1466
1499
|
* An image generated by Imagen, stored in a Cloud Storage for Firebase bucket.
|
|
1467
1500
|
*
|
|
1468
1501
|
* This feature is not available yet.
|
|
1502
|
+
*
|
|
1503
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
1504
|
+
* early as June 2026. As a replacement, you can
|
|
1505
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
1506
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
1507
|
+
*
|
|
1469
1508
|
* @public
|
|
1470
1509
|
*/
|
|
1471
1510
|
export declare interface ImagenGCSImage {
|
|
@@ -1489,6 +1528,11 @@ export declare interface ImagenGCSImage {
|
|
|
1489
1528
|
* See the {@link http://firebase.google.com/docs/vertex-ai/generate-images-imagen | documentation} for
|
|
1490
1529
|
* more details.
|
|
1491
1530
|
*
|
|
1531
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
1532
|
+
* early as June 2026. As a replacement, you can
|
|
1533
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
1534
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
1535
|
+
*
|
|
1492
1536
|
* @public
|
|
1493
1537
|
*/
|
|
1494
1538
|
export declare interface ImagenGenerationConfig {
|
|
@@ -1541,6 +1585,11 @@ export declare interface ImagenGenerationConfig {
|
|
|
1541
1585
|
/**
|
|
1542
1586
|
* The response from a request to generate images with Imagen.
|
|
1543
1587
|
*
|
|
1588
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
1589
|
+
* early as June 2026. As a replacement, you can
|
|
1590
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
1591
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
1592
|
+
*
|
|
1544
1593
|
* @public
|
|
1545
1594
|
*/
|
|
1546
1595
|
export declare interface ImagenGenerationResponse<T extends ImagenInlineImage | ImagenGCSImage> {
|
|
@@ -1596,6 +1645,11 @@ export declare interface ImagenGenerationResponse<T extends ImagenInlineImage |
|
|
|
1596
1645
|
* }
|
|
1597
1646
|
* ```
|
|
1598
1647
|
*
|
|
1648
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
1649
|
+
* early as June 2026. As a replacement, you can
|
|
1650
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
1651
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
1652
|
+
*
|
|
1599
1653
|
* @public
|
|
1600
1654
|
*/
|
|
1601
1655
|
export declare class ImagenImageFormat {
|
|
@@ -1646,6 +1700,11 @@ export declare class ImagenImageFormat {
|
|
|
1646
1700
|
/**
|
|
1647
1701
|
* An image generated by Imagen, represented as inline data.
|
|
1648
1702
|
*
|
|
1703
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
1704
|
+
* early as June 2026. As a replacement, you can
|
|
1705
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
1706
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
1707
|
+
*
|
|
1649
1708
|
* @public
|
|
1650
1709
|
*/
|
|
1651
1710
|
export declare interface ImagenInlineImage {
|
|
@@ -1681,6 +1740,11 @@ export declare interface ImagenInlineImage {
|
|
|
1681
1740
|
* }
|
|
1682
1741
|
* ```
|
|
1683
1742
|
*
|
|
1743
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
1744
|
+
* early as June 2026. As a replacement, you can
|
|
1745
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
1746
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
1747
|
+
*
|
|
1684
1748
|
* @public
|
|
1685
1749
|
*/
|
|
1686
1750
|
export declare class ImagenModel extends AIModel {
|
|
@@ -1729,6 +1793,11 @@ export declare class ImagenModel extends AIModel {
|
|
|
1729
1793
|
/**
|
|
1730
1794
|
* Parameters for configuring an {@link ImagenModel}.
|
|
1731
1795
|
*
|
|
1796
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
1797
|
+
* early as June 2026. As a replacement, you can
|
|
1798
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
1799
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
1800
|
+
*
|
|
1732
1801
|
* @public
|
|
1733
1802
|
*/
|
|
1734
1803
|
export declare interface ImagenModelParams {
|
|
@@ -1758,6 +1827,11 @@ export declare interface ImagenModelParams {
|
|
|
1758
1827
|
* See the <a href="http://firebase.google.com/docs/vertex-ai/generate-images">personGeneration</a>
|
|
1759
1828
|
* documentation for more details.
|
|
1760
1829
|
*
|
|
1830
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
1831
|
+
* early as June 2026. As a replacement, you can
|
|
1832
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
1833
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
1834
|
+
*
|
|
1761
1835
|
* @public
|
|
1762
1836
|
*/
|
|
1763
1837
|
export declare const ImagenPersonFilterLevel: {
|
|
@@ -1789,6 +1863,11 @@ export declare const ImagenPersonFilterLevel: {
|
|
|
1789
1863
|
* See the <a href="http://firebase.google.com/docs/vertex-ai/generate-images">personGeneration</a>
|
|
1790
1864
|
* documentation for more details.
|
|
1791
1865
|
*
|
|
1866
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
1867
|
+
* early as June 2026. As a replacement, you can
|
|
1868
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
1869
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
1870
|
+
*
|
|
1792
1871
|
* @public
|
|
1793
1872
|
*/
|
|
1794
1873
|
export declare type ImagenPersonFilterLevel = (typeof ImagenPersonFilterLevel)[keyof typeof ImagenPersonFilterLevel];
|
|
@@ -1803,6 +1882,11 @@ export declare type ImagenPersonFilterLevel = (typeof ImagenPersonFilterLevel)[k
|
|
|
1803
1882
|
* and the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters | Responsible AI and usage guidelines}
|
|
1804
1883
|
* for more details.
|
|
1805
1884
|
*
|
|
1885
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
1886
|
+
* early as June 2026. As a replacement, you can
|
|
1887
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
1888
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
1889
|
+
*
|
|
1806
1890
|
* @public
|
|
1807
1891
|
*/
|
|
1808
1892
|
export declare const ImagenSafetyFilterLevel: {
|
|
@@ -1837,6 +1921,11 @@ export declare const ImagenSafetyFilterLevel: {
|
|
|
1837
1921
|
* and the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters | Responsible AI and usage guidelines}
|
|
1838
1922
|
* for more details.
|
|
1839
1923
|
*
|
|
1924
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
1925
|
+
* early as June 2026. As a replacement, you can
|
|
1926
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
1927
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
1928
|
+
*
|
|
1840
1929
|
* @public
|
|
1841
1930
|
*/
|
|
1842
1931
|
export declare type ImagenSafetyFilterLevel = (typeof ImagenSafetyFilterLevel)[keyof typeof ImagenSafetyFilterLevel];
|
|
@@ -1847,6 +1936,11 @@ export declare type ImagenSafetyFilterLevel = (typeof ImagenSafetyFilterLevel)[k
|
|
|
1847
1936
|
* See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation }
|
|
1848
1937
|
* for more details.
|
|
1849
1938
|
*
|
|
1939
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
1940
|
+
* early as June 2026. As a replacement, you can
|
|
1941
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
1942
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
1943
|
+
*
|
|
1850
1944
|
* @public
|
|
1851
1945
|
*/
|
|
1852
1946
|
export declare interface ImagenSafetySettings {
|
|
@@ -1962,7 +2056,13 @@ export declare type Language = (typeof Language)[keyof typeof Language];
|
|
|
1962
2056
|
* @beta
|
|
1963
2057
|
*/
|
|
1964
2058
|
export declare interface LanguageModelCreateCoreOptions {
|
|
2059
|
+
/**
|
|
2060
|
+
* @deprecated
|
|
2061
|
+
*/
|
|
1965
2062
|
topK?: number;
|
|
2063
|
+
/**
|
|
2064
|
+
* @deprecated
|
|
2065
|
+
*/
|
|
1966
2066
|
temperature?: number;
|
|
1967
2067
|
expectedInputs?: LanguageModelExpected[];
|
|
1968
2068
|
}
|
|
@@ -2557,7 +2657,7 @@ export declare interface RequestOptions {
|
|
|
2557
2657
|
* When it reaches this limit, it will return the last response received
|
|
2558
2658
|
* from the model, whether it is a text response or further function calls.
|
|
2559
2659
|
*/
|
|
2560
|
-
|
|
2660
|
+
maxSequentialFunctionCalls?: number;
|
|
2561
2661
|
}
|
|
2562
2662
|
|
|
2563
2663
|
/**
|
|
@@ -3025,6 +3125,22 @@ export declare interface StartChatParams extends BaseParams {
|
|
|
3025
3125
|
systemInstruction?: string | Part | Content;
|
|
3026
3126
|
}
|
|
3027
3127
|
|
|
3128
|
+
/**
|
|
3129
|
+
* Params for {@link TemplateGenerativeModel.startChat}.
|
|
3130
|
+
* @beta
|
|
3131
|
+
*/
|
|
3132
|
+
export declare interface StartTemplateChatParams extends Omit<StartChatParams, 'tools'> {
|
|
3133
|
+
/**
|
|
3134
|
+
* The ID of the server-side template to execute.
|
|
3135
|
+
*/
|
|
3136
|
+
templateId: string;
|
|
3137
|
+
/**
|
|
3138
|
+
* A key-value map of variables to populate the template with.
|
|
3139
|
+
*/
|
|
3140
|
+
templateVariables?: Record<string, unknown>;
|
|
3141
|
+
tools?: TemplateTool[];
|
|
3142
|
+
}
|
|
3143
|
+
|
|
3028
3144
|
/**
|
|
3029
3145
|
* Schema class for "string" types. Can be used with or without
|
|
3030
3146
|
* enum values.
|
|
@@ -3036,6 +3152,93 @@ export declare class StringSchema extends Schema {
|
|
|
3036
3152
|
/* Excluded from this release type: toJSON */
|
|
3037
3153
|
}
|
|
3038
3154
|
|
|
3155
|
+
/**
|
|
3156
|
+
* `ChatSession` class for use with server prompt templates that
|
|
3157
|
+
* enables sending chat messages and stores history of sent and
|
|
3158
|
+
* received messages so far.
|
|
3159
|
+
*
|
|
3160
|
+
* @beta
|
|
3161
|
+
*/
|
|
3162
|
+
export declare class TemplateChatSession extends ChatSessionBase<StartTemplateChatParams, TemplateRequestInternal, TemplateFunctionDeclarationsTool> {
|
|
3163
|
+
params: StartTemplateChatParams;
|
|
3164
|
+
requestOptions?: RequestOptions | undefined;
|
|
3165
|
+
constructor(apiSettings: ApiSettings, params: StartTemplateChatParams, requestOptions?: RequestOptions | undefined);
|
|
3166
|
+
/* Excluded from this release type: _formatRequest */
|
|
3167
|
+
/* Excluded from this release type: _callGenerateContent */
|
|
3168
|
+
/* Excluded from this release type: _callGenerateContentStream */
|
|
3169
|
+
/**
|
|
3170
|
+
* Sends a chat message and receives a non-streaming
|
|
3171
|
+
* {@link GenerateContentResult}
|
|
3172
|
+
*/
|
|
3173
|
+
sendMessage(request: string | Array<string | Part>, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentResult>;
|
|
3174
|
+
/**
|
|
3175
|
+
* Sends a chat message and receives the response as a
|
|
3176
|
+
* {@link GenerateContentStreamResult} containing an iterable stream
|
|
3177
|
+
* and a response promise.
|
|
3178
|
+
*/
|
|
3179
|
+
sendMessageStream(request: string | Array<string | Part>, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentStreamResult>;
|
|
3180
|
+
}
|
|
3181
|
+
|
|
3182
|
+
/**
|
|
3183
|
+
* Structured representation of a template function declaration.
|
|
3184
|
+
* Included in this declaration are the function name and parameters. This
|
|
3185
|
+
* `TemplateFunctionDeclaration` is a representation of a block of code that can be used
|
|
3186
|
+
* as a Tool by the model and executed by the client.
|
|
3187
|
+
* Note: Template function declarations do not support description fields.
|
|
3188
|
+
* @beta
|
|
3189
|
+
*/
|
|
3190
|
+
export declare interface TemplateFunctionDeclaration {
|
|
3191
|
+
/**
|
|
3192
|
+
* The name of the function to call. Must start with a letter or an
|
|
3193
|
+
* underscore. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with
|
|
3194
|
+
* a max length of 64.
|
|
3195
|
+
*/
|
|
3196
|
+
name: string;
|
|
3197
|
+
/**
|
|
3198
|
+
* Description is intentionally unsupported for template function declarations.
|
|
3199
|
+
*/
|
|
3200
|
+
description?: never;
|
|
3201
|
+
/**
|
|
3202
|
+
* Optional. Describes the parameters to this function in JSON Schema Object
|
|
3203
|
+
* format. Reflects the Open API 3.03 Parameter Object. Parameter names are
|
|
3204
|
+
* case-sensitive. For a function with no parameters, this can be left unset.
|
|
3205
|
+
*/
|
|
3206
|
+
parameters?: ObjectSchema | ObjectSchemaRequest;
|
|
3207
|
+
/**
|
|
3208
|
+
* Reference to an actual function to call. Specifying this will cause the
|
|
3209
|
+
* function to be called automatically when requested by the model.
|
|
3210
|
+
*/
|
|
3211
|
+
functionReference?: Function;
|
|
3212
|
+
}
|
|
3213
|
+
|
|
3214
|
+
/* Excluded from this release type: TemplateFunctionDeclarationInternal */
|
|
3215
|
+
|
|
3216
|
+
/**
|
|
3217
|
+
* A piece of code that enables the system to interact with external systems.
|
|
3218
|
+
* @beta
|
|
3219
|
+
*/
|
|
3220
|
+
export declare interface TemplateFunctionDeclarationsTool {
|
|
3221
|
+
/**
|
|
3222
|
+
* Optional. One or more function declarations
|
|
3223
|
+
* to be passed to the server-side template execution.
|
|
3224
|
+
*/
|
|
3225
|
+
functionDeclarations?: TemplateFunctionDeclaration[];
|
|
3226
|
+
}
|
|
3227
|
+
|
|
3228
|
+
/* Excluded from this release type: TemplateFunctionDeclarationsToolInternal */
|
|
3229
|
+
|
|
3230
|
+
/**
|
|
3231
|
+
* Request sent through {@link TemplateGenerativeModel.generateContent}
|
|
3232
|
+
* @beta
|
|
3233
|
+
*/
|
|
3234
|
+
export declare interface TemplateGenerateContentRequest {
|
|
3235
|
+
inputs?: Record<string, unknown>;
|
|
3236
|
+
history?: Content[];
|
|
3237
|
+
tools?: TemplateFunctionDeclarationsTool[];
|
|
3238
|
+
toolConfig?: ToolConfig;
|
|
3239
|
+
[key: string]: unknown;
|
|
3240
|
+
}
|
|
3241
|
+
|
|
3039
3242
|
/**
|
|
3040
3243
|
* {@link GenerativeModel} APIs that execute on a server-side template.
|
|
3041
3244
|
*
|
|
@@ -3063,7 +3266,7 @@ export declare class TemplateGenerativeModel {
|
|
|
3063
3266
|
*
|
|
3064
3267
|
* @beta
|
|
3065
3268
|
*/
|
|
3066
|
-
generateContent(templateId: string, templateVariables:
|
|
3269
|
+
generateContent(templateId: string, templateVariables: Record<string, unknown>, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentResult>;
|
|
3067
3270
|
/**
|
|
3068
3271
|
* Makes a single streaming call to the model and returns an object
|
|
3069
3272
|
* containing an iterable stream that iterates over all chunks in the
|
|
@@ -3076,7 +3279,17 @@ export declare class TemplateGenerativeModel {
|
|
|
3076
3279
|
*
|
|
3077
3280
|
* @beta
|
|
3078
3281
|
*/
|
|
3079
|
-
generateContentStream(templateId: string, templateVariables:
|
|
3282
|
+
generateContentStream(templateId: string, templateVariables: Record<string, unknown>, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentStreamResult>;
|
|
3283
|
+
/**
|
|
3284
|
+
* Starts a {@link TemplateChatSession} that will use this template to
|
|
3285
|
+
* respond to messages.
|
|
3286
|
+
*
|
|
3287
|
+
* @param params - Configurations for the chat, including the template
|
|
3288
|
+
* ID and input variables.
|
|
3289
|
+
*
|
|
3290
|
+
* @beta
|
|
3291
|
+
*/
|
|
3292
|
+
startChat(params: StartTemplateChatParams): TemplateChatSession;
|
|
3080
3293
|
}
|
|
3081
3294
|
|
|
3082
3295
|
/**
|
|
@@ -3084,7 +3297,10 @@ export declare class TemplateGenerativeModel {
|
|
|
3084
3297
|
*
|
|
3085
3298
|
* This class should only be instantiated with {@link getTemplateImagenModel}.
|
|
3086
3299
|
*
|
|
3087
|
-
* @
|
|
3300
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
3301
|
+
* early as June 2026. As a replacement, you can
|
|
3302
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
3303
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
3088
3304
|
*/
|
|
3089
3305
|
export declare class TemplateImagenModel {
|
|
3090
3306
|
/* Excluded from this release type: _apiSettings */
|
|
@@ -3109,6 +3325,16 @@ export declare class TemplateImagenModel {
|
|
|
3109
3325
|
generateImages(templateId: string, templateVariables: object, singleRequestOptions?: SingleRequestOptions): Promise<ImagenGenerationResponse<ImagenInlineImage>>;
|
|
3110
3326
|
}
|
|
3111
3327
|
|
|
3328
|
+
/* Excluded from this release type: TemplateRequestInternal */
|
|
3329
|
+
|
|
3330
|
+
/**
|
|
3331
|
+
* Defines a tool that a {@link TemplateGenerativeModel} can call
|
|
3332
|
+
* to access external knowledge.
|
|
3333
|
+
* Only function declarations are currently supported for templates.
|
|
3334
|
+
* @beta
|
|
3335
|
+
*/
|
|
3336
|
+
export declare type TemplateTool = TemplateFunctionDeclarationsTool;
|
|
3337
|
+
|
|
3112
3338
|
/**
|
|
3113
3339
|
* Content part interface if the part represents a text string.
|
|
3114
3340
|
* @public
|