Package com.google.genai
Class AsyncChats
java.lang.Object
com.google.genai.AsyncChats
A class for creating async chat sessions.
-
Method Summary
Modifier and TypeMethodDescriptionCreates a new async chat session.create(String model, GenerateContentConfig config) Creates a new async chat session.create(String model, GenerateContentConfig config, List<Content> history) Creates a new async chat session that starts with the given history.
-
Method Details
-
create
Creates a new async chat session that starts with the given history.The history is sent to the model with every message, as if the turns in it had already taken place in this session. Every turn must have the role
userormodel. Amodelturn with invalid content is not sent, and neither is theuserturn before it.- Parameters:
model- The model to use for the async chat session.config- The configuration for the async chat session, or null.history- The turns to start the session with.- Returns:
- The async chat session.
- Throws:
IllegalArgumentException- if a turn has no role, or a role other thanuserormodel.
-
create
Creates a new async chat session.- Parameters:
model- The model to use for the async chat session.config- The configuration for the async chat session.- Returns:
- The async chat session.
-
create
Creates a new async chat session.- Parameters:
model- The model to use for the async chat session.- Returns:
- The async chat session.
-