diff --git a/backend/open_webui/config.py b/backend/open_webui/config.py index 22a563821..7affe2c30 100644 --- a/backend/open_webui/config.py +++ b/backend/open_webui/config.py @@ -2267,7 +2267,8 @@ DOWNLOADED_EMBEDDING_MODELS = PersistentConfig( "rag.downloaded_embedding_models", os.getenv("DOWNLOADED_EMBEDDING_MODELS", {"":["sentence-transformers/all-MiniLM-L6-v2"], "openai":["text-embedding-3-small"], - "ollama":[]}) + "ollama":[], + "azure_openai_config": []}) ) DOWNLOADED_RERANKING_MODELS = PersistentConfig( @@ -2282,7 +2283,8 @@ LOADED_EMBEDDING_MODELS = PersistentConfig( "rag.loaded_embedding_models", os.getenv("LOADED_EMBEDDING_MODELS", {"":["sentence-transformers/all-MiniLM-L6-v2"], "openai":[], - "ollama":[]}) + "ollama":[], + "azure_openai_config": []}) ) LOADED_RERANKING_MODELS = PersistentConfig( diff --git a/backend/open_webui/main.py b/backend/open_webui/main.py index 939e891a4..3f0fa6ba1 100644 --- a/backend/open_webui/main.py +++ b/backend/open_webui/main.py @@ -813,6 +813,11 @@ try: # Load all embedding models that are currently in use for engine, model_list in app.state.config.LOADED_EMBEDDING_MODELS.items(): for model in model_list: + if engine == "azure_openai": + # For Azure OpenAI, model is a dict: {model_name: version} + model_name, azure_openai_api_version = next(iter(model.items())) + model = model_name + app.state.ef[model] = get_ef( engine, model, @@ -835,7 +840,7 @@ try: app.state.config.RAG_EMBEDDING_BATCH_SIZE, azure_api_version=( app.state.config.RAG_AZURE_OPENAI_API_VERSION - if app.state.config.RAG_EMBEDDING_ENGINE == "azure_openai" + if engine == "azure_openai" else None ), )