TemplateGenerativeModelFutures

abstract class TemplateGenerativeModelFutures


Wrapper class providing Java compatible methods for TemplateGenerativeModel.

Summary

Public companion functions

TemplateGenerativeModelFutures

Public functions

abstract ListenableFuture<GenerateContentResponse>
generateContent(templateId: String, inputs: Map<StringAny>)

Generates new content using the given templateId with the given inputs.

abstract Publisher<GenerateContentResponse>
generateContentStream(templateId: String, inputs: Map<StringAny>)

Generates new content as a stream using the given templateId with the given inputs.

abstract TemplateGenerativeModel

Returns the TemplateGenerativeModel object wrapped by this object.

Public functions

generateContent

abstract fun generateContent(templateId: String, inputs: Map<StringAny>): ListenableFuture<GenerateContentResponse>

Generates new content using the given templateId with the given inputs.

Parameters
templateId: String

The ID of server prompt template.

inputs: Map<StringAny>

the inputs needed to fill in the prompt

Returns
ListenableFuture<GenerateContentResponse>

The content generated by the model.

Throws
com.google.firebase.ai.type.FirebaseAIException: com.google.firebase.ai.type.FirebaseAIException

if the request failed.

See also
FirebaseAIException

for types of errors.

generateContentStream

abstract fun generateContentStream(templateId: String, inputs: Map<StringAny>): Publisher<GenerateContentResponse>

Generates new content as a stream using the given templateId with the given inputs.

Parameters
templateId: String

The ID of server prompt template.

inputs: Map<StringAny>

the inputs needed to fill in the prompt

Returns
Publisher<GenerateContentResponse>

A Publisher which will emit responses as they are returned by the model.

Throws
com.google.firebase.ai.type.FirebaseAIException: com.google.firebase.ai.type.FirebaseAIException

if the request failed.

See also
FirebaseAIException

for types of errors.

getGenerativeModel

abstract fun getGenerativeModel(): TemplateGenerativeModel

Returns the TemplateGenerativeModel object wrapped by this object.