Project: /docs/reference/js/_project.yaml Book: /docs/reference/_book.yaml page_type: reference
{% comment %} DO NOT EDIT THIS FILE! This is generated by the JS SDK team, and any local changes will be overwritten. Changes should be made in the source code at https://github.com/firebase/firebase-js-sdk {% endcomment %}
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
GenerativeModel APIs that execute on a server-side template.
This class should only be instantiated with getTemplateGenerativeModel().
Signature:
export declare class TemplateGenerativeModel | Constructor | Modifiers | Description |
|---|---|---|
| (constructor)(ai, requestOptions) | (Public Preview) Constructs a new instance of the TemplateGenerativeModel class |
| Property | Modifiers | Type | Description |
|---|---|---|---|
| requestOptions | RequestOptions | (Public Preview) Additional options to use when making requests. |
| Method | Modifiers | Description |
|---|---|---|
| generateContent(templateId, templateVariables, singleRequestOptions) | (Public Preview) Makes a single non-streaming call to the model and returns an object containing a single GenerateContentResponse. | |
| generateContentStream(templateId, templateVariables, singleRequestOptions) | (Public Preview) Makes a single streaming call to the model and returns an object containing an iterable stream that iterates over all chunks in the streaming response as well as a promise that returns the final aggregated response. |
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Constructs a new instance of the TemplateGenerativeModel class
Signature:
constructor(ai: AI, requestOptions?: RequestOptions);| Parameter | Type | Description |
|---|---|---|
| ai | AI | |
| requestOptions | RequestOptions |
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Additional options to use when making requests.
Signature:
requestOptions?: RequestOptions;This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Makes a single non-streaming call to the model and returns an object containing a single GenerateContentResponse.
Signature:
generateContent(templateId: string, templateVariables: object, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentResult>;| Parameter | Type | Description |
|---|---|---|
| templateId | string | The ID of the server-side template to execute. |
| templateVariables | object | A key-value map of variables to populate the template with. |
| singleRequestOptions | SingleRequestOptions |
Returns:
Promise<GenerateContentResult>
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
Makes a single streaming call to the model and returns an object containing an iterable stream that iterates over all chunks in the streaming response as well as a promise that returns the final aggregated response.
Signature:
generateContentStream(templateId: string, templateVariables: object, singleRequestOptions?: SingleRequestOptions): Promise<GenerateContentStreamResult>;| Parameter | Type | Description |
|---|---|---|
| templateId | string | The ID of the server-side template to execute. |
| templateVariables | object | A key-value map of variables to populate the template with. |
| singleRequestOptions | SingleRequestOptions |
Returns:
Promise<GenerateContentStreamResult>