# Google Cloud Discovery Engine V1 Client - Class Answer (1.11.1)

1.11.1 (latest) 1.11.0 1.10.1 1.9.1 1.8.0 1.7.0 1.6.1 1.5.1 1.4.0 1.3.3 1.2.0 1.1.0 1.0.0 0.11.3 0.8.0 0.7.1 0.6.0 0.5.0 0.4.0 0.3.0 0.2.0 0.1.1 Reference documentation and code samples for the Google Cloud Discovery Engine V1 Client class Answer.

Defines an answer.

Generated from protobuf message `google.cloud.discoveryengine.v1.Answer`

## Namespace

Google \\ Cloud \\ DiscoveryEngine \\ V1

## Methods

### __construct

Constructor.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `data` | `mixed` |

### getName

Immutable. Fully qualified name
`projects/{project}/locations/global/collections/{collection}/engines/{engine}/sessions/*/answers/*`

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setName

Immutable. Fully qualified name
`projects/{project}/locations/global/collections/{collection}/engines/{engine}/sessions/*/answers/*`

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getState

The state of the answer generation.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [State](https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.Answer.State). |

### setState

The state of the answer generation.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [State](https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.Answer.State). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAnswerText

The textual answer.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### setAnswerText

The textual answer.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getGroundingScore

A score in the range of \[0, 1\] describing how grounded the answer is by the
reference chunks.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `float` |   |

### hasGroundingScore

### clearGroundingScore

### setGroundingScore

A score in the range of \[0, 1\] describing how grounded the answer is by the
reference chunks.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `float` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCitations

Citations.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.Answer.Citation>` |   |

### setCitations

Citations.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.Answer.Citation>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getGroundingSupports

Optional. Grounding supports.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.Answer.GroundingSupport>` |   |

### setGroundingSupports

Optional. Grounding supports.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.Answer.GroundingSupport>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getReferences

References.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.Answer.Reference>` |   |

### setReferences

References.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.Answer.Reference>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getRelatedQuestions

Suggested related questions.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<string>` |   |

### setRelatedQuestions

Suggested related questions.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `string[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSteps

Answer generation steps.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.Answer.Step>` |   |

### setSteps

Answer generation steps.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.Answer.Step>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getQueryUnderstandingInfo

Query understanding information.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.Answer.QueryUnderstandingInfo|null` |   |

### hasQueryUnderstandingInfo

### clearQueryUnderstandingInfo

### setQueryUnderstandingInfo

Query understanding information.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.Answer.QueryUnderstandingInfo` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getAnswerSkippedReasons

Additional answer-skipped reasons. This provides the reason for ignored
cases. If nothing is skipped, this field is not set.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<int>` |   |

### setAnswerSkippedReasons

Additional answer-skipped reasons. This provides the reason for ignored
cases. If nothing is skipped, this field is not set.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int[]` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCreateTime

Output only. Answer creation timestamp.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasCreateTime

### clearCreateTime

### setCreateTime

Output only. Answer creation timestamp.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getCompleteTime

Output only. Answer completed timestamp.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp|null` |   |

### hasCompleteTime

### clearCompleteTime

### setCompleteTime

Output only. Answer completed timestamp.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getSafetyRatings

Optional. Safety ratings.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://protobuf.dev/reference/php/api-docs/Google/Protobuf/RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SafetyRating>` |   |

### setSafetyRatings

Optional. Safety ratings.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-discoveryengine/latest/V1.SafetyRating>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |