Skip to content

Latest commit

 

History

History
 
 

search-web-app

Generative AI App Builder - Enterprise Search Demo

NOTE: Some of the links in this file require allowlist access to Generative AI App Builder in order to view. If you would like early access to the product, apply to become a Trusted Tester for Google Cloud Generative AI.

This demo illustrates how to search through a corpus of documents using Enterprise Search on Generative AI App Builder.

Additional features include how to search the public Cloud Knowledge Graph using the Enterprise Knowledge Graph API.

Architecture

Google Cloud Products Used

Setup

Dependencies

  1. Install Python
  2. Install the Google Cloud SDK
  3. Install the prerequisites:
    • pip install -r requirements.txt
  4. Run gcloud init, create a new project, and enable billing
  5. Enable the Generative AI App Builder API:
    • gcloud services enable discoveryengine.googleapis.com
  6. Enable the Enterprise Knowledge Graph API:
    • gcloud services enable enterpriseknowledgegraph.googleapis.com
  7. Enable Cloud Run:
    • gcloud services enable run.googleapis.com
  8. Setup application default authentication, run:
    • gcloud auth application-default login

Demo Deployment

  1. Update the consts.py file with your own PROJECT_ID and LOCATION.

  2. Configure Enterprise Search

    • To use the prebuilt widget provided in the Cloud Console for Enterprise, Copy the configId from the <gen-search-widget> in the Integration > Widget tab.
      • configId
      • Be sure to set authorization type as Public Access and add your web application url to the Allowed Domains once it's deployed.
      • Add the configId for your Search Engines to WIDGET_CONFIGS in consts.py
    • To use the Custom UI, add the datastore id for your search engine to CUSTOM_UI_DATASTORE_IDS in consts.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
  3. Configure Recommendations

    • Add the datastore id and engine id for your recommendations engine to RECOMMENDATIONS_DATASTORE_IDs in consts.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
  4. Configure Image Search

    • Follow the instructions in the documentation to enable image search for a search engine.
    • This feature is in early access and requires separate allowlisting from the rest of Enterprise Search in order to use.
    • Add the datastore id for your search engine to IMAGE_SEARCH_DATASTORE_IDs in consts.py.
  5. Deploy the Cloud Run app in your project.

    • gcloud run deploy genappbuilder-demo --source .
  6. Visit the deployed web page


Copyright 2023 Google LLC Author: Holt Skinner @holtskinner