create

fun create(model: String, config: GenerateContentConfig? = null, history: List<Content> = emptyList()): Chat

Creates a chat session.

Parameters

model

The model to talk to, for example "gemini-3.6-flash".

config

Applied to every turn in the session. A config passed to an individual send replaces this one for that turn rather than merging with it.

history

Turns to seed the session with. The turns are copied, so later changes to the list do not affect the session.

Throws

if a turn in history has a role other than "user" or "model".