mem0ai / mem0

The Memory layer for your AI apps
https://mem0.ai
Apache License 2.0
21.77k stars 1.98k forks source link

AzureOpenAI Embedding Model and LLM Model Initialisation from Config. #1773

Closed ketangangal closed 2 weeks ago

ketangangal commented 2 weeks ago

Description

AzureOpenAI Configuration for Mem0.

Type of change

Please delete options that are not relevant.

Changes

1. Memory config

  config = {
      "llm": {
          "provider": "azure_openai",
          "config": {
              "model" : "gpt-4o",
              "temperature": 0.1,
              "max_tokens": 2000,
              "azure_kwargs" : {
                  "azure_deployment" : "",
                  "api_version" : "",
                  "azure_endpoint" : "",
                  "api_key" : ""
              }
          }
      },
      "vector_store": {
          "provider": "qdrant",
          "config": {
              "collection_name": "",
              "embedding_model_dims": 1536,
              "url": "",
              "api_key": "",
          }
      },
      "embedder": {
          "provider": "azure_openai",
          "config": {
              "model": "text-embedding-3-small",
              "azure_kwargs" : {
                  "api_version" : "",
                  "azure_deployment" : "",
                  "azure_endpoint" : "",
                  "api_key": ""
              }

          }
      }
  }

    m = Memory.from_config(config_dict=config)

2. Seperate Env Variables

Need if both model are initialise together then API keys will conflict hence the change.

AzureOpenAI for LLM

LLM_AZURE_OPENAI_API_KEY
LLM_AZURE_DEPLOYMENT
LLM_AZURE_ENDPOINT
LLM_AZURE_API_VERSION

AzureOpenAI for Embeddings

EMBEDDING_AZURE_OPENAI_API_KEY
EMBEDDING_AZURE_DEPLOYMENT
EMBEDDING_AZURE_ENDPOINT
EMBEDDING_AZURE_API_VERSION

FYI @prateekchhikara @taranjeet @deshraj @Dev-Khant

CLAassistant commented 2 weeks ago

CLA assistant check
All committers have signed the CLA.

Dev-Khant commented 2 weeks ago

Hey @ketangangal Can you please resolve the merge conflicts so we can run the tests?

ketangangal commented 2 weeks ago

Hey @Dev-Khant sure!

Dev-Khant commented 2 weeks ago

@ketangangal Can you please check failing tests?

ketangangal commented 2 weeks ago

@ketangangal Can you please check failing tests?

done

ketangangal commented 2 weeks ago

FYI @deshraj @Dev-Khant can you review and let me know if changes are required.

Dev-Khant commented 2 weeks ago

@ketangangal Thanks for the contribution.