Returns the chat history.
whether to return the curated history or the comprehensive history.
History contents alternating between user and model for the entire chat session.
The history is a list of contents alternating between user and model.
There are two types of history:
curated history
contains only the valid turns between user and
model, which will be included in the subsequent requests sent to the model.comprehensive history
contains all turns, including invalid or
empty model outputs, providing a complete record of the history.The history is updated after receiving the response from the model, for streaming response, it means receiving the last chunk of the response.
The comprehensive history
is returned by default. To get the curated history
, set the curated
parameter to true
.
Sends a message to the model and returns the response.
parameters for sending messages within a chat session.
The model's response.
This method will wait for the previous message to be processed before sending the next message.
Chat#sendMessageStream for streaming method.
Sends a message to the model and returns the response in chunks.
parameters for sending the message.
The model's response.
This method will wait for the previous message to be processed before sending the next message.
Chat#sendMessage for non-streaming method.
Chat session that enables sending messages to the model with previous conversation context.
Remarks
The session maintains all the turns between user and model.