Google Vertex AI Search
Google Vertex AI Search (formerly known as
Enterprise SearchonGenerative AI App Builder) is a part of the Vertex AI machine learning platform offered byGoogle Cloud.
Vertex AI Searchlets organizations quickly build generative AI-powered search engines for customers and employees. It's underpinned by a variety ofGoogle Searchtechnologies, including semantic search, which helps deliver more relevant results than traditional keyword-based search techniques by using natural language processing and machine learning techniques to infer relationships within the content and intent from the user’s query input. Vertex AI Search also benefits from Google’s expertise in understanding how users search and factors in content relevance to order displayed results.
Vertex AI Searchis available in theGoogle Cloud Consoleand via an API for enterprise workflow integration.
This notebook demonstrates how to configure Vertex AI Search and use the Vertex AI Search retriever. The Vertex AI Search retriever encapsulates the Python client library and uses it to access the Search Service API.
For detailed documentation of all VertexAISearchRetriever features and configurations head to the API reference.
Integration details
| Retriever | Self-host | Cloud offering | Package |
|---|---|---|---|
| VertexAISearchRetriever | ❌ | ✅ | langchain_google_community |
Setup
Installation
You need to install the langchain-google-community and google-cloud-discoveryengine packages to use the Vertex AI Search retriever.
%pip install -qU langchain-google-community google-cloud-discoveryengine
Configure access to Google Cloud and Vertex AI Search
Vertex AI Search is generally available without allowlist as of August 2023.
Before you can use the retriever, you need to complete the following steps:
Create a search engine and populate an unstructured data store
- Follow the instructions in the Vertex AI Search Getting Started guide to set up a Google Cloud project and Vertex AI Search.
- Use the Google Cloud Console to create an unstructured data store
- Populate it with the example PDF documents from the
gs://cloud-samples-data/gen-app-builder/search/alphabet-investor-pdfsCloud Storage folder. - Make sure to use the
Cloud Storage (without metadata)option.
- Populate it with the example PDF documents from the
Set credentials to access Vertex AI Search API
The Vertex AI Search client libraries used by the Vertex AI Search retriever provide high-level language support for authenticating to Google Cloud programmatically. Client libraries support Application Default Credentials (ADC); the libraries look for credentials in a set of defined locations and use those credentials to authenticate requests to the API. With ADC, you can make credentials available to your application in a variety of environments, such as local development or production, without needing to modify your application code.
If running in Google Colab authenticate with google.colab.google.auth otherwise follow one of the supported methods to make sure that you Application Default Credentials are properly set.
import sys
if "google.colab" in sys.modules:
from google.colab import auth as google_auth
google_auth.authenticate_user()