ChatFutures

public abstract classChatFutures


This class is deprecated.
The Vertex AI in Firebase SDK (firebase-vertexai) has been replaced with the FirebaseAI SDK (firebase-ai) to accommodate the evolving set of supported features and services.For migration details, see the migration guide: https://firebase.google.com/docs/vertex-ai/migrate-to-latest-sdk

Wrapper class providing Java compatible methods forChat.

See also
Chat

Summary

Nested types

public static classChatFutures.Companion

Public methods

static final @NonNullChatFutures
abstract @NonNullChat

Returns theChat object wrapped by this object.

abstract @NonNullListenableFuture<@NonNullGenerateContentResponse>

Sends a message using the existing history of this chat as context and the providedContent prompt.

abstract @NonNullPublisher<@NonNullGenerateContentResponse>

Sends a message using the existing history of this chat as context and the providedContent prompt.

Public methods

from

public static final @NonNullChatFutures from(@NonNullChat chat)
Returns
@NonNullChatFutures

aChatFutures created around the providedChat

getChat

public abstract @NonNullChat getChat()

Returns theChat object wrapped by this object.

sendMessage

public abstract @NonNullListenableFuture<@NonNullGenerateContentResponsesendMessage(@NonNullContent prompt)

Sends a message using the existing history of this chat as context and the providedContent prompt.

If successful, the message and response will be added to the history. If unsuccessful, history will remain unchanged.

Parameters
@NonNullContent prompt

The input(s) that, together with the history, will be given to the model as the prompt.

Throws
com.google.firebase.vertexai.type.InvalidStateException com.google.firebase.vertexai.type.InvalidStateException

ifprompt is not coming from the 'user' role

com.google.firebase.vertexai.type.InvalidStateException com.google.firebase.vertexai.type.InvalidStateException

if theChat instance has an active request

sendMessageStream

public abstract @NonNullPublisher<@NonNullGenerateContentResponsesendMessageStream(@NonNullContent prompt)

Sends a message using the existing history of this chat as context and the providedContent prompt.

The response from the model is returned as a stream.

If successful, the message and response will be added to the history. If unsuccessful, history will remain unchanged.

Parameters
@NonNullContent prompt

The input(s) that, together with the history, will be given to the model as the prompt.

Throws
com.google.firebase.vertexai.type.InvalidStateException com.google.firebase.vertexai.type.InvalidStateException

ifprompt is not coming from the 'user' role

com.google.firebase.vertexai.type.InvalidStateException com.google.firebase.vertexai.type.InvalidStateException

if theChat instance has an active request

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-07-21 UTC.