# CreateCachedContextRequest

# CreateCachedContextRequest


```
public final class CreateCachedContextRequest
```

<br />

*** ** * ** ***

A request to create a cached context.

## Summary

| ### Nested types |
|---|
| `public final class https://developers.google.com/android/reference/com/google/mlkit/genai/prompt/CreateCachedContextRequest.Builder` Builder for `https://developers.google.com/android/reference/com/google/mlkit/genai/prompt/CreateCachedContextRequest`. |

| ### Public methods |
|---|---|
| `final @https://developer.android.com/reference/androidx/annotation/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developers.google.com/android/reference/com/google/mlkit/genai/prompt/CreateCachedContextRequest#getName()()` the unique name for the cached context. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull.html https://developers.google.com/android/reference/com/google/mlkit/genai/prompt/PromptPrefix` | `https://developers.google.com/android/reference/com/google/mlkit/genai/prompt/CreateCachedContextRequest#getPromptPrefix()()` the prefix of the prompt. |

## Public methods

### getName

```
public final @NonNull String getName()
```

the unique name for the cached context. Required.

### getPromptPrefix

```
public final @NonNull PromptPrefix getPromptPrefix()
```

the prefix of the prompt. This can be used to provide a prefix shared across multiple generation requests.