sendMessage

Sends text as the next turn and returns the model's response.

The turns so far are sent along with text, so the model has the conversation for context. The message and the response are added to the history once the response arrives.

Parameters

text

The text of the message to send.

config

Replaces the session config for this turn rather than merging with it.


suspend fun sendMessage(content: Content, config: GenerateContentConfig? = null): GenerateContentResponse

Sends content as the next turn and returns the model's response.

The turns so far are sent along with content, so the model has the conversation for context. The message and the response are added to the history once the response arrives.

Parameters

content

The message to send.

config

Replaces the session config for this turn rather than merging with it.


suspend fun sendMessage(contents: List<Content>, config: GenerateContentConfig? = null): GenerateContentResponse

Sends contents as the next turn and returns the model's response.

The turns so far are sent along with contents, so the model has the conversation for context. The message and the response are added to the history once the response arrives.

Parameters

contents

The message to send. Several contents are recorded as one turn.

config

Replaces the session config for this turn rather than merging with it.