- [HTTP request](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants/assist#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants/assist#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants/assist#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants/assist#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants/assist#body.response_body)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants/assist#body.AssistResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants/assist#body.aspect)
- [IAM Permissions](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants/assist#body.aspect_1)
- [AssistSkippingMode](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants/assist#AssistSkippingMode)
- [SessionInfo](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants/assist#SessionInfo)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants/assist#SessionInfo.SCHEMA_REPRESENTATION)
- [InvokedSkill](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants/assist#InvokedSkill)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants/assist#InvokedSkill.SCHEMA_REPRESENTATION)
- [ConnectorAuthError](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants/assist#ConnectorAuthError)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants/assist#ConnectorAuthError.SCHEMA_REPRESENTATION)

Assists the user with a query.

### HTTP request

Choose an endpoint:
global us   
`POST https://discoveryengine.googleapis.com/v1alpha/{name=projects/*/locations/*/collections/*/engines/*/assistants/*}:assist`

<br />

The URLs use [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `name` | `string` Required. The resource name of the `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants#Assistant`. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/assistants/{assistant}` |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "query": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/Query`) }, "session": string, "assistSkippingMode": enum (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants/assist#AssistSkippingMode`), "fileIds": [ string ], "userMetadata": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/AssistUserMetadata`) }, "languageCode": string, "webGroundingEnabled": boolean, "dataStoreSpecs": [ { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/DataStoreSpec`) } ], "assistGenerationConfig": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/AssistGenerationConfig`) }, "mapsGroundingEnabled": boolean, "googleSearchGroundingEnabled": boolean } ``` |

| Fields ||
|---|---|
| `query` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/Query`)`` Optional. Current user query. Empty query is only supported if `fileIds` are provided. In this case, the answer will be generated based on those context files. |
| `session` | `string` Optional. The session to use for the request. If specified, the assistant has access to the session history, and the query and the answer are stored there. If `-` is specified as the session ID, or it is left empty, then a new session is created with an automatically generated ID. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/sessions/{session}` |
| `assistSkippingMode` | ``enum (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants/assist#AssistSkippingMode`)`` Optional. Determines the cases in which the assistant will not answer the query. If the answer is skipped, the reasons will be listed in `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.sessions.assistAnswers#AssistAnswer.FIELDS.assist_skipped_reasons` within `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants/assist#body.AssistResponse.FIELDS.answer`. |
| `fileIds[]` | `string` Optional. The IDs of the files to be used for answering the request. When uploading a file, its ID is returned in `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.sessions/addContextFile#body.AddContextFileResponse.FIELDS.file_id`. |
| `userMetadata` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/AssistUserMetadata`)`` Optional. Information about the user initiating the query. |
| `languageCode` | `string` Optional. Language to be used for answering if language detection fails. Also used as the language of error messages created by actions, regardless of language detection results. |
| `webGroundingEnabled` | `boolean` Optional. If set to true, enables grounding with web search. Works only if `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants#Assistant.FIELDS.web_grounding_type` is `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants#WebGroundingType.ENUM_VALUES.WEB_GROUNDING_TYPE_GOOGLE_SEARCH` or `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants#WebGroundingType.ENUM_VALUES.WEB_GROUNDING_TYPE_ENTERPRISE_WEB_SEARCH`. |
| `dataStoreSpecs[]` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/DataStoreSpec`)`` Optional. Specs defining `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.dataStores#DataStore`s to filter on in a search call and configurations for those data stores. This is only considered for `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines#Engine`s with multiple data stores. Not setting this field will result in using all data stores in the engine, except when `ignoreDataStores` is set to true. |
| `assistGenerationConfig` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/AssistGenerationConfig`)`` Optional. Request level generation configuration. This is used to override the default generation configuration at the engine level. |
| `mapsGroundingEnabled` | `boolean` Optional. If set to `true`, enables grounding with Google Maps. Works only if `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants#Assistant.FIELDS.maps_grounding_type` is `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants#MapsGroundingType.ENUM_VALUES.MAPS_GROUNDING_TYPE_GOOGLE_MAPS`. |
| `googleSearchGroundingEnabled (deprecated)` | `boolean` Optional. Deprecated. Use `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants/assist#body.request_body.FIELDS.web_grounding_enabled` instead. |

### Response body

Response for the `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants/assist#google.cloud.discoveryengine.v1alpha.AssistantService.Assist` method.

If successful, the response body contains data with the following structure:

| JSON representation |
|---|
| ``` { "answer": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.sessions.assistAnswers#AssistAnswer`) }, "sessionInfo": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants/assist#SessionInfo`) }, "assistToken": string, "invocationTools": [ string ], "invokedSkills": [ { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants/assist#InvokedSkill`) } ], "connectorAuthErrors": [ { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants/assist#ConnectorAuthError`) } ] } ``` |

| Fields ||
|---|---|
| `answer` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.sessions.assistAnswers#AssistAnswer`)`` The `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.sessions.assistAnswers#AssistAnswer` resource generated in response to the query. |
| `sessionInfo` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants/assist#SessionInfo`)`` Session information. |
| `assistToken` | `string` A global unique ID that identifies the current request-response pair. Used for feedback and support. |
| `invocationTools[]` | `string` The tool names of the tools that were invoked. |
| `invokedSkills[]` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants/assist#InvokedSkill`)`` The skills executed during the turn. |
| `connectorAuthErrors[]` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1alpha/projects.locations.collections.engines.assistants/assist#ConnectorAuthError`)`` Per-connector authentication errors encountered during the request. Present when one or more connectors failed authentication but the request proceeded with the remaining connectors. |

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/cloud-platform`
- `https://www.googleapis.com/auth/discoveryengine.assist.readwrite`
- `https://www.googleapis.com/auth/discoveryengine.readwrite`
- `https://www.googleapis.com/auth/discoveryengine.serving.readwrite`

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).

### IAM Permissions

Requires the following [IAM](https://cloud.google.com/iam/docs) permission on the `name` resource:

- `discoveryengine.assistants.assist`

For more information, see the [IAM documentation](https://cloud.google.com/iam/docs).

## AssistSkippingMode

Available skipping behaviors for assist requests.

| Enums ||
|---|---|
| `ASSIST_SKIPPING_MODE_UNSPECIFIED` | Default value. The answer can be skipped if the query isn't seeking assistance. |
| `REQUEST_ASSIST` | Request Assistant answer. The answer may still be skipped if the query fails policy checks. |

## SessionInfo

Information about the session.

| JSON representation |
|---|
| ``` { "session": string, "queryId": string } ``` |

| Fields ||
|---|---|
| `session` | `string` Name of the newly generated or continued session. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/sessions/{session}` |
| `queryId` | `string` Query ID that corresponds to this assist API call. One session can have multiple turns, each with a unique query ID. By specifying the session name and this query ID in the assistants.assist API call, the assist request happens in the context of the search results from this search call. |

## InvokedSkill

Represents a skill used during the assist call.

| JSON representation |
|---|
| ``` { "name": string, "displayName": string } ``` |

| Fields ||
|---|---|
| `name` | `string` The resource name of the skill. |
| `displayName` | `string` The display name of the skill. |

## ConnectorAuthError

Describes an authentication error for a specific data connector.

| JSON representation |
|---|
| ``` { "dataConnector": string, "errorMessage": string } ``` |

| Fields ||
|---|---|
| `dataConnector` | `string` Resource name of the data connector that failed authentication. |
| `errorMessage` | `string` Human-readable error message describing the auth failure. |