Google Cloud Platform Vertex AI PaLM
Note: This is seperate from the Google PaLM integration, it exposes Vertex AI PaLM API on Google Cloud.
By default, Google Cloud does not use Customer Data to train its foundation models as part of Google Cloud`s AI/ML Privacy Commitment. More details about how Google processes data can also be found in Google's Customer Data Processing Addendum (CDPA).
To use Vertex AI PaLM you must have the google-cloud-aiplatform
Python package installed and either:
- Have credentials configured for your environment (gcloud, workload identity, etc...)
- Store the path to a service account JSON file as the GOOGLE_APPLICATION_CREDENTIALS environment variable
This codebase uses the google.auth
library which first looks for the application credentials variable mentioned above, and then looks for system-level auth.
For more information, see:
- https://cloud.google.com/docs/authentication/application-default-credentials#GAC
- https://googleapis.dev/python/google-auth/latest/reference/google.auth.html#module-google.auth
#!pip install google-cloud-aiplatform
from langchain.embeddings import VertexAIEmbeddings
API Reference:
- VertexAIEmbeddings from
langchain.embeddings
embeddings = VertexAIEmbeddings()
text = "This is a test document."
query_result = embeddings.embed_query(text)
doc_result = embeddings.embed_documents([text])