This article explores how to use Google Cloud Vertex AI and the PaLM 2 large language model to generate text embeddings and perform semantic searches. The PaLM API makes Google’s PaLM 2 large language model available to developers through the Google Cloud Vertex AI platform. We will use textembedding-gecko, a model based on the PaLM 2 foundation model, to generate text embeddings. We will also use the TREC (Question Classification) dataset from Kaggle to perform the semantic search. The library, vertexai.preview.language_models, has multiple classes including ChatModel, TextEmbedding, and TextGenerationModel.
