# TemplateChat


```
@PublicPreviewAPI
public final class TemplateChat
```

<br />

*** ** * ** ***

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

## Summary

| ### Public fields |
|---|---|
| `final @https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html https://developer.android.com/reference/kotlin/java/util/List.html<@https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html https://firebase.google.com/docs/reference/android/com/google/firebase/ai/type/Content>` | `https://firebase.google.com/docs/reference/android/com/google/firebase/ai/TemplateChat#history()` |

| ### Public methods |
|---|---|
| `final @https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html https://firebase.google.com/docs/reference/android/com/google/firebase/ai/type/GenerateContentResponse` | `https://firebase.google.com/docs/reference/android/com/google/firebase/ai/TemplateChat#sendMessage(com.google.firebase.ai.type.Content)(@https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html https://firebase.google.com/docs/reference/android/com/google/firebase/ai/type/Content prompt)` Sends a message using the provided `https://firebase.google.com/docs/reference/android/com/google/firebase/ai/TemplateChat#sendMessage(com.google.firebase.ai.type.Content)`; automatically providing the existing `https://firebase.google.com/docs/reference/android/com/google/firebase/ai/TemplateChat#history()` as context. |
| `final @https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html https://firebase.google.com/docs/reference/android/com/google/firebase/ai/type/GenerateContentResponse` | `https://firebase.google.com/docs/reference/android/com/google/firebase/ai/TemplateChat#sendMessage(kotlin.String)(@https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html https://developer.android.com/reference/kotlin/java/lang/String.html prompt)` Sends a message using the provided text `https://firebase.google.com/docs/reference/android/com/google/firebase/ai/TemplateChat#sendMessage(kotlin.String)`; automatically providing the existing `https://firebase.google.com/docs/reference/android/com/google/firebase/ai/TemplateChat#history()` as context. |
| `final @https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<@https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html https://firebase.google.com/docs/reference/android/com/google/firebase/ai/type/GenerateContentResponse>` | `https://firebase.google.com/docs/reference/android/com/google/firebase/ai/TemplateChat#sendMessageStream(com.google.firebase.ai.type.Content)(@https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html https://firebase.google.com/docs/reference/android/com/google/firebase/ai/type/Content prompt)` Sends a message using the provided `https://firebase.google.com/docs/reference/android/com/google/firebase/ai/TemplateChat#sendMessageStream(com.google.firebase.ai.type.Content)`; automatically providing the existing `https://firebase.google.com/docs/reference/android/com/google/firebase/ai/TemplateChat#history()` as context. |
| `final @https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<@https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html https://firebase.google.com/docs/reference/android/com/google/firebase/ai/type/GenerateContentResponse>` | `https://firebase.google.com/docs/reference/android/com/google/firebase/ai/TemplateChat#sendMessageStream(kotlin.String)(@https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html https://developer.android.com/reference/kotlin/java/lang/String.html prompt)` Sends a message using the provided text `https://firebase.google.com/docs/reference/android/com/google/firebase/ai/TemplateChat#sendMessageStream(kotlin.String)`; automatically providing the existing `https://firebase.google.com/docs/reference/android/com/google/firebase/ai/TemplateChat#history()` as context. |

## Public fields

### history

```
public final @NonNull List<@NonNull Content> history
```

## Public methods

### sendMessage

```
public final @NonNull GenerateContentResponse sendMessage(@NonNull Content prompt)
```

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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/kotlin/androidx/annotation/NonNull.html https://firebase.google.com/docs/reference/android/com/google/firebase/ai/type/Content prompt` | The input that, together with the history, will be given to the model as the prompt. |

### sendMessage

```
public final @NonNull GenerateContentResponse sendMessage(@NonNull String prompt)
```

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

### sendMessageStream

```
public final @NonNull Flow<@NonNull GenerateContentResponse> sendMessageStream(@NonNull Content prompt)
```

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

### sendMessageStream

```
public final @NonNull Flow<@NonNull GenerateContentResponse> sendMessageStream(@NonNull String prompt)
```

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