To use Azure OpenAI embedding models, set the EMBEDDING_AZURE_OPENAI_API_KEY, EMBEDDING_AZURE_DEPLOYMENT, EMBEDDING_AZURE_ENDPOINT and EMBEDDING_AZURE_API_VERSION environment variables. You can obtain the Azure OpenAI API key from the Azure.

Usage

import os
from mem0 import Memory

os.environ["EMBEDDING_AZURE_OPENAI_API_KEY"] = "your-api-key"
os.environ["EMBEDDING_AZURE_DEPLOYMENT"] = "your-deployment-name"
os.environ["EMBEDDING_AZURE_ENDPOINT"] = "your-api-base-url"
os.environ["EMBEDDING_AZURE_API_VERSION"] = "version-to-use"


config = {
    "embedder": {
        "provider": "azure_openai",
        "config": {
            "model": "text-embedding-3-large"
            "azure_kwargs" : {
                  "api_version" : "",
                  "azure_deployment" : "",
                  "azure_endpoint" : "",
                  "api_key": ""
              }
        }
    }
}

m = Memory.from_config(config)
m.add("I'm visiting Paris", user_id="john")

Config

Here are the parameters available for configuring Azure OpenAI embedder:

ParameterDescriptionDefault Value
modelThe name of the embedding model to usetext-embedding-3-small
embedding_dimsDimensions of the embedding model1536
azure_kwargsThe Azure OpenAI configsconfig_keys