Get started with generic search
Vertex AI Search brings together the power of deep information retrieval, state-of-the-art natural language processing, and the latest in large language processing to understand user intent and return the most relevant results for the user.
With Vertex AI Search, you can create apps for searching and for making recommendations. Vertex AI Search also has special capabilities for some industries, such as media, healthcare, and retail.
This tutorial focuses on creating a search app for generic data; that is, data which are not specific to an industry vertical.
This tutorial explains how to create search apps for different kinds of data:
- Website data from crawling
cloud.google.com/generative-ai-app-builder/
- Structured data in the form of an NDJSON-formatted dataset ingested from a Cloud Storage bucket
- Unstructured data in the form of PDFs ingested from a Cloud Storage bucket
Before following this tutorial, make sure you have done the steps in Before you begin.
To follow step-by-step guidance for this task directly in the Google Cloud console, click Guide me:
Before you begin
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Vertex AI Agent Builder (Discovery Engine), BigQuery, Cloud Storage APIs.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Vertex AI Agent Builder (Discovery Engine), BigQuery, Cloud Storage APIs.
Enable Vertex AI Agent Builder
In the Google Cloud console, go to the Agent Builder page.
Read and agree to the Terms of Service, then click Continue and activate the API.
Create a data store
First, you'll create a data store which contains the data that your search app will index.
Click the tab for the type of data that you want to put in your data store: website, structured, or unstructured.
Website data
Go to the
Create data store page.In the Select a data source pane, select Website content.
In the Specify the websites for your data store pane, make sure that Advanced website indexing is turned off.
In the Sites to include field, enter:
cloud.google.com/generative-ai-app-builder/*
Click Continue.
In the Configure your data store pane, select global (Global) as the location for your data store.
Enter a name for your data store. Note the
ID that is generated. You'll need this later.Click Create.
Structured data
Go to the
Create data store page.In the Select a data source pane, select Cloud Storage.
In the Import data from Cloud Storage pane, select Structured data (JSONL).
Make sure File is selected.
In the
gs://
field, enter the following value:cloud-samples-data/gen-app-builder/search/kaggle_movies/movie_metadata.ndjson
This Cloud Storage bucket contains an NDJSON-formatted file of movies made available by Kaggle.
Click Continue.
Assign key properties as follows:
Field name Key property homepage
uri
overview
description
And, click Continue.
In the Configure your data store pane, select global (Global) as the location for your data store.
Enter a name for your data store. Note the
ID that is generated. You'll need this later.Click Create.
Unstructured data
Go to the
Create data store page.In the Select a data source pane, select Cloud Storage.
In the Import data from Cloud Storage pane, select Unstructured documents (PDF, HTML, TXT and more).
Make sure Folder is selected.
In the
gs://
field, enter the following value:cloud-samples-data/gen-app-builder/search/alphabet-investor-pdfs
This Cloud Storage bucket contains earnings report PDFs from the Alphabet investor site.
In the Configure your data store pane, select global (Global) as the location for your data store.
Enter a name for your data store. Note the
ID that is generated. You'll need this later.Click Create.
Create a search app
Next, you'll create a search app and link the data store you created previously.
Website data
Go to the
Create App page.Under Search for your website, click Create.
Make sure that Enterprise edition features is turned on.
In the
Your app name field, enter a name for your app. Your app ID appears under the app name.In the External name of your company or organization field, enter the company or organization name. For this tutorial, you can use
Google Cloud
, because the app will search a Google Cloud website.Select global (Global) as the location for your app, and then click Continue.
In the list of data stores, select the data store that you created earlier, and then click Create.
Go to your app's Data page to view the list of indexed websites and change them if needed.
Structured data
Go to the
Create App page.Under Search for your website, click Create.
Make sure that Enterprise edition features is turned on.
In the
Your app name field, enter a name for your app. Your app ID appears under the app name.In the External name of your company or organization field, enter the company or organization name. For this tutorial, you can use
Cymbal Cinemas
, because the app will search a data store of movies.Select global (Global) as the location for your app, and then click Continue.
In the list of data stores, select the data store that you created earlier, and then click Create.
On your app's Data page, click the Activity tab to see the status of your data ingestion. Import completed displays in the Status column when the import process is complete. For this dataset, this typically takes two to three minutes. You might need to click Refresh to see Import completed.
Click the Documents tab to see the number of documents imported.
Unstructured data
Go to the
Create App page.Under Search for your website, click Create.
Make sure that Enterprise features is turned on.
In the
Your app name field, enter a name for your app. Your app ID appears under the app name.In the External name of your company or organization field, enter the company or organization name. For this tutorial, you can use
Alphabet
, because the app will search over Alphabet documents.Select global (Global) as the location for your app, and then click Continue.
In the list of data stores, select the data store that you created earlier, and then click Create.
On your app's Data page, click the Activity tab to see the status of your data ingestion. When the import process is complete, the Status column displays Import completed. For this dataset, the import process typically takes two to three minutes. You might need to click Refresh to see the Import completed status.
Click the Documents tab to see the number of documents imported.
Preview your app
Website data
On the Apps page, click the name of your new app.
In the navigation menu, click
Preview to test the search app.Optional: Click the view icons to switch between mobile view and desktop view.
In the search bar, perform a search for
Vertex AI Search
to view results about the product.
Structured data
On the Apps page, click the name of your new app.
In the navigation menu, click
Preview to test the search app.Optional: Click the view icons to switch between mobile view and desktop view.
In the search bar, enter
trains
, and then press Enter to get results for movies related to trains.
Unstructured data
On the Apps page, click the name of your new app.
In the navigation menu, click
Preview to test the search app.Optional: Click the view icons to switch between mobile view and desktop view.
In the search bar, enter
Google
, and then press Enter to view your results.
Configure the search widget
In the navigation menu, click Configurations.
On the UI tab, configure settings for the search app.
Different UI configurations are available for different data types. For more information, see Configure results for the search widget.
If you change configurations on the UI tab, click Save and publish.
Go to the Autocomplete tab to configure specific settings for autocomplete.
For more information, see Configure autocomplete.
Go to the Advanced tab to configure advanced features.
For more information, see About advanced features.
Deploy a search app
On the Apps page, click the name of the app that you want to deploy.
In the navigation menu, click Integration.
Make sure the Widget tab is selected.
Select JWT or OAuth based as the widget authorization type.
In the Domain field, enter the domain name for web page where you'll put the widget. For example, if you are going to copy the widget to the web page
example.com/ai.html
, enterexample.com
as the domain.Click Add, and then click Save.
Copy the code snippet provided in the Copy the following code to your web application section.
In your codebase, generate an authorization token.
To pass the authorization token to your widget, use the "Set authorization token" code snippet provided in the Copy the following code to your web application section and replace the text
<JWT or OAuth token provided by your backend>
with your authorization token.Test your deployed app. You can further adjust the configuration by following the steps "Configure the search widget". Make sure to click Save and publish so that the changes take effect on the deployed widget.
Clean up
To avoid incurring charges to your Google Cloud account for the resources used on this page, follow these steps.
- To avoid unnecessary Google Cloud charges, use the Google Cloud console to delete your project if you don't need it.
- If you created a new project to learn about Vertex AI Agent Builder and you no longer need the project, delete the project.
- If you used an existing Google Cloud project, delete the resources you created to avoid incurring charges to your account. For more information, see Delete an app.
- Follow the steps in Turn off Vertex AI Agent Builder.