NOTE: Some of the features in this demo require allowlist access. If you would like early access, apply to become a Trusted Tester for Google Cloud Generative AI.
This demo illustrates how to search through a corpus of documents using Vertex AI Search (formerly known as Enterprise Search).
Additional features include how to search the public Cloud Knowledge Graph using the Enterprise Knowledge Graph API.
-
Follow steps in Get started with Vertex AI Search for Unstructured Data.
- Sample Data Sources used in the deployed demo:
- Contract Understanding Atticus Dataset (CUAD)
gs://cloud-samples-data/gen-app-builder/search/CUAD_v1
- Alphabet Earnings Reports
gs://cloud-samples-data/gen-app-builder/search/alphabet-investor-pdfs
- Contract Understanding Atticus Dataset (CUAD)
- Sample Data Sources used in the deployed demo:
-
Follow steps in Get started with Vertex AI Search for Websites
- Google Cloud site
https://cloud.google.com
- Google Cloud site
-
Follow steps in Get started with Recommendations for Unstructured Data.
- Sample Data Sources used in the deployed demo:
- Natural language papers from ArXiv
gs://cloud-samples-data/gen-app-builder/search/arxiv
- Natural language papers from ArXiv
- Sample Data Sources used in the deployed demo:
-
Install the Google Cloud SDK
-
Install the prerequisites:
pip install -r requirements.txt
-
Run
gcloud init
, create a new project, and enable billing -
Enable the Vertex AI Search API:
gcloud services enable discoveryengine.googleapis.com
-
Enable the Enterprise Knowledge Graph API:
gcloud services enable enterpriseknowledgegraph.googleapis.com
-
Enable Cloud Run:
gcloud services enable run.googleapis.com
-
Setup application default authentication, run:
gcloud auth application-default login
-
Give the Cloud Run service account required permissions:
gcloud projects add-iam-policy-binding [PROJECT_ID] \ --member='serviceAccount:[PROJECT_ID]-compute@developer.gserviceaccount.com' \ --role='roles/discoveryengine.viewer'
-
(Optional) If your Google Cloud organization has polices to restrict sharing by domain, then you'll need to change this to allow all domains for the Cloud Run application to be open to the public Internet.
-
Update the
consts.py
file with your ownPROJECT_ID
andLOCATION
. -
Configure Vertex AI Search
- To use the prebuilt widget provided in the Cloud Console for Enterprise, Copy the
configId
from the<gen-search-widget>
in theIntegration > Widget
tab. - To use the Custom UI, add the datastore id for your search engine to
CUSTOM_UI_DATASTORE_IDS
inconsts.py
- This is the string after
/engines/
in the Cloud Console URL.https://console.cloud.google.com/gen-app-builder/engines/website-search-engine_1681248733152/...
- Datastore ID is
website-search-engine_1681248733152
- This is the string after
- To use the prebuilt widget provided in the Cloud Console for Enterprise, Copy the
-
Configure Recommendations
- Add the datastore id and engine id for your recommendations engine to
RECOMMENDATIONS_DATASTORE_IDs
inconsts.py
. - The datastore id is visible on the
Data > Details
page. - The engine id is the string after
/engines/
in the Cloud Console URL.https://console.cloud.google.com/gen-app-builder/engines/contracts-personalize_1687884886933/data/records
- Engine ID is
contracts-personalize_1687884886933
- Add the datastore id and engine id for your recommendations engine to
-
Configure Image Search
- Follow the instructions in the documentation to enable image search for a website search engine.
- NOTE: You must enable Advanced Website Indexing which requires domain verification.
- Add the datastore id for your search engine to
IMAGE_SEARCH_DATASTORE_IDs
inconsts.py
.
- Follow the instructions in the documentation to enable image search for a website search engine.
-
Deploy the Cloud Run app in your project.
-
gcloud run deploy vertex-ai-search-demo --source .
-
To test locally:
flask --app main run
-
-
Visit the deployed web page
Copyright 2023 Google LLC Author: Holt Skinner @holtskinner