Method: projects.locations.collections.engines.assistants.assist

Assists the user with a query.

HTTP request

POST https://discoveryengine.googleapis.com/v1beta/{name=projects/*/locations/*/collections/*/engines/*/assistants/*}:assist

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
name

string

Required. The resource name of the 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 (Query)
  },
  "session": string,
  "assistSkippingMode": enum (AssistSkippingMode),
  "fileIds": [
    string
  ],
  "userMetadata": {
    object (AssistUserMetadata)
  }
}
Fields
query

object (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 (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 AssistAnswer.assist_skipped_reasons within AssistResponse.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 AddContextFileResponse.file_id.

userMetadata

object (AssistUserMetadata)

Optional. Information about the user initiating the query.

Response body

Response for the AssistantService.Assist method.

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

JSON representation
{
  "answer": {
    object (AssistAnswer)
  },
  "sessionInfo": {
    object (SessionInfo)
  },
  "assistToken": string
}
Fields
answer

object (AssistAnswer)

The AssistAnswer resource generated in response to the query.

sessionInfo

object (SessionInfo)

Session information.

assistToken

string

A global unique ID that identifies the current request-response pair. Used for feedback and support.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • discoveryengine.assistants.assist

For more information, see the IAM documentation.

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.