# TemplateChat


```
@PublicPreviewAPI
class TemplateChat
```

<br />

*** ** * ** ***

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

## Summary

| ### Public functions |
|---|---|
| `suspend https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/type/GenerateContentResponse` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/TemplateChat#sendMessage(com.google.firebase.ai.type.Content)(prompt: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/type/Content)` Sends a message using the provided `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/TemplateChat#sendMessage(com.google.firebase.ai.type.Content)`; automatically providing the existing `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/TemplateChat#history()` as context. |
| `suspend https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/type/GenerateContentResponse` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/TemplateChat#sendMessage(kotlin.String)(prompt: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Sends a message using the provided text `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/TemplateChat#sendMessage(kotlin.String)`; automatically providing the existing `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/TemplateChat#history()` as context. |
| `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/type/GenerateContentResponse>` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/TemplateChat#sendMessageStream(com.google.firebase.ai.type.Content)(prompt: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/type/Content)` Sends a message using the provided `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/TemplateChat#sendMessageStream(com.google.firebase.ai.type.Content)`; automatically providing the existing `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/TemplateChat#history()` as context. |
| `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/type/GenerateContentResponse>` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/TemplateChat#sendMessageStream(kotlin.String)(prompt: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Sends a message using the provided text `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/TemplateChat#sendMessageStream(kotlin.String)`; automatically providing the existing `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/TemplateChat#history()` as context. |

| ### Public properties |
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-list/index.html<https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/type/Content>` | `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/TemplateChat#history()` |

## Public functions

### sendMessage

```
suspend fun sendMessage(prompt: Content): GenerateContentResponse
```

Sends a message using the provided `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/TemplateChat#sendMessage(com.google.firebase.ai.type.Content)`; automatically providing the existing `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/TemplateChat#history()` as context.

| Parameters |
|---|---|
| `prompt: https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/type/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 `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/TemplateChat#sendMessage(kotlin.String)`; automatically providing the existing `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/TemplateChat#history()` as context.

### sendMessageStream

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

Sends a message using the provided `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/TemplateChat#sendMessageStream(com.google.firebase.ai.type.Content)`; automatically providing the existing `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/TemplateChat#history()` as context. Returns a flow.

### sendMessageStream

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

Sends a message using the provided text `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/TemplateChat#sendMessageStream(kotlin.String)`; automatically providing the existing `https://firebase.google.com/docs/reference/kotlin/com/google/firebase/ai/TemplateChat#history()` as context. Returns a flow.

## Public properties

### history

```
val history: MutableList<Content>
```