# QueryUnderstandingSpec

- [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/QueryUnderstandingSpec#SCHEMA_REPRESENTATION)
- [QueryClassificationSpec](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/QueryUnderstandingSpec#QueryClassificationSpec)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/QueryUnderstandingSpec#QueryClassificationSpec.SCHEMA_REPRESENTATION)
- [Type](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/QueryUnderstandingSpec#Type)
- [QueryRephraserSpec](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/QueryUnderstandingSpec#QueryRephraserSpec)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/QueryUnderstandingSpec#QueryRephraserSpec.SCHEMA_REPRESENTATION)
- [ModelSpec](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/QueryUnderstandingSpec#ModelSpec)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/QueryUnderstandingSpec#ModelSpec.SCHEMA_REPRESENTATION)
- [ModelType](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/QueryUnderstandingSpec#ModelType)

Query understanding specification.

| JSON representation |
|---|
| ``` { "queryClassificationSpec": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/QueryUnderstandingSpec#QueryClassificationSpec`) }, "queryRephraserSpec": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/QueryUnderstandingSpec#QueryRephraserSpec`) }, "disableSpellCorrection": boolean } ``` |

| Fields ||
|---|---|
| `queryClassificationSpec` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/QueryUnderstandingSpec#QueryClassificationSpec`)`` Query classification specification. |
| `queryRephraserSpec` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/QueryUnderstandingSpec#QueryRephraserSpec`)`` Query rephraser specification. |
| `disableSpellCorrection` | `boolean` Optional. Whether to disable spell correction. The default value is `false`. |

## QueryClassificationSpec

Query classification specification.

| JSON representation |
|---|
| ``` { "types": [ enum (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/QueryUnderstandingSpec#Type`) ] } ``` |

| Fields ||
|---|---|
| `types[]` | ``enum (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/QueryUnderstandingSpec#Type`)`` Enabled query classification types. |

## Type

Query classification types.

| Enums ||
|---|---|
| `TYPE_UNSPECIFIED` | Unspecified query classification type. |
| `ADVERSARIAL_QUERY` | Adversarial query classification type. |
| `NON_ANSWER_SEEKING_QUERY` | Non-answer-seeking query classification type, for chit chat. |
| `JAIL_BREAKING_QUERY` | Jail-breaking query classification type. |
| `NON_ANSWER_SEEKING_QUERY_V2` | Non-answer-seeking query classification type, for no clear intent. |
| `USER_DEFINED_CLASSIFICATION_QUERY` | User defined query classification type. |

## QueryRephraserSpec

Query rephraser specification.

| JSON representation |
|---|
| ``` { "disable": boolean, "maxRephraseSteps": integer, "modelSpec": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/QueryUnderstandingSpec#ModelSpec`) } } ``` |

| Fields ||
|---|---|
| `disable` | `boolean` Disable query rephraser. |
| `maxRephraseSteps` | `integer` Max rephrase steps. The max number is 5 steps. If not set or set to \< 1, it will be set to 1 by default. |
| `modelSpec` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/QueryUnderstandingSpec#ModelSpec`)`` Optional. Query Rephraser Model specification. |

## ModelSpec

Query Rephraser Model specification.

| JSON representation |
|---|
| ``` { "modelType": enum (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/QueryUnderstandingSpec#ModelType`) } ``` |

| Fields ||
|---|---|
| `modelType` | ``enum (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/QueryUnderstandingSpec#ModelType`)`` Optional. Enabled query rephraser model type. If not set, it will use LARGE by default. |

## ModelType

Query rephraser types. Currently only supports single-hop (maxRephraseSteps = 1) model selections. For multi-hop (maxRephraseSteps \> 1), there is only one default model.

| Enums ||
|---|---|
| `MODEL_TYPE_UNSPECIFIED` | Unspecified model type. |
| `SMALL` | Small query rephraser model. Gemini 1.0 XS model. |
| `LARGE` | Large query rephraser model. Gemini 1.0 Pro model. |