TemplateGenerativeModelFutures

public abstract class TemplateGenerativeModelFutures


Wrapper class providing Java compatible methods for TemplateGenerativeModel.

Summary

Nested types

Public methods

static final @NonNull TemplateGenerativeModelFutures
abstract @NonNull ListenableFuture<@NonNull GenerateContentResponse>
generateContent(
    @NonNull String templateId,
    @NonNull Map<@NonNull String, @NonNull Object> inputs
)

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

abstract @NonNull Publisher<@NonNull GenerateContentResponse>
generateContentStream(
    @NonNull String templateId,
    @NonNull Map<@NonNull String, @NonNull Object> inputs
)

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

abstract @NonNull TemplateGenerativeModel

Returns the TemplateGenerativeModel object wrapped by this object.

Public methods

generateContent

public abstract @NonNull ListenableFuture<@NonNull GenerateContentResponsegenerateContent(
    @NonNull String templateId,
    @NonNull Map<@NonNull String, @NonNull Object> inputs
)

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

Parameters
@NonNull String templateId

The ID of server prompt template.

@NonNull Map<@NonNull String, @NonNull Object> inputs

the inputs needed to fill in the prompt

Returns
@NonNull ListenableFuture<@NonNull 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

public abstract @NonNull Publisher<@NonNull GenerateContentResponsegenerateContentStream(
    @NonNull String templateId,
    @NonNull Map<@NonNull String, @NonNull Object> inputs
)

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

Parameters
@NonNull String templateId

The ID of server prompt template.

@NonNull Map<@NonNull String, @NonNull Object> inputs

the inputs needed to fill in the prompt

Returns
@NonNull Publisher<@NonNull 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

public abstract @NonNull TemplateGenerativeModel getGenerativeModel()

Returns the TemplateGenerativeModel object wrapped by this object.