@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.
Files changed (39) hide show
  1. package/dist/ai-public.d.ts +246 -20
  2. package/dist/ai.d.ts +318 -16
  3. package/dist/esm/index.esm.js +364 -140
  4. package/dist/esm/index.esm.js.map +1 -1
  5. package/dist/esm/src/api.d.ts +12 -2
  6. package/dist/esm/src/methods/chat-session-base.d.ts +89 -0
  7. package/dist/esm/src/methods/chat-session.d.ts +15 -30
  8. package/dist/esm/src/methods/generate-content.d.ts +3 -2
  9. package/dist/esm/src/methods/template-chat-session.d.ts +59 -0
  10. package/dist/esm/src/models/generative-model.d.ts +5 -0
  11. package/dist/esm/src/models/imagen-model.d.ts +5 -0
  12. package/dist/esm/src/models/template-generative-model.d.ts +14 -3
  13. package/dist/esm/src/models/template-imagen-model.d.ts +4 -1
  14. package/dist/esm/src/requests/imagen-image-format.d.ts +5 -0
  15. package/dist/esm/src/types/imagen/requests.d.ts +45 -0
  16. package/dist/esm/src/types/imagen/responses.d.ts +16 -0
  17. package/dist/esm/src/types/language-model.d.ts +6 -0
  18. package/dist/esm/src/types/requests.d.ts +100 -1
  19. package/dist/index.cjs.js +365 -139
  20. package/dist/index.cjs.js.map +1 -1
  21. package/dist/index.node.cjs.js +365 -139
  22. package/dist/index.node.cjs.js.map +1 -1
  23. package/dist/index.node.mjs +364 -140
  24. package/dist/index.node.mjs.map +1 -1
  25. package/dist/src/api.d.ts +12 -2
  26. package/dist/src/methods/chat-session-base.d.ts +89 -0
  27. package/dist/src/methods/chat-session.d.ts +15 -30
  28. package/dist/src/methods/generate-content.d.ts +3 -2
  29. package/dist/src/methods/template-chat-session.d.ts +59 -0
  30. package/dist/src/models/generative-model.d.ts +5 -0
  31. package/dist/src/models/imagen-model.d.ts +5 -0
  32. package/dist/src/models/template-generative-model.d.ts +14 -3
  33. package/dist/src/models/template-imagen-model.d.ts +4 -1
  34. package/dist/src/requests/imagen-image-format.d.ts +5 -0
  35. package/dist/src/types/imagen/requests.d.ts +45 -0
  36. package/dist/src/types/imagen/responses.d.ts +16 -0
  37. package/dist/src/types/language-model.d.ts +6 -0
  38. package/dist/src/types/requests.d.ts +100 -1
  39. package/package.json +2 -2
@@ -24,7 +24,9 @@ import { AIModel, GenerativeModel, LiveGenerativeModel, ImagenModel } from './mo
24
24
  import { TemplateGenerativeModel } from './models/template-generative-model';
25
25
  import { TemplateImagenModel } from './models/template-imagen-model';
26
26
  export { ChatSession } from './methods/chat-session';
27
+ export { ChatSessionBase } from './methods/chat-session-base';
27
28
  export { LiveSession } from './methods/live-session';
29
+ export { TemplateChatSession } from './methods/template-chat-session';
28
30
  export * from './requests/schema-builder';
29
31
  export { ImagenImageFormat } from './requests/imagen-image-format';
30
32
  export { AIModel, GenerativeModel, LiveGenerativeModel, ImagenModel, TemplateGenerativeModel, TemplateImagenModel, AIError };
