Configure Google Search grounding

By default, the assistant grounds its answers only with the data from data sources connected to your app. You have the option to turn on Google Search grounding so that the assistant can also use public website information to ground answers.

When Google Search grounding is turned on, the assistant can use Google Search results in answers and cite external websites. When it's turned off, the assistant only uses data that's been ingested to the app, and files that the user uploads to the assistant.

Google Search grounding can be configured at the administrator level and at the end user level:

  • As an administrator, you can enable or disable Google Search grounding for all users.
  • If Google Search grounding is enabled by the administrator, then end users can choose in the app whether to turn on Google Search grounding for their answers.

Configure Google Search grounding for all users

An administrator can enable or disable Google Search grounding for all users of the app.

Configure Google Search grounding using the console

To use the console to manage Google Search grounding for all users:

  1. In the Google Cloud console, go to the Agentspace page.

  2. Go to Configurations > Assistant.

  3. Turn the toggle switch for Enable Google Search grounding on or off.

Configure Google Search grounding using the API

To use the API to manage Google Search grounding for all users:

Run the following curl command:

curl -X PATCH \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  -H "X-Goog-User-Project: PROJECT_ID" \
"https://discoveryengine.googleapis.com/v1alpha/projects/PROJECT_NUMBER/locations/global/collections/default_collection/engines/APP_ID/assistants/ASSISTANT_ID" \
  -d '{
        "google_search_grounding_enabled": "GROUNDING_BOOLEAN",
        "displayName": "ASSISTANT_DISPLAY_NAME"
      }'

Replace the following:

  • PROJECT_ID: the ID of your Google Cloud project.
  • APP_ID: the ID of the app.
  • ASSISTANT_ID: the ID of the assistant.

Example command and response:

curl -X PATCH
  -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  -H "X-Goog-User-Project: 1234" \
  "https://discoveryengine.googleapis.com/v1alpha/projects/1234/locations/global/collections/default_collection/engines/myapp/assistants/default_assistant" \
  -d '{
        "google_search_grounding_enabled": "true",
        "displayName": "Default Assistant"
      }'
----------------------------
{
  "name": "projects/1234/locations/global/collections/default_collection/engines/myapp/assistants/default_assistant",
  "displayName": "Default Assistant",
  "googleSearchGroundingEnabled": true
}

Turn Google Search grounding on or off at the user level

If Google Search grounding is enabled at the administrator level, then end users can choose in the app whether to get answers with Google Search grounding or not.

To turn Google Search grounding on or off at the user level, do the following:

  1. Go to your app.
  2. In the search bar, click the G icon to turn Google Search grounding on or off:
    • Off: The G icon is black. Answers are generated only with data that has been ingested to the app or files uploaded by the user.
    • On: The G icon is multi-colored. Answers can include and cite Google Search results.

Get grounded assistant answers

When a user send a query to your app, the assistant provides answers that are grounded in your enterprise data. Citations are provided in the answer to show where in the data a given sentence is grounded.

Get grounded answers in the app

To get grounded answers from your assistant in the app, do the following:

  1. Go to your search app.
  2. Enter a query in the search bar. The assistant provides an answer to your query with citations.
  3. To view citations, click the Link icon next to a sentence in the assistant answer.

    The citation expands to show a card displaying the citation source. To go to the citation source, click the card.

Get grounded answers using the API

To get grounded answers from your assistant using the API, do the following:

Run the following curl command:

curl -X POST \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  -H "X-Goog-User-Project: PROJECT_ID" \
"https://discoveryengine.googleapis.com/v1alpha/projects/PROJECT_ID/locations/global/collections/default_collection/engines/APP_ID/assistants/ASSISTANT_ID:assist" \
  -d '{
        "query": {
          "text": "QUERY"
          }
      }'

Replace the following:

  • PROJECT_ID: the ID of your Google Cloud project.
  • APP_ID: the ID of the app.
  • ASSISTANT_ID: the ID of the assistant.
  • QUERY: the query.

Example command:

curl -X POST \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  -H "Content-Type: application/json" \
  -H "X-Goog-User-Project: 1234" \
"https://discoveryengine.googleapis.com/v1alpha/projects/1234/locations/global/collections/default_collection/engines/myapp/assistants/default_assistant:assist" \
  -d '{
        "query": {
          "text": "how do i use bigquery"
          }
      }'