Chat
A chat session with a generative model.
This class provides a way to interact with a generative model in a multi-turn chat session. It keeps track of the chat history and uses it to provide context for subsequent messages.
Note: this class is NOT thread-safe.
Functions
Link copied to clipboard
Returns the chat history.
Link copied to clipboard
Sends a message to the model in the current multi-turn chat session and returns the model's response.
Link copied to clipboard
public ResponseStream<GenerateContentResponse> sendMessageStream(Content content, GenerateContentConfig config)
public ResponseStream<GenerateContentResponse> sendMessageStream(String text, GenerateContentConfig config)
public ResponseStream<GenerateContentResponse> sendMessageStream(List<Content> contents, GenerateContentConfig config)
Sends a message to the model in the current multi-turn chat session and returns a stream of responses.
Sends a message to the model in the current multi-turn chat session and returns the model's response.