@@ -76,6 +78,11 @@ export declare function getGenerativeModel(ai: AI, modelParams: ModelParams | Hy
76
78
  *
77
79
  * Only Imagen 3 models (named `imagen-3.0-*`) are supported.
78
80
  *
81
+ * @deprecated All Imagen models are deprecated and will shut down as
82
+ * early as June 2026. As a replacement, you can
83
+ * {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
84
+ * migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
85
+ *
79
86
  * @param ai - An {@link AI} instance.
80
87
  * @param modelParams - Parameters to use when making Imagen requests.
81
88
  * @param requestOptions - Additional options to use when making requests.
@@ -113,9 +120,12 @@ export declare function getTemplateGenerativeModel(ai: AI, requestOptions?: Requ
113
120
  * Returns a {@link TemplateImagenModel} class for executing server-side
114
121
  * Imagen templates.
115
122
  *
123
+ * @deprecated All Imagen models are deprecated and will shut down as
124
+ * early as June 2026. As a replacement, you can
125
+ * {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
126
+ * migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
127
+ *
116
128
  * @param ai - An {@link AI} instance.
117
129
  * @param requestOptions - Additional options to use when making requests.
118
- *
119
- * @beta
120
130
  */
121
131
  export declare function getTemplateImagenModel(ai: AI, requestOptions?: RequestOptions): TemplateImagenModel;
@@ -0,0 +1,89 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { Content, FunctionCall, FunctionDeclarationsTool, FunctionResponsePart, GenerateContentResponse, GenerateContentResult, GenerateContentStreamResult, Part, RequestOptions, SingleRequestOptions, StartChatParams, StartTemplateChatParams, TemplateFunctionDeclarationsTool } from '../types';
18
+ import { ApiSettings } from '../types/internal';
19
+ /**
20
+ * Base class for various `ChatSession` classes that enables sending chat
21
+ * messages and stores history of sent and received messages so far.
22
+ *
23
+ * @public
24
+ */
25
+ export declare abstract class ChatSessionBase<ParamsType extends StartChatParams | StartTemplateChatParams, RequestType, FunctionDeclarationsToolType extends FunctionDeclarationsTool | TemplateFunctionDeclarationsTool> {
26
+ params?: ParamsType | undefined;
27
+ requestOptions?: RequestOptions | undefined;
28
+ protected _apiSettings: ApiSettings;
29
+ protected _history: Content[];
30
+ /**
31
+ * Ensures sequential execution of chat messages to maintain history order.
32
+ * Each call waits for the previous one to settle before proceeding.
33
+ * @internal
34
+ */
35
+ protected _sendPromise: Promise<void>;
36
+ constructor(apiSettings: ApiSettings, params?: ParamsType | undefined, requestOptions?: RequestOptions | undefined);
37
+ /**
38
+ * Gets the chat history so far. Blocked prompts are not added to history.
39
+ * Neither blocked candidates nor the prompts that generated them are added
40
+ * to history.
41
+ */
42
+ getHistory(): Promise<Content[]>;
43
+ /**
44
+ * Format Content into a request for `generateContent` or
45
+ * `generateContentStream` (or their template versions).
46
+ * @internal
47
+ */
48
+ abstract _formatRequest(incomingContent: Content, tempHistory: Content[]): RequestType;
49
+ /**
50
+ * Type-specific generate content calls (inherited classes may implement this
51
+ * to call basic `generateContent()` or the template version)
52
+ * @internal
53
+ */
54
+ abstract _callGenerateContent(formattedRequest: RequestType, singleRequestOptions?: RequestOptions): Promise<GenerateContentResult>;
55
+ /**
56
+ * Type-specific generate content stream calls (inherited classes may implement this
57
+ * to call basic `generateContentStream()` or the template version)
58
+ * @internal
59
+ */
60
+ abstract _callGenerateContentStream(formattedRequest: RequestType, singleRequestOptions?: RequestOptions): Promise<GenerateContentStreamResult>;
61
+ /**
62
+ * Sends a chat message and receives a non-streaming
63
+ * {@link GenerateContentResult}
64
+ * @internal
65
+ */
66
+ _sendMessage(request: string | Array<string | Part>, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentResult>;
67
+ /**
68
+ * Sends a chat message and receives the response as a
69
+ * {@link GenerateContentStreamResult} containing an iterable stream
70
+ * and a response promise.
71
+ * @internal
72
+ */
73
+ _sendMessageStream(request: string | Array<string | Part>, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentStreamResult>;
74
+ /**
75
+ * Get function calls that the SDK has references to actually call.
76
+ * This is all-or-nothing. If the model is requesting multiple
77
+ * function calls, all of them must have references in order for
78
+ * automatic function calling to work.
79
+ *
80
+ * @internal
81
+ */
82
+ _getCallableFunctionCalls(response?: GenerateContentResponse): FunctionCall[] | undefined;
83
+ /**
84
+ * Call user-defined functions if requested by the model, and return
85
+ * the response that should be sent to the model.
86
+ * @internal
87
+ */
88
+ _callFunctionsAsNeeded(functionCalls: FunctionCall[]): Promise<FunctionResponsePart[]>;
89
+ }
@@ -14,40 +14,40 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import { Content, FunctionCall, FunctionResponsePart, GenerateContentRequest, GenerateContentResponse, GenerateContentResult, GenerateContentStreamResult, Part, RequestOptions, SingleRequestOptions, StartChatParams } from '../types';
17
+ import { Content, FunctionDeclarationsTool, GenerateContentRequest, GenerateContentResult, GenerateContentStreamResult, Part, RequestOptions, SingleRequestOptions, StartChatParams } from '../types';
18
18
  import { ApiSettings } from '../types/internal';
19
19
  import { ChromeAdapter } from '../types/chrome-adapter';
20
+ import { ChatSessionBase } from './chat-session-base';
20
21
  /**
21
22
  * ChatSession class that enables sending chat messages and stores
22
23
  * history of sent and received messages so far.
23
24
  *
24
25
  * @public
25
26
  */
26
- export declare class ChatSession {
27
+ export declare class ChatSession extends ChatSessionBase<StartChatParams, GenerateContentRequest, FunctionDeclarationsTool> {
27
28
  model: string;
28
29
  private chromeAdapter?;
29
30
  params?: StartChatParams | undefined;
30
31
  requestOptions?: RequestOptions | undefined;
31
- private _apiSettings;
32
- private _history;
33
- /**
34
- * Ensures sequential execution of chat messages to maintain history order.
35
- * Each call waits for the previous one to settle before proceeding.
36
- */
37
- private _sendPromise;
38
32
  constructor(apiSettings: ApiSettings, model: string, chromeAdapter?: ChromeAdapter | undefined, params?: StartChatParams | undefined, requestOptions?: RequestOptions | undefined);
39
- /**
40
- * Gets the chat history so far. Blocked prompts are not added to history.
41
- * Neither blocked candidates nor the prompts that generated them are added
42
- * to history.
43
- */
44
- getHistory(): Promise<Content[]>;
45
33
  /**
46
34
  * Format Content into a request for generateContent or
47
35
  * generateContentStream.
48
36
  * @internal
49
37
  */
50
38
  _formatRequest(incomingContent: Content, tempHistory: Content[]): GenerateContentRequest;
39
+ /**
40
+ * Calls default generateContent() (versus a specialized one like
41
+ * templateGenerateContent).
42
+ * @internal
43
+ */
44
+ _callGenerateContent(formattedRequest: GenerateContentRequest, singleRequestOptions?: RequestOptions): Promise<GenerateContentResult>;
45
+ /**
46
+ * Calls default generateContentStream() (versus a specialized one like
47
+ * templateGenerateContentStream).
48
+ * @internal
49
+ */
50
+ _callGenerateContentStream(formattedRequest: GenerateContentRequest, singleRequestOptions?: RequestOptions): Promise<GenerateContentStreamResult>;
51
51
  /**
52
52
  * Sends a chat message and receives a non-streaming
53
53
  * {@link GenerateContentResult}
@@ -59,19 +59,4 @@ export declare class ChatSession {
59
59
  * and a response promise.
60
60
  */
61
61
  sendMessageStream(request: string | Array<string | Part>, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentStreamResult>;
62
- /**
63
- * Get function calls that the SDK has references to actually call.
64
- * This is all-or-nothing. If the model is requesting multiple
65
- * function calls, all of them must have references in order for
66
- * automatic function calling to work.
67
- *
68
- * @internal
69
- */
70
- _getCallableFunctionCalls(response?: GenerateContentResponse): FunctionCall[] | undefined;
71
- /**
72
- * Call user-defined functions if requested by the model, and return
73
- * the response that should be sent to the model.
74
- * @internal
75
- */
76
- _callFunctionsAsNeeded(functionCalls: FunctionCall[]): Promise<FunctionResponsePart[]>;
77
62
  }
@@ -16,10 +16,11 @@
16
16
  */
17
17
  import { GenerateContentRequest, GenerateContentResponse, GenerateContentResult, GenerateContentStreamResult, SingleRequestOptions } from '../types';
18
18
  import { ApiSettings } from '../types/internal';
19
+ import { TemplateRequestInternal } from '../public-types';
19
20
  import { ChromeAdapter } from '../types/chrome-adapter';
20
21
  export declare function generateContentStream(apiSettings: ApiSettings, model: string, params: GenerateContentRequest, chromeAdapter?: ChromeAdapter, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentStreamResult & {
21
22
  firstValue?: GenerateContentResponse;
22
23
  }>;
23
- export declare function templateGenerateContent(apiSettings: ApiSettings, templateId: string, templateParams: object, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentResult>;
24
- export declare function templateGenerateContentStream(apiSettings: ApiSettings, templateId: string, templateParams: object, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentStreamResult>;
24
+ export declare function templateGenerateContent(apiSettings: ApiSettings, templateId: string, templateParams: TemplateRequestInternal, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentResult>;
25
+ export declare function templateGenerateContentStream(apiSettings: ApiSettings, templateId: string, templateParams: TemplateRequestInternal, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentStreamResult>;
25
26
  export declare function generateContent(apiSettings: ApiSettings, model: string, params: GenerateContentRequest, chromeAdapter?: ChromeAdapter, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentResult>;
@@ -0,0 +1,59 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { Content, GenerateContentResult, GenerateContentStreamResult, Part, RequestOptions, SingleRequestOptions, StartTemplateChatParams, TemplateFunctionDeclarationsTool, TemplateRequestInternal } from '../types';
18
+ import { ApiSettings } from '../types/internal';
19
+ import { ChatSessionBase } from './chat-session-base';
20
+ /**
21
+ * `ChatSession` class for use with server prompt templates that
22
+ * enables sending chat messages and stores history of sent and
23
+ * received messages so far.
24
+ *
25
+ * @beta
26
+ */
27
+ export declare class TemplateChatSession extends ChatSessionBase<StartTemplateChatParams, TemplateRequestInternal, TemplateFunctionDeclarationsTool> {
28
+ params: StartTemplateChatParams;
29
+ requestOptions?: RequestOptions | undefined;
30
+ constructor(apiSettings: ApiSettings, params: StartTemplateChatParams, requestOptions?: RequestOptions | undefined);
31
+ /**
32
+ * Format the internal state to the body payload for `templateGenerateContent`.
33
+ * @internal
34
+ */
35
+ _formatRequest(incomingContent: Content, tempHistory: Content[]): TemplateRequestInternal;
36
+ /**
37
+ * Calls the specific templateGenerateContent() function needed for
38
+ * this specialized TemplateChatSession.
39
+ * @internal
40
+ */
41
+ _callGenerateContent(formattedRequest: TemplateRequestInternal, singleRequestOptions?: RequestOptions): Promise<GenerateContentResult>;
42
+ /**
43
+ * Calls the specific templateGenerateContentStream() function needed for
44
+ * this specialized TemplateChatSession.
45
+ * @internal
46
+ */
47
+ _callGenerateContentStream(formattedRequest: TemplateRequestInternal, singleRequestOptions?: RequestOptions): Promise<GenerateContentStreamResult>;
48
+ /**
49
+ * Sends a chat message and receives a non-streaming
50
+ * {@link GenerateContentResult}
51
+ */
52
+ sendMessage(request: string | Array<string | Part>, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentResult>;
53
+ /**
54
+ * Sends a chat message and receives the response as a
55
+ * {@link GenerateContentStreamResult} containing an iterable stream
56
+ * and a response promise.
57
+ */
58
+ sendMessageStream(request: string | Array<string | Part>, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentStreamResult>;
59
+ }
@@ -54,3 +54,8 @@ export declare class GenerativeModel extends AIModel {
54
54
  */
55
55
  countTokens(request: CountTokensRequest | string | Array<string | Part>, singleRequestOptions?: SingleRequestOptions): Promise<CountTokensResponse>;
56
56
  }
57
+ /**
58
+ * Client-side validation of some common `GenerationConfig` pitfalls, in order
59
+ * to save the developer a wasted request.
60
+ */
61
+ export declare function validateGenerationConfig(generationConfig: GenerationConfig): void;
@@ -37,6 +37,11 @@ import { AIModel } from './ai-model';
37
37
  * }
38
38
  * ```
39
39
  *
40
+ * @deprecated All Imagen models are deprecated and will shut down as
41
+ * early as June 2026. As a replacement, you can
42
+ * {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
43
+ * migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
44
+ *
40
45
  * @public
41
46
  */
42
47
  export declare class ImagenModel extends AIModel {
@@ -15,8 +15,9 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { GenerateContentResult, RequestOptions } from '../types';
18
- import { AI, GenerateContentStreamResult, SingleRequestOptions } from '../public-types';
18
+ import { AI, GenerateContentStreamResult, SingleRequestOptions, StartTemplateChatParams } from '../public-types';
19
19
  import { ApiSettings } from '../types/internal';
20
+ import { TemplateChatSession } from '../methods/template-chat-session';
20
21
  /**
21
22
  * {@link GenerativeModel} APIs that execute on a server-side template.
22
23
  *
@@ -47,7 +48,7 @@ export declare class TemplateGenerativeModel {
47
48
  *
48
49
  * @beta
49
50
  */
50
- generateContent(templateId: string, templateVariables: object, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentResult>;
51
+ generateContent(templateId: string, templateVariables: Record<string, unknown>, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentResult>;
51
52
  /**
52
53
  * Makes a single streaming call to the model and returns an object
53
54
  * containing an iterable stream that iterates over all chunks in the
@@ -60,5 +61,15 @@ export declare class TemplateGenerativeModel {
60
61
  *
61
62
  * @beta
62
63
  */
63
- generateContentStream(templateId: string, templateVariables: object, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentStreamResult>;
64
+ generateContentStream(templateId: string, templateVariables: Record<string, unknown>, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentStreamResult>;
65
+ /**
66
+ * Starts a {@link TemplateChatSession} that will use this template to
67
+ * respond to messages.
68
+ *
69
+ * @param params - Configurations for the chat, including the template
70
+ * ID and input variables.
71
+ *
72
+ * @beta
73
+ */
74
+ startChat(params: StartTemplateChatParams): TemplateChatSession;
64
75
  }
@@ -22,7 +22,10 @@ import { ApiSettings } from '../types/internal';
22
22
  *
23
23
  * This class should only be instantiated with {@link getTemplateImagenModel}.
24
24
  *
25
- * @beta
25
+ * @deprecated All Imagen models are deprecated and will shut down as
26
+ * early as June 2026. As a replacement, you can
27
+ * {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
28
+ * migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
26
29
  */
27
30
  export declare class TemplateImagenModel {
28
31
  /**
@@ -29,6 +29,11 @@
29
29
  * }
30
30
  * ```
31
31
  *
32
+ * @deprecated All Imagen models are deprecated and will shut down as
33
+ * early as June 2026. As a replacement, you can
34
+ * {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
35
+ * migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
36
+ *
32
37
  * @public
33
38
  */
34
39
  export declare class ImagenImageFormat {
@@ -18,6 +18,11 @@ import { ImagenImageFormat } from '../../requests/imagen-image-format';
18
18
  /**
19
19
  * Parameters for configuring an {@link ImagenModel}.
20
20
  *
21
+ * @deprecated All Imagen models are deprecated and will shut down as
22
+ * early as June 2026. As a replacement, you can
23
+ * {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
24
+ * migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
25
+ *
21
26
  * @public
22
27
  */
23
28
  export interface ImagenModelParams {
@@ -46,6 +51,11 @@ export interface ImagenModelParams {
46
51
  * See the {@link http://firebase.google.com/docs/vertex-ai/generate-images-imagen | documentation} for
47
52
  * more details.
48
53
  *
54
+ * @deprecated All Imagen models are deprecated and will shut down as
55
+ * early as June 2026. As a replacement, you can
56
+ * {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
57
+ * migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
58
+ *
49
59
  * @public
50
60
  */
51
61
  export interface ImagenGenerationConfig {
@@ -104,6 +114,11 @@ export interface ImagenGenerationConfig {
104
114
  * and the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters | Responsible AI and usage guidelines}
105
115
  * for more details.
106
116
  *
117
+ * @deprecated All Imagen models are deprecated and will shut down as
118
+ * early as June 2026. As a replacement, you can
119
+ * {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
120
+ * migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
121
+ *
107
122
  * @public
108
123
  */
109
124
  export declare const ImagenSafetyFilterLevel: {
@@ -137,6 +152,11 @@ export declare const ImagenSafetyFilterLevel: {
137
152
  * and the {@link https://cloud.google.com/vertex-ai/generative-ai/docs/image/responsible-ai-imagen#safety-filters | Responsible AI and usage guidelines}
138
153
  * for more details.
139
154
  *
155
+ * @deprecated All Imagen models are deprecated and will shut down as
156
+ * early as June 2026. As a replacement, you can
157
+ * {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
158
+ * migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
159
+ *
140
160
  * @public
141
161
  */
142
162
  export type ImagenSafetyFilterLevel = (typeof ImagenSafetyFilterLevel)[keyof typeof ImagenSafetyFilterLevel];
@@ -146,6 +166,11 @@ export type ImagenSafetyFilterLevel = (typeof ImagenSafetyFilterLevel)[keyof typ
146
166
  * See the <a href="http://firebase.google.com/docs/vertex-ai/generate-images">personGeneration</a>
147
167
  * documentation for more details.
148
168
  *
169
+ * @deprecated All Imagen models are deprecated and will shut down as
170
+ * early as June 2026. As a replacement, you can
171
+ * {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
172
+ * migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
173
+ *
149
174
  * @public
150
175
  */
151
176
  export declare const ImagenPersonFilterLevel: {
@@ -176,6 +201,11 @@ export declare const ImagenPersonFilterLevel: {
176
201
  * See the <a href="http://firebase.google.com/docs/vertex-ai/generate-images">personGeneration</a>
177
202
  * documentation for more details.
178
203
  *
204
+ * @deprecated All Imagen models are deprecated and will shut down as
205
+ * early as June 2026. As a replacement, you can
206
+ * {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
207
+ * migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
208
+ *
179
209
  * @public
180
210
  */
181
211
  export type ImagenPersonFilterLevel = (typeof ImagenPersonFilterLevel)[keyof typeof ImagenPersonFilterLevel];
@@ -185,6 +215,11 @@ export type ImagenPersonFilterLevel = (typeof ImagenPersonFilterLevel)[keyof typ
185
215
  * See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation }
186
216
  * for more details.
187
217
  *
218
+ * @deprecated All Imagen models are deprecated and will shut down as
219
+ * early as June 2026. As a replacement, you can
220
+ * {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
221
+ * migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
222
+ *
188
223
  * @public
189
224
  */
190
225
  export interface ImagenSafetySettings {
@@ -207,6 +242,11 @@ export interface ImagenSafetySettings {
207
242
  * See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation }
208
243
  * for more details and examples of the supported aspect ratios.
209
244
  *
245
+ * @deprecated All Imagen models are deprecated and will shut down as
246
+ * early as June 2026. As a replacement, you can
247
+ * {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
248
+ * migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
249
+ *
210
250
  * @public
211
251
  */
212
252
  export declare const ImagenAspectRatio: {
@@ -240,6 +280,11 @@ export declare const ImagenAspectRatio: {
240
280
  * See the {@link http://firebase.google.com/docs/vertex-ai/generate-images | documentation }
241
281
  * for more details and examples of the supported aspect ratios.
242
282
  *
283
+ * @deprecated All Imagen models are deprecated and will shut down as
284
+ * early as June 2026. As a replacement, you can
285
+ * {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
286
+ * migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
287
+ *
243
288
  * @public
244
289
  */
245
290
  export type ImagenAspectRatio = (typeof ImagenAspectRatio)[keyof typeof ImagenAspectRatio];
@@ -17,6 +17,11 @@
17
17
  /**
18
18
  * An image generated by Imagen, represented as inline data.
19
19
  *
20
+ * @deprecated All Imagen models are deprecated and will shut down as
21
+ * early as June 2026. As a replacement, you can
22
+ * {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
23
+ * migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
24
+ *
20
25
  * @public
21
26
  */
22
27
  export interface ImagenInlineImage {
@@ -35,6 +40,12 @@ export interface ImagenInlineImage {
35
40
  * An image generated by Imagen, stored in a Cloud Storage for Firebase bucket.
36
41
  *
37
42
  * This feature is not available yet.
43
+ *
44
+ * @deprecated All Imagen models are deprecated and will shut down as
45
+ * early as June 2026. As a replacement, you can
46
+ * {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
47
+ * migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
48
+ *
38
49
  * @public
39
50
  */
40
51
  export interface ImagenGCSImage {
@@ -54,6 +65,11 @@ export interface ImagenGCSImage {
54
65
  /**
55
66
  * The response from a request to generate images with Imagen.
56
67
  *
68
+ * @deprecated All Imagen models are deprecated and will shut down as
69
+ * early as June 2026. As a replacement, you can
70
+ * {@link https://firebase.google.com/docs/ai-logic/imagen-models-migration |
71
+ * migrate your apps to use Gemini Image models (the "Nano Banana" models)}.
72
+ *
57
73
  * @public
58
74
  */
59
75
  export interface ImagenGenerationResponse<T extends ImagenInlineImage | ImagenGCSImage> {
@@ -43,7 +43,13 @@ export declare enum Availability {
43
43
  * @beta
44
44
  */
45
45
  export interface LanguageModelCreateCoreOptions {
46
+ /**
47
+ * @deprecated
48
+ */
46
49
  topK?: number;
50
+ /**
51
+ * @deprecated
52
+ */
47
53
  temperature?: number;
48
54
  expectedInputs?: LanguageModelExpected[];
49
55
  }
@@ -58,6 +58,24 @@ export interface GenerateContentRequest extends BaseParams {
58
58
  toolConfig?: ToolConfig;
59
59
  systemInstruction?: string | Part | Content;
60
60
  }
61
+ /**
62
+ * Request sent through {@link TemplateGenerativeModel.generateContent}
63
+ * @beta
64
+ */
65
+ export interface TemplateGenerateContentRequest {
66
+ inputs?: Record<string, unknown>;
67
+ history?: Content[];
68
+ tools?: TemplateFunctionDeclarationsTool[];
69
+ toolConfig?: ToolConfig;
70
+ [key: string]: unknown;
71
+ }
72
+ /**
73
+ * Internal version of the template generate content request.
74
+ * @internal
75
+ */
76
+ export interface TemplateRequestInternal extends Omit<TemplateGenerateContentRequest, 'tools'> {
77
+ tools?: TemplateFunctionDeclarationsToolInternal[];
78
+ }
61
79
  /**
62
80
  * Safety setting that can be sent as part of request parameters.
63
81
  * @public
@@ -206,6 +224,21 @@ export interface StartChatParams extends BaseParams {
206
224
  toolConfig?: ToolConfig;
207
225
  systemInstruction?: string | Part | Content;
208
226
  }
227
+ /**
228
+ * Params for {@link TemplateGenerativeModel.startChat}.
229
+ * @beta
230
+ */
231
+ export interface StartTemplateChatParams extends Omit<StartChatParams, 'tools'> {
232
+ /**
233
+ * The ID of the server-side template to execute.
234
+ */
235
+ templateId: string;
236
+ /**
237
+ * A key-value map of variables to populate the template with.
238
+ */
239
+ templateVariables?: Record<string, unknown>;
240
+ tools?: TemplateTool[];
241
+ }
209
242
  /**
210
243
  * Params for calling {@link GenerativeModel.countTokens}
211
244
  * @public
@@ -249,7 +282,7 @@ export interface RequestOptions {
249
282
  * When it reaches this limit, it will return the last response received
250
283
  * from the model, whether it is a text response or further function calls.
251
284
  */
252
- maxSequentalFunctionCalls?: number;
285
+ maxSequentialFunctionCalls?: number;
253
286
  }
254
287
  /**
255
288
  * Options that can be provided per-request.
@@ -412,6 +445,72 @@ export interface FunctionDeclarationsTool {
412
445
  */
413
446
  functionDeclarations?: FunctionDeclaration[];
414
447
  }
448
+ /**
449
+ * Structured representation of a template function declaration.
450
+ * Included in this declaration are the function name and parameters. This
451
+ * `TemplateFunctionDeclaration` is a representation of a block of code that can be used
452
+ * as a Tool by the model and executed by the client.
453
+ * Note: Template function declarations do not support description fields.
454
+ * @beta
455
+ */
456
+ export interface TemplateFunctionDeclaration {
457
+ /**
458
+ * The name of the function to call. Must start with a letter or an
459
+ * underscore. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with
460
+ * a max length of 64.
461
+ */
462
+ name: string;
463
+ /**
464
+ * Description is intentionally unsupported for template function declarations.
465
+ */
466
+ description?: never;
467
+ /**
468
+ * Optional. Describes the parameters to this function in JSON Schema Object
469
+ * format. Reflects the Open API 3.03 Parameter Object. Parameter names are
470
+ * case-sensitive. For a function with no parameters, this can be left unset.
471
+ */
472
+ parameters?: ObjectSchema | ObjectSchemaRequest;
473
+ /**
474
+ * Reference to an actual function to call. Specifying this will cause the
475
+ * function to be called automatically when requested by the model.
476
+ */
477
+ functionReference?: Function;
478
+ }
479
+ /**
480
+ * @internal
481
+ */
482
+ export interface TemplateFunctionDeclarationInternal extends Omit<TemplateFunctionDeclaration, 'parameters'> {
483
+ inputSchema?: ObjectSchema | ObjectSchemaRequest;
484
+ }
485
+ /**
486
+ * A piece of code that enables the system to interact with external systems.
487
+ * @beta
488
+ */
489
+ export interface TemplateFunctionDeclarationsTool {
490
+ /**
491
+ * Optional. One or more function declarations
492
+ * to be passed to the server-side template execution.
493
+ */
494
+ functionDeclarations?: TemplateFunctionDeclaration[];
495
+ }
496
+ /**
497
+ * The modified interface for the tool that is sent to the backend.
498
+ * @internal
499
+ */
500
+ export interface TemplateFunctionDeclarationsToolInternal {
501
+ /**
502
+ * Optional. One or more function declarations
503
+ * to be passed to the server-side template execution.
504
+ */
505
+ templateFunctions?: TemplateFunctionDeclarationInternal[];
506
+ }
507
+ /**
508
+ * Defines a tool that a {@link TemplateGenerativeModel} can call
509
+ * to access external knowledge.
510
+ * Only function declarations are currently supported for templates.
511
+ * @beta
512
+ */
513
+ export type TemplateTool = TemplateFunctionDeclarationsTool;
415
514
  /**
416
515
  * Tool config. This config is shared for all tools provided in the request.
417
516
  * @public