@firebase/ai 2.10.0 → 2.11.0-20260408221811
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.d.ts
CHANGED
|
@@ -352,19 +352,61 @@ export declare class BooleanSchema extends Schema {
|
|
|
352
352
|
*
|
|
353
353
|
* @public
|
|
354
354
|
*/
|
|
355
|
-
export declare class ChatSession {
|
|
355
|
+
export declare class ChatSession extends ChatSessionBase<StartChatParams, GenerateContentRequest, FunctionDeclarationsTool> {
|
|
356
356
|
model: string;
|
|
357
357
|
private chromeAdapter?;
|
|
358
358
|
params?: StartChatParams | undefined;
|
|
359
359
|
requestOptions?: RequestOptions | undefined;
|
|
360
|
-
|
|
361
|
-
|
|
360
|
+
constructor(apiSettings: ApiSettings, model: string, chromeAdapter?: ChromeAdapter | undefined, params?: StartChatParams | undefined, requestOptions?: RequestOptions | undefined);
|
|
361
|
+
/**
|
|
362
|
+
* Format Content into a request for generateContent or
|
|
363
|
+
* generateContentStream.
|
|
364
|
+
* @internal
|
|
365
|
+
*/
|
|
366
|
+
_formatRequest(incomingContent: Content, tempHistory: Content[]): GenerateContentRequest;
|
|
367
|
+
/**
|
|
368
|
+
* Calls default generateContent() (versus a specialized one like
|
|
369
|
+
* templateGenerateContent).
|
|
370
|
+
* @internal
|
|
371
|
+
*/
|
|
372
|
+
_callGenerateContent(formattedRequest: GenerateContentRequest, singleRequestOptions?: RequestOptions): Promise<GenerateContentResult>;
|
|
373
|
+
/**
|
|
374
|
+
* Calls default generateContentStream() (versus a specialized one like
|
|
375
|
+
* templateGenerateContentStream).
|
|
376
|
+
* @internal
|
|
377
|
+
*/
|
|
378
|
+
_callGenerateContentStream(formattedRequest: GenerateContentRequest, singleRequestOptions?: RequestOptions): Promise<GenerateContentStreamResult>;
|
|
379
|
+
/**
|
|
380
|
+
* Sends a chat message and receives a non-streaming
|
|
381
|
+
* {@link GenerateContentResult}
|
|
382
|
+
*/
|
|
383
|
+
sendMessage(request: string | Array<string | Part>, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentResult>;
|
|
384
|
+
/**
|
|
385
|
+
* Sends a chat message and receives the response as a
|
|
386
|
+
* {@link GenerateContentStreamResult} containing an iterable stream
|
|
387
|
+
* and a response promise.
|
|
388
|
+
*/
|
|
389
|
+
sendMessageStream(request: string | Array<string | Part>, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentStreamResult>;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Base class for various `ChatSession` classes that enables sending chat
|
|
394
|
+
* messages and stores history of sent and received messages so far.
|
|
395
|
+
*
|
|
396
|
+
* @public
|
|
397
|
+
*/
|
|
398
|
+
export declare abstract class ChatSessionBase<ParamsType extends StartChatParams | StartTemplateChatParams, RequestType, FunctionDeclarationsToolType extends FunctionDeclarationsTool | TemplateFunctionDeclarationsTool> {
|
|
399
|
+
params?: ParamsType | undefined;
|
|
400
|
+
requestOptions?: RequestOptions | undefined;
|
|
401
|
+
protected _apiSettings: ApiSettings;
|
|
402
|
+
protected _history: Content[];
|
|
362
403
|
/**
|
|
363
404
|
* Ensures sequential execution of chat messages to maintain history order.
|
|
364
405
|
* Each call waits for the previous one to settle before proceeding.
|
|
406
|
+
* @internal
|
|
365
407
|
*/
|
|
366
|
-
|
|
367
|
-
constructor(apiSettings: ApiSettings,
|
|
408
|
+
protected _sendPromise: Promise<void>;
|
|
409
|
+
constructor(apiSettings: ApiSettings, params?: ParamsType | undefined, requestOptions?: RequestOptions | undefined);
|
|
368
410
|
/**
|
|
369
411
|
* Gets the chat history so far. Blocked prompts are not added to history.
|
|
370
412
|
* Neither blocked candidates nor the prompts that generated them are added
|
|
@@ -372,22 +414,36 @@ export declare class ChatSession {
|
|
|
372
414
|
*/
|
|
373
415
|
getHistory(): Promise<Content[]>;
|
|
374
416
|
/**
|
|
375
|
-
* Format Content into a request for generateContent or
|
|
376
|
-
* generateContentStream.
|
|
417
|
+
* Format Content into a request for `generateContent` or
|
|
418
|
+
* `generateContentStream` (or their template versions).
|
|
377
419
|
* @internal
|
|
378
420
|
*/
|
|
379
|
-
_formatRequest(incomingContent: Content, tempHistory: Content[]):
|
|
421
|
+
abstract _formatRequest(incomingContent: Content, tempHistory: Content[]): RequestType;
|
|
422
|
+
/**
|
|
423
|
+
* Type-specific generate content calls (inherited classes may implement this
|
|
424
|
+
* to call basic `generateContent()` or the template version)
|
|
425
|
+
* @internal
|
|
426
|
+
*/
|
|
427
|
+
abstract _callGenerateContent(formattedRequest: RequestType, singleRequestOptions?: RequestOptions): Promise<GenerateContentResult>;
|
|
428
|
+
/**
|
|
429
|
+
* Type-specific generate content stream calls (inherited classes may implement this
|
|
430
|
+
* to call basic `generateContentStream()` or the template version)
|
|
431
|
+
* @internal
|
|
432
|
+
*/
|
|
433
|
+
abstract _callGenerateContentStream(formattedRequest: RequestType, singleRequestOptions?: RequestOptions): Promise<GenerateContentStreamResult>;
|
|
380
434
|
/**
|
|
381
435
|
* Sends a chat message and receives a non-streaming
|
|
382
436
|
* {@link GenerateContentResult}
|
|
437
|
+
* @internal
|
|
383
438
|
*/
|
|
384
|
-
|
|
439
|
+
_sendMessage(request: string | Array<string | Part>, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentResult>;
|
|
385
440
|
/**
|
|
386
441
|
* Sends a chat message and receives the response as a
|
|
387
442
|
* {@link GenerateContentStreamResult} containing an iterable stream
|
|
388
443
|
* and a response promise.
|
|
444
|
+
* @internal
|
|
389
445
|
*/
|
|
390
|
-
|
|
446
|
+
_sendMessageStream(request: string | Array<string | Part>, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentStreamResult>;
|
|
391
447
|
/**
|
|
392
448
|
* Get function calls that the SDK has references to actually call.
|
|
393
449
|
* This is all-or-nothing. If the model is requesting multiple
|
|
@@ -1162,6 +1218,11 @@ export declare function getGenerativeModel(ai: AI, modelParams: ModelParams | Hy
|
|
|
1162
1218
|
*
|
|
1163
1219
|
* Only Imagen 3 models (named `imagen-3.0-*`) are supported.
|
|
1164
1220
|
*
|
|
1221
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
1222
|
+
* early as June 2026. As a replacement, you can
|
|
1223
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
1224
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
1225
|
+
*
|
|
1165
1226
|
* @param ai - An {@link AI} instance.
|
|
1166
1227
|
* @param modelParams - Parameters to use when making Imagen requests.
|
|
1167
1228
|
* @param requestOptions - Additional options to use when making requests.
|
|
@@ -1202,10 +1263,13 @@ export declare function getTemplateGenerativeModel(ai: AI, requestOptions?: Requ
|
|
|
1202
1263
|
* Returns a {@link TemplateImagenModel} class for executing server-side
|
|
1203
1264
|
* Imagen templates.
|
|
1204
1265
|
*
|
|
1266
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
1267
|
+
* early as June 2026. As a replacement, you can
|
|
1268
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
1269
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
1270
|
+
*
|
|
1205
1271
|
* @param ai - An {@link AI} instance.
|
|
1206
1272
|
* @param requestOptions - Additional options to use when making requests.
|
|
1207
|
-
*
|
|
1208
|
-
* @beta
|
|
1209
1273
|
*/
|
|
1210
1274
|
export declare function getTemplateImagenModel(ai: AI, requestOptions?: RequestOptions): TemplateImagenModel;
|
|
1211
1275
|
|
|
@@ -1550,6 +1614,11 @@ export declare interface HybridParams {
|
|
|
1550
1614
|
* See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation }
|
|
1551
1615
|
* for more details and examples of the supported aspect ratios.
|
|
1552
1616
|
*
|
|
1617
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
1618
|
+
* early as June 2026. As a replacement, you can
|
|
1619
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
1620
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
1621
|
+
*
|
|
1553
1622
|
* @public
|
|
1554
1623
|
*/
|
|
1555
1624
|
export declare const ImagenAspectRatio: {
|
|
@@ -1584,6 +1653,11 @@ export declare const ImagenAspectRatio: {
|
|
|
1584
1653
|
* See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation }
|
|
1585
1654
|
* for more details and examples of the supported aspect ratios.
|
|
1586
1655
|
*
|
|
1656
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
1657
|
+
* early as June 2026. As a replacement, you can
|
|
1658
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
1659
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
1660
|
+
*
|
|
1587
1661
|
* @public
|
|
1588
1662
|
*/
|
|
1589
1663
|
export declare type ImagenAspectRatio = (typeof ImagenAspectRatio)[keyof typeof ImagenAspectRatio];
|
|
@@ -1592,6 +1666,12 @@ export declare type ImagenAspectRatio = (typeof ImagenAspectRatio)[keyof typeof
|
|
|
1592
1666
|
* An image generated by Imagen, stored in a Cloud Storage for Firebase bucket.
|
|
1593
1667
|
*
|
|
1594
1668
|
* This feature is not available yet.
|
|
1669
|
+
*
|
|
1670
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
1671
|
+
* early as June 2026. As a replacement, you can
|
|
1672
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
1673
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
1674
|
+
*
|
|
1595
1675
|
* @public
|
|
1596
1676
|
*/
|
|
1597
1677
|
export declare interface ImagenGCSImage {
|
|
@@ -1615,6 +1695,11 @@ export declare interface ImagenGCSImage {
|
|
|
1615
1695
|
* See the {@link http://firebase.google.com/docs/vertex-ai/generate-images-imagen | documentation} for
|
|
1616
1696
|
* more details.
|
|
1617
1697
|
*
|
|
1698
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
1699
|
+
* early as June 2026. As a replacement, you can
|
|
1700
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
1701
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
1702
|
+
*
|
|
1618
1703
|
* @public
|
|
1619
1704
|
*/
|
|
1620
1705
|
export declare interface ImagenGenerationConfig {
|
|
@@ -1667,6 +1752,11 @@ export declare interface ImagenGenerationConfig {
|
|
|
1667
1752
|
/**
|
|
1668
1753
|
* The response from a request to generate images with Imagen.
|
|
1669
1754
|
*
|
|
1755
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
1756
|
+
* early as June 2026. As a replacement, you can
|
|
1757
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
1758
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
1759
|
+
*
|
|
1670
1760
|
* @public
|
|
1671
1761
|
*/
|
|
1672
1762
|
export declare interface ImagenGenerationResponse<T extends ImagenInlineImage | ImagenGCSImage> {
|
|
@@ -1722,6 +1812,11 @@ export declare interface ImagenGenerationResponse<T extends ImagenInlineImage |
|
|
|
1722
1812
|
* }
|
|
1723
1813
|
* ```
|
|
1724
1814
|
*
|
|
1815
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
1816
|
+
* early as June 2026. As a replacement, you can
|
|
1817
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
1818
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
1819
|
+
*
|
|
1725
1820
|
* @public
|
|
1726
1821
|
*/
|
|
1727
1822
|
export declare class ImagenImageFormat {
|
|
@@ -1772,6 +1867,11 @@ export declare class ImagenImageFormat {
|
|
|
1772
1867
|
/**
|
|
1773
1868
|
* An image generated by Imagen, represented as inline data.
|
|
1774
1869
|
*
|
|
1870
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
1871
|
+
* early as June 2026. As a replacement, you can
|
|
1872
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
1873
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
1874
|
+
*
|
|
1775
1875
|
* @public
|
|
1776
1876
|
*/
|
|
1777
1877
|
export declare interface ImagenInlineImage {
|
|
@@ -1807,6 +1907,11 @@ export declare interface ImagenInlineImage {
|
|
|
1807
1907
|
* }
|
|
1808
1908
|
* ```
|
|
1809
1909
|
*
|
|
1910
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
1911
|
+
* early as June 2026. As a replacement, you can
|
|
1912
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
1913
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
1914
|
+
*
|
|
1810
1915
|
* @public
|
|
1811
1916
|
*/
|
|
1812
1917
|
export declare class ImagenModel extends AIModel {
|
|
@@ -1874,6 +1979,11 @@ export declare class ImagenModel extends AIModel {
|
|
|
1874
1979
|
/**
|
|
1875
1980
|
* Parameters for configuring an {@link ImagenModel}.
|
|
1876
1981
|
*
|
|
1982
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
1983
|
+
* early as June 2026. As a replacement, you can
|
|
1984
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
1985
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
1986
|
+
*
|
|
1877
1987
|
* @public
|
|
1878
1988
|
*/
|
|
1879
1989
|
export declare interface ImagenModelParams {
|
|
@@ -1903,6 +2013,11 @@ export declare interface ImagenModelParams {
|
|
|
1903
2013
|
* See the <a href="http://firebase.google.com/docs/vertex-ai/generate-images">personGeneration</a>
|
|
1904
2014
|
* documentation for more details.
|
|
1905
2015
|
*
|
|
2016
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
2017
|
+
* early as June 2026. As a replacement, you can
|
|
2018
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
2019
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
2020
|
+
*
|
|
1906
2021
|
* @public
|
|
1907
2022
|
*/
|
|
1908
2023
|
export declare const ImagenPersonFilterLevel: {
|
|
@@ -1934,6 +2049,11 @@ export declare const ImagenPersonFilterLevel: {
|
|
|
1934
2049
|
* See the <a href="http://firebase.google.com/docs/vertex-ai/generate-images">personGeneration</a>
|
|
1935
2050
|
* documentation for more details.
|
|
1936
2051
|
*
|
|
2052
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
2053
|
+
* early as June 2026. As a replacement, you can
|
|
2054
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
2055
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
2056
|
+
*
|
|
1937
2057
|
* @public
|
|
1938
2058
|
*/
|
|
1939
2059
|
export declare type ImagenPersonFilterLevel = (typeof ImagenPersonFilterLevel)[keyof typeof ImagenPersonFilterLevel];
|
|
@@ -1948,6 +2068,11 @@ export declare type ImagenPersonFilterLevel = (typeof ImagenPersonFilterLevel)[k
|
|
|
1948
2068
|
* and the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters | Responsible AI and usage guidelines}
|
|
1949
2069
|
* for more details.
|
|
1950
2070
|
*
|
|
2071
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
2072
|
+
* early as June 2026. As a replacement, you can
|
|
2073
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
2074
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
2075
|
+
*
|
|
1951
2076
|
* @public
|
|
1952
2077
|
*/
|
|
1953
2078
|
export declare const ImagenSafetyFilterLevel: {
|
|
@@ -1982,6 +2107,11 @@ export declare const ImagenSafetyFilterLevel: {
|
|
|
1982
2107
|
* and the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters | Responsible AI and usage guidelines}
|
|
1983
2108
|
* for more details.
|
|
1984
2109
|
*
|
|
2110
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
2111
|
+
* early as June 2026. As a replacement, you can
|
|
2112
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
2113
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
2114
|
+
*
|
|
1985
2115
|
* @public
|
|
1986
2116
|
*/
|
|
1987
2117
|
export declare type ImagenSafetyFilterLevel = (typeof ImagenSafetyFilterLevel)[keyof typeof ImagenSafetyFilterLevel];
|
|
@@ -1992,6 +2122,11 @@ export declare type ImagenSafetyFilterLevel = (typeof ImagenSafetyFilterLevel)[k
|
|
|
1992
2122
|
* See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation }
|
|
1993
2123
|
* for more details.
|
|
1994
2124
|
*
|
|
2125
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
2126
|
+
* early as June 2026. As a replacement, you can
|
|
2127
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
2128
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
2129
|
+
*
|
|
1995
2130
|
* @public
|
|
1996
2131
|
*/
|
|
1997
2132
|
export declare interface ImagenSafetySettings {
|
|
@@ -2110,7 +2245,13 @@ export declare type Language = (typeof Language)[keyof typeof Language];
|
|
|
2110
2245
|
* @beta
|
|
2111
2246
|
*/
|
|
2112
2247
|
export declare interface LanguageModelCreateCoreOptions {
|
|
2248
|
+
/**
|
|
2249
|
+
* @deprecated
|
|
2250
|
+
*/
|
|
2113
2251
|
topK?: number;
|
|
2252
|
+
/**
|
|
2253
|
+
* @deprecated
|
|
2254
|
+
*/
|
|
2114
2255
|
temperature?: number;
|
|
2115
2256
|
expectedInputs?: LanguageModelExpected[];
|
|
2116
2257
|
}
|
|
@@ -2721,7 +2862,7 @@ export declare interface RequestOptions {
|
|
|
2721
2862
|
* When it reaches this limit, it will return the last response received
|
|
2722
2863
|
* from the model, whether it is a text response or further function calls.
|
|
2723
2864
|
*/
|
|
2724
|
-
|
|
2865
|
+
maxSequentialFunctionCalls?: number;
|
|
2725
2866
|
}
|
|
2726
2867
|
|
|
2727
2868
|
/**
|
|
@@ -3194,6 +3335,22 @@ export declare interface StartChatParams extends BaseParams {
|
|
|
3194
3335
|
systemInstruction?: string | Part | Content;
|
|
3195
3336
|
}
|
|
3196
3337
|
|
|
3338
|
+
/**
|
|
3339
|
+
* Params for {@link TemplateGenerativeModel.startChat}.
|
|
3340
|
+
* @beta
|
|
3341
|
+
*/
|
|
3342
|
+
export declare interface StartTemplateChatParams extends Omit<StartChatParams, 'tools'> {
|
|
3343
|
+
/**
|
|
3344
|
+
* The ID of the server-side template to execute.
|
|
3345
|
+
*/
|
|
3346
|
+
templateId: string;
|
|
3347
|
+
/**
|
|
3348
|
+
* A key-value map of variables to populate the template with.
|
|
3349
|
+
*/
|
|
3350
|
+
templateVariables?: Record<string, unknown>;
|
|
3351
|
+
tools?: TemplateTool[];
|
|
3352
|
+
}
|
|
3353
|
+
|
|
3197
3354
|
/**
|
|
3198
3355
|
* Schema class for "string" types. Can be used with or without
|
|
3199
3356
|
* enum values.
|
|
@@ -3208,6 +3365,122 @@ export declare class StringSchema extends Schema {
|
|
|
3208
3365
|
toJSON(): SchemaRequest;
|
|
3209
3366
|
}
|
|
3210
3367
|
|
|
3368
|
+
/**
|
|
3369
|
+
* `ChatSession` class for use with server prompt templates that
|
|
3370
|
+
* enables sending chat messages and stores history of sent and
|
|
3371
|
+
* received messages so far.
|
|
3372
|
+
*
|
|
3373
|
+
* @beta
|
|
3374
|
+
*/
|
|
3375
|
+
export declare class TemplateChatSession extends ChatSessionBase<StartTemplateChatParams, TemplateRequestInternal, TemplateFunctionDeclarationsTool> {
|
|
3376
|
+
params: StartTemplateChatParams;
|
|
3377
|
+
requestOptions?: RequestOptions | undefined;
|
|
3378
|
+
constructor(apiSettings: ApiSettings, params: StartTemplateChatParams, requestOptions?: RequestOptions | undefined);
|
|
3379
|
+
/**
|
|
3380
|
+
* Format the internal state to the body payload for `templateGenerateContent`.
|
|
3381
|
+
* @internal
|
|
3382
|
+
*/
|
|
3383
|
+
_formatRequest(incomingContent: Content, tempHistory: Content[]): TemplateRequestInternal;
|
|
3384
|
+
/**
|
|
3385
|
+
* Calls the specific templateGenerateContent() function needed for
|
|
3386
|
+
* this specialized TemplateChatSession.
|
|
3387
|
+
* @internal
|
|
3388
|
+
*/
|
|
3389
|
+
_callGenerateContent(formattedRequest: TemplateRequestInternal, singleRequestOptions?: RequestOptions): Promise<GenerateContentResult>;
|
|
3390
|
+
/**
|
|
3391
|
+
* Calls the specific templateGenerateContentStream() function needed for
|
|
3392
|
+
* this specialized TemplateChatSession.
|
|
3393
|
+
* @internal
|
|
3394
|
+
*/
|
|
3395
|
+
_callGenerateContentStream(formattedRequest: TemplateRequestInternal, singleRequestOptions?: RequestOptions): Promise<GenerateContentStreamResult>;
|
|
3396
|
+
/**
|
|
3397
|
+
* Sends a chat message and receives a non-streaming
|
|
3398
|
+
* {@link GenerateContentResult}
|
|
3399
|
+
*/
|
|
3400
|
+
sendMessage(request: string | Array<string | Part>, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentResult>;
|
|
3401
|
+
/**
|
|
3402
|
+
* Sends a chat message and receives the response as a
|
|
3403
|
+
* {@link GenerateContentStreamResult} containing an iterable stream
|
|
3404
|
+
* and a response promise.
|
|
3405
|
+
*/
|
|
3406
|
+
sendMessageStream(request: string | Array<string | Part>, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentStreamResult>;
|
|
3407
|
+
}
|
|
3408
|
+
|
|
3409
|
+
/**
|
|
3410
|
+
* Structured representation of a template function declaration.
|
|
3411
|
+
* Included in this declaration are the function name and parameters. This
|
|
3412
|
+
* `TemplateFunctionDeclaration` is a representation of a block of code that can be used
|
|
3413
|
+
* as a Tool by the model and executed by the client.
|
|
3414
|
+
* Note: Template function declarations do not support description fields.
|
|
3415
|
+
* @beta
|
|
3416
|
+
*/
|
|
3417
|
+
export declare interface TemplateFunctionDeclaration {
|
|
3418
|
+
/**
|
|
3419
|
+
* The name of the function to call. Must start with a letter or an
|
|
3420
|
+
* underscore. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with
|
|
3421
|
+
* a max length of 64.
|
|
3422
|
+
*/
|
|
3423
|
+
name: string;
|
|
3424
|
+
/**
|
|
3425
|
+
* Description is intentionally unsupported for template function declarations.
|
|
3426
|
+
*/
|
|
3427
|
+
description?: never;
|
|
3428
|
+
/**
|
|
3429
|
+
* Optional. Describes the parameters to this function in JSON Schema Object
|
|
3430
|
+
* format. Reflects the Open API 3.03 Parameter Object. Parameter names are
|
|
3431
|
+
* case-sensitive. For a function with no parameters, this can be left unset.
|
|
3432
|
+
*/
|
|
3433
|
+
parameters?: ObjectSchema | ObjectSchemaRequest;
|
|
3434
|
+
/**
|
|
3435
|
+
* Reference to an actual function to call. Specifying this will cause the
|
|
3436
|
+
* function to be called automatically when requested by the model.
|
|
3437
|
+
*/
|
|
3438
|
+
functionReference?: Function;
|
|
3439
|
+
}
|
|
3440
|
+
|
|
3441
|
+
/**
|
|
3442
|
+
* @internal
|
|
3443
|
+
*/
|
|
3444
|
+
export declare interface TemplateFunctionDeclarationInternal extends Omit<TemplateFunctionDeclaration, 'parameters'> {
|
|
3445
|
+
inputSchema?: ObjectSchema | ObjectSchemaRequest;
|
|
3446
|
+
}
|
|
3447
|
+
|
|
3448
|
+
/**
|
|
3449
|
+
* A piece of code that enables the system to interact with external systems.
|
|
3450
|
+
* @beta
|
|
3451
|
+
*/
|
|
3452
|
+
export declare interface TemplateFunctionDeclarationsTool {
|
|
3453
|
+
/**
|
|
3454
|
+
* Optional. One or more function declarations
|
|
3455
|
+
* to be passed to the server-side template execution.
|
|
3456
|
+
*/
|
|
3457
|
+
functionDeclarations?: TemplateFunctionDeclaration[];
|
|
3458
|
+
}
|
|
3459
|
+
|
|
3460
|
+
/**
|
|
3461
|
+
* The modified interface for the tool that is sent to the backend.
|
|
3462
|
+
* @internal
|
|
3463
|
+
*/
|
|
3464
|
+
export declare interface TemplateFunctionDeclarationsToolInternal {
|
|
3465
|
+
/**
|
|
3466
|
+
* Optional. One or more function declarations
|
|
3467
|
+
* to be passed to the server-side template execution.
|
|
3468
|
+
*/
|
|
3469
|
+
templateFunctions?: TemplateFunctionDeclarationInternal[];
|
|
3470
|
+
}
|
|
3471
|
+
|
|
3472
|
+
/**
|
|
3473
|
+
* Request sent through {@link TemplateGenerativeModel.generateContent}
|
|
3474
|
+
* @beta
|
|
3475
|
+
*/
|
|
3476
|
+
export declare interface TemplateGenerateContentRequest {
|
|
3477
|
+
inputs?: Record<string, unknown>;
|
|
3478
|
+
history?: Content[];
|
|
3479
|
+
tools?: TemplateFunctionDeclarationsTool[];
|
|
3480
|
+
toolConfig?: ToolConfig;
|
|
3481
|
+
[key: string]: unknown;
|
|
3482
|
+
}
|
|
3483
|
+
|
|
3211
3484
|
/**
|
|
3212
3485
|
* {@link GenerativeModel} APIs that execute on a server-side template.
|
|
3213
3486
|
*
|
|
@@ -3238,7 +3511,7 @@ export declare class TemplateGenerativeModel {
|
|
|
3238
3511
|
*
|
|
3239
3512
|
* @beta
|
|
3240
3513
|
*/
|
|
3241
|
-
generateContent(templateId: string, templateVariables:
|
|
3514
|
+
generateContent(templateId: string, templateVariables: Record<string, unknown>, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentResult>;
|
|
3242
3515
|
/**
|
|
3243
3516
|
* Makes a single streaming call to the model and returns an object
|
|
3244
3517
|
* containing an iterable stream that iterates over all chunks in the
|
|
@@ -3251,7 +3524,17 @@ export declare class TemplateGenerativeModel {
|
|
|
3251
3524
|
*
|
|
3252
3525
|
* @beta
|
|
3253
3526
|
*/
|
|
3254
|
-
generateContentStream(templateId: string, templateVariables:
|
|
3527
|
+
generateContentStream(templateId: string, templateVariables: Record<string, unknown>, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentStreamResult>;
|
|
3528
|
+
/**
|
|
3529
|
+
* Starts a {@link TemplateChatSession} that will use this template to
|
|
3530
|
+
* respond to messages.
|
|
3531
|
+
*
|
|
3532
|
+
* @param params - Configurations for the chat, including the template
|
|
3533
|
+
* ID and input variables.
|
|
3534
|
+
*
|
|
3535
|
+
* @beta
|
|
3536
|
+
*/
|
|
3537
|
+
startChat(params: StartTemplateChatParams): TemplateChatSession;
|
|
3255
3538
|
}
|
|
3256
3539
|
|
|
3257
3540
|
/**
|
|
@@ -3259,7 +3542,10 @@ export declare class TemplateGenerativeModel {
|
|
|
3259
3542
|
*
|
|
3260
3543
|
* This class should only be instantiated with {@link getTemplateImagenModel}.
|
|
3261
3544
|
*
|
|
3262
|
-
* @
|
|
3545
|
+
* @deprecated All Imagen models are deprecated and will shut down as
|
|
3546
|
+
* early as June 2026. As a replacement, you can
|
|
3547
|
+
* {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
|
|
3548
|
+
* migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
|
|
3263
3549
|
*/
|
|
3264
3550
|
export declare class TemplateImagenModel {
|
|
3265
3551
|
/**
|
|
@@ -3287,6 +3573,22 @@ export declare class TemplateImagenModel {
|
|
|
3287
3573
|
generateImages(templateId: string, templateVariables: object, singleRequestOptions?: SingleRequestOptions): Promise<ImagenGenerationResponse<ImagenInlineImage>>;
|
|
3288
3574
|
}
|
|
3289
3575
|
|
|
3576
|
+
/**
|
|
3577
|
+
* Internal version of the template generate content request.
|
|
3578
|
+
* @internal
|
|
3579
|
+
*/
|
|
3580
|
+
export declare interface TemplateRequestInternal extends Omit<TemplateGenerateContentRequest, 'tools'> {
|
|
3581
|
+
tools?: TemplateFunctionDeclarationsToolInternal[];
|
|
3582
|
+
}
|
|
3583
|
+
|
|
3584
|
+
/**
|
|
3585
|
+
* Defines a tool that a {@link TemplateGenerativeModel} can call
|
|
3586
|
+
* to access external knowledge.
|
|
3587
|
+
* Only function declarations are currently supported for templates.
|
|
3588
|
+
* @beta
|
|
3589
|
+
*/
|
|
3590
|
+
export declare type TemplateTool = TemplateFunctionDeclarationsTool;
|
|
3591
|
+
|
|
3290
3592
|
/**
|
|
3291
3593
|
* Content part interface if the part represents a text string.
|
|
3292
3594
|
* @public
|