Async Chat
An async chat session with a generative model.
This class provides a way to interact with a generative model in an async multi-turn chat session. It keeps track of the chat history and uses it to provide context for subsequent messages.
Functions
Link copied to clipboard
Returns the chat history.
Link copied to clipboard
public CompletableFuture<GenerateContentResponse> sendMessage(Content content, GenerateContentConfig config)
public CompletableFuture<GenerateContentResponse> sendMessage(String text, GenerateContentConfig config)
public CompletableFuture<GenerateContentResponse> sendMessage(List<Content> contents, GenerateContentConfig config)
Asynchronously sends a message to the model in the current multi-turn chat session and returns the model's response.
Link copied to clipboard
public CompletableFuture<ResponseStream<GenerateContentResponse>> sendMessageStream(Content content)
public CompletableFuture<ResponseStream<GenerateContentResponse>> sendMessageStream(Content content, GenerateContentConfig config)
public CompletableFuture<ResponseStream<GenerateContentResponse>> sendMessageStream(String text, GenerateContentConfig config)
public CompletableFuture<ResponseStream<GenerateContentResponse>> sendMessageStream(List<Content> contents, GenerateContentConfig config)
Asynchronously sends a message to the model in the current multi-turn chat session and returns a stream of responses.
public CompletableFuture<ResponseStream<GenerateContentResponse>> sendMessageStream(List<Content> contents)
Sends a message to the model in the current multi-turn chat session and returns the model's response.