Vertex AI
Google Cloud’s Vertex AI serves text embedding models such asgemini-embedding-001. Mem0 uses them through the provider’s own SDK, which you install alongside Mem0.
Installation
The Vertex AI client is an optional dependency, so install it yourself.Authentication
Both SDKs authenticate with Application Default Credentials. Pick whichever fits your environment:- Local development: run
gcloud auth application-default login. - Service account: create a key in the Google Cloud Console and point
GOOGLE_APPLICATION_CREDENTIALSat the JSON file, or pass its path through the embedder config. - Google Cloud runtimes (Cloud Run, GKE, Compute Engine): the attached service account is picked up automatically.
googleProjectId, then the GCP_PROJECT_ID, GOOGLE_CLOUD_PROJECT, and GCLOUD_PROJECT environment variables, and finally from your credentials. Set it explicitly when your credentials cover more than one project.
Usage
Embedding types
Vertex AI embeds the same text differently depending on the task you declare. The embedding types can be one of the following:- SEMANTIC_SIMILARITY
- CLASSIFICATION
- CLUSTERING
- RETRIEVAL_DOCUMENT, RETRIEVAL_QUERY, QUESTION_ANSWERING, FACT_VERIFICATION
- CODE_RETRIEVAL_QUERY
These embedding types map to the add, update, and search memory actions in both the Python and TypeScript SDKs. Stored memories use the add or update type, and searches use the search type.
Choosing a model
Config
Here are the parameters available for configuring the Vertex AI embedder:- Python
- TypeScript