TemplateChat

@PublicPreviewAPI
class TemplateChat


Representation of a multi-turn interaction with a server template model.

Summary

Public functions

suspend GenerateContentResponse

Sends a message using the provided prompt; automatically providing the existing history as context.

suspend GenerateContentResponse

Sends a message using the provided text prompt; automatically providing the existing history as context.

Flow<GenerateContentResponse>

Sends a message using the provided prompt; automatically providing the existing history as context.

Flow<GenerateContentResponse>

Sends a message using the provided text prompt; automatically providing the existing history as context.

Public properties

MutableList<Content>

Public functions

sendMessage

suspend fun sendMessage(prompt: Content): GenerateContentResponse

Sends a message using the provided prompt; automatically providing the existing history as context.

Parameters
prompt: Content

The input that, together with the history, will be given to the model as the prompt.

sendMessage

suspend fun sendMessage(prompt: String): GenerateContentResponse

Sends a message using the provided text prompt; automatically providing the existing history as context.

sendMessageStream

fun sendMessageStream(prompt: Content): Flow<GenerateContentResponse>

Sends a message using the provided prompt; automatically providing the existing history as context. Returns a flow.

sendMessageStream

fun sendMessageStream(prompt: String): Flow<GenerateContentResponse>

Sends a message using the provided text prompt; automatically providing the existing history as context. Returns a flow.

Public properties

history

val historyMutableList<Content>