Chat
A multi-turn chat session with a generative model.
Obtain a session from Chats.create:
val chat = client.chats.create(model = "gemini-3.6-flash")A response that ends with finish reason CONTINUATION is continued automatically: the same request is sent again with the response's continuation token until the model finishes, and the turn is recorded once, with the whole answer. Set GenerateContentConfig.automaticContinuation to false to turn this off.
A session is not safe for concurrent turns: start a turn only once the previous one has finished, or the turns will not see one another. getHistory is safe to call at any time.
Functions
Returns a snapshot of the turns in this session.
Sends content as the next turn and returns the model's response.
Sends text as the next turn and returns the model's response.
Sends contents as the next turn and returns the model's response.
Sends content as the next turn and returns the model's response in chunks.
Sends text as the next turn and returns the model's response in chunks.
Sends contents as the next turn and returns the model's response in chunks.