Firebase.AI.TemplateGenerativeModel

A type that represents a remote multimodal model (like Gemini), with the ability to generate content based on defined server prompt templates.

Summary

Public functions

GenerateContentAsync(string templateId, IDictionary< string, object > inputs, CancellationToken cancellationToken)
Generates new content by calling into a server prompt template.
GenerateContentStreamAsync(string templateId, IDictionary< string, object > inputs, CancellationToken cancellationToken)
IAsyncEnumerable< GenerateContentResponse >
Generates new content as a stream by calling into a server prompt template.

Public functions

GenerateContentAsync

Task< GenerateContentResponse > GenerateContentAsync(
  string templateId,
  IDictionary< string, object > inputs,
  CancellationToken cancellationToken
)

Generates new content by calling into a server prompt template.

Details
Parameters
templateId
The id of the server prompt template to use.
inputs
Any input parameters expected by the server prompt template.
cancellationToken
An optional token to cancel the operation.
Exceptions
HttpRequestException
Thrown when an error occurs during content generation.
Returns
The generated content response from the model.

GenerateContentStreamAsync

IAsyncEnumerable< GenerateContentResponse > GenerateContentStreamAsync(
  string templateId,
  IDictionary< string, object > inputs,
  CancellationToken cancellationToken
)

Generates new content as a stream by calling into a server prompt template.

Details
Parameters
templateId
The id of the server prompt template to use.
inputs
Any input parameters expected by the server prompt template.
cancellationToken
An optional token to cancel the operation.
Exceptions
HttpRequestException
Thrown when an error occurs during content generation.
Returns
A stream of generated content responses from the model.