Google Vertex AI Embeddings
This will help you get started with Google Vertex AI Embeddings models using LangChain. For detailed documentation on Google Vertex AI Embeddings
features and configuration options, please refer to the API reference.
Overviewโ
Integration detailsโ
Provider | Package |
---|---|
langchain-google-vertexai |
Setupโ
To access Google Vertex AI Embeddings models you'll need to
- Create a Google Cloud account
- Install the
langchain-google-vertexai
integration package.
Credentialsโ
Head to Google Cloud to sign up to create an account. Once you've done this set the GOOGLE_APPLICATION_CREDENTIALS environment variable:
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
OPTIONAL : Authenticate your notebook environment (Colab only)
If you're running this notebook on Google Colab, run the cell below to authenticate your environment.
import sys
if "google.colab" in sys.modules:
from google.colab import auth
auth.authenticate_user()
Set Google Cloud project information and initialize Vertex AI SDK
To get started using Vertex AI, you must have an existing Google Cloud project and enable the Vertex AI API.
Learn more about setting up a project and a development environment.
PROJECT_ID = "[your-project-id]" # @param {type:"string"}
LOCATION = "us-central1" # @param {type:"string"}
import vertexai
vertexai.init(project=PROJECT_ID, location=LOCATION)
To enable automated tracing of your model calls, set your LangSmith API key:
# os.environ["LANGSMITH_TRACING"] = "true"
# os.environ["LANGSMITH_API_KEY"] = getpass.getpass("Enter your LangSmith API key: ")
Installationโ
The LangChain Google Vertex AI Embeddings integration lives in the langchain-google-vertexai
package:
%pip install -qU langchain-google-vertexai