ChatFutures
public abstract class ChatFutures
Wrapper class providing Java compatible methods for Chat.
| See also | |
|---|---|
Chat |
Summary
Nested types |
|---|
public static class ChatFutures.Companion |
Public methods |
|
|---|---|
static final @NonNull ChatFutures |
|
abstract @NonNull Chat |
getChat()Returns the |
abstract @NonNull ListenableFuture<@NonNull GenerateContentResponse> |
sendMessage(@NonNull Content prompt)Sends a message using the existing history of this chat as context and the provided |
abstract @NonNull Publisher<@NonNull GenerateContentResponse> |
sendMessageStream(@NonNull Content prompt)Sends a message using the existing history of this chat as context and the provided |
Public methods
from
public static final @NonNull ChatFutures from(@NonNull Chat chat)
| Returns | |
|---|---|
@NonNull ChatFutures |
a |
sendMessage
public abstract @NonNull ListenableFuture<@NonNull GenerateContentResponse> sendMessage(@NonNull Content prompt)
Sends a message using the existing history of this chat as context and the provided Content prompt.
If successful, the message and response will be added to the history. If unsuccessful, history will remain unchanged.
| Parameters | |
|---|---|
@NonNull Content 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 |
if |
com.google.firebase.vertexai.type.InvalidStateException com.google.firebase.vertexai.type.InvalidStateException |
if the |
sendMessageStream
public abstract @NonNull Publisher<@NonNull GenerateContentResponse> sendMessageStream(@NonNull Content prompt)
Sends a message using the existing history of this chat as context and the provided Content 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 | |
|---|---|
@NonNull Content 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 |
if |
com.google.firebase.vertexai.type.InvalidStateException com.google.firebase.vertexai.type.InvalidStateException |
if the |