# Candidate


```
public final class Candidate
```

<br />

*** ** * ** ***

A piece of a response from the model. Contains the `https://developers.google.com/android/reference/com/google/mlkit/genai/prompt/Candidate.FinishReason`, the response text, and any predicted function calls.

## Summary

| ### Nested types |
|---|
| `@https://developer.android.com/reference/androidx/annotation/IntDef.html(value = [0, 1, -100]) public annotation https://developers.google.com/android/reference/com/google/mlkit/genai/prompt/Candidate.FinishReason` The reason why this `https://developers.google.com/android/reference/com/google/mlkit/genai/prompt/Candidate` is returned. |

| ### Public methods |
|---|---|
| `final https://developer.android.com/reference/java/lang/Integer.html` | `https://developers.google.com/android/reference/com/google/mlkit/genai/prompt/Candidate#getFinishReason()()` The reason why this `https://developers.google.com/android/reference/com/google/mlkit/genai/prompt/Candidate` is finished generating. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull.html https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull.html https://developers.google.com/android/reference/com/google/mlkit/genai/common/FunctionCall>` | `https://developers.google.com/android/reference/com/google/mlkit/genai/prompt/Candidate#getFunctionCalls()()` The list of function calls predicted by the model. |
| `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/Candidate#getText()()` The text string of the `https://developers.google.com/android/reference/com/google/mlkit/genai/prompt/Candidate`. |

## Public methods

### getFinishReason

```
public final Integer getFinishReason()
```

The reason why this `https://developers.google.com/android/reference/com/google/mlkit/genai/prompt/Candidate` is finished generating. This will be null for intermediate responses during streaming, and non-null for the final response in streaming or non-streaming mode.

### getFunctionCalls

```
public final @NonNull List<@NonNull FunctionCall> getFunctionCalls()
```

The list of function calls predicted by the model.

### getText

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

The text string of the `https://developers.google.com/android/reference/com/google/mlkit/genai/prompt/Candidate`. May be null if the model only returned function calls.