diff --git a/README.md b/README.md index 40bc4d3c..0163b598 100644 --- a/README.md +++ b/README.md @@ -64,10 +64,11 @@ The following environment variables are required to run the application: - `EMBEDDINGS_MODEL`: (Optional) Set a valid embeddings model to use from the configured provider. - **Defaults** - openai: "text-embedding-3-small" - - azure: "text-embedding-3-small" + - azure: "text-embedding-3-small" (will be used as your Azure Deployment) - huggingface: "sentence-transformers/all-MiniLM-L6-v2" - huggingfacetei: "http://huggingfacetei:3000". Hugging Face TEI uses model defined on TEI service launch. - ollama: "nomic-embed-text" +- `RAG_AZURE_OPENAI_API_VERSION`: (Optional) Default is `2023-05-15`. The version of the Azure OpenAI API. - `RAG_AZURE_OPENAI_API_KEY`: (Optional) The API key for Azure OpenAI service. - Note: `AZURE_OPENAI_API_KEY` will work but `RAG_AZURE_OPENAI_API_KEY` will override it in order to not conflict with LibreChat setting. - `RAG_AZURE_OPENAI_ENDPOINT`: (Optional) The endpoint URL for Azure OpenAI service, including the resource. diff --git a/config.py b/config.py index 43c24376..e5278e36 100644 --- a/config.py +++ b/config.py @@ -134,6 +134,7 @@ async def dispatch(self, request, call_next): RAG_OPENAI_BASEURL = get_env_variable("RAG_OPENAI_BASEURL", None) RAG_OPENAI_PROXY = get_env_variable("RAG_OPENAI_PROXY", None) AZURE_OPENAI_API_KEY = get_env_variable("AZURE_OPENAI_API_KEY", "") +RAG_AZURE_OPENAI_API_VERSION = get_env_variable("RAG_AZURE_OPENAI_API_VERSION", None) RAG_AZURE_OPENAI_API_KEY = get_env_variable("RAG_AZURE_OPENAI_API_KEY", AZURE_OPENAI_API_KEY) AZURE_OPENAI_ENDPOINT = get_env_variable("AZURE_OPENAI_ENDPOINT", "") RAG_AZURE_OPENAI_ENDPOINT = get_env_variable("RAG_AZURE_OPENAI_ENDPOINT", AZURE_OPENAI_ENDPOINT).rstrip("/") @@ -153,9 +154,10 @@ def init_embeddings(provider, model): ) elif provider == "azure": return AzureOpenAIEmbeddings( - model=model, + azure_deployment=model, api_key=RAG_AZURE_OPENAI_API_KEY, - azure_endpoint=RAG_AZURE_OPENAI_ENDPOINT + azure_endpoint=RAG_AZURE_OPENAI_ENDPOINT, + api_version=RAG_AZURE_OPENAI_API_VERSION ) elif provider == "huggingface": return HuggingFaceEmbeddings(model_name=model, encode_kwargs={