[a58 bug] Azure OpenAI global variables passed via "--env-file" doesn't work correctly
msmygit opened this issue · comments
Describe the bug
When we pass the global variables via a file which is then passed as python -m langflow run --env-file /path/to/.env
command doesn't work and gives the following error:
ValueError: Error building vertex Azure OpenAI Embeddings: Could not connect to AzureOpenAIEmbeddings API.
Browser and Version
n/a
To Reproduce
Steps to reproduce the behavior:
- Choose the pre-built Vector Store RAG collection
- Replace Open AI embedding/model to Azure OpenAI equivalents
- Try to play and you should see errors.
FWIW, if you manually enter the Azure OpenAI values on the component, this works.
Screenshots
n/a
Additional context
n/a
To resolve the issue of passing global variables via an environment file when using the Azure OpenAI service, ensure that your environment file (.env
) includes all the necessary variables listed in the VARIABLES_TO_GET_FROM_ENVIRONMENT
array. Here is an example of what your .env
file should look like:
OPENAI_API_KEY=your_openai_api_key
ANTHROPIC_API_KEY=your_anthropic_api_key
GOOGLE_API_KEY=your_google_api_key
AZURE_OPENAI_API_KEY=your_azure_openai_api_key
AZURE_OPENAI_API_VERSION=your_azure_openai_api_version
AZURE_OPENAI_API_INSTANCE_NAME=your_azure_openai_api_instance_name
AZURE_OPENAI_API_DEPLOYMENT_NAME=your_azure_openai_api_deployment_name
AZURE_OPENAI_API_EMBEDDINGS_DEPLOYMENT_NAME=your_azure_openai_api_embeddings_deployment_name
ASTRA_DB_APPLICATION_TOKEN=your_astra_db_application_token
ASTRA_DB_API_ENDPOINT=your_astra_db_api_endpoint
COHERE_API_KEY=your_cohere_api_key
HUGGINGFACEHUB_API_TOKEN=your_huggingfacehub_api_token
SEARCHAPI_API_KEY=your_searchapi_api_key
SERPAPI_API_KEY=your_serpapi_api_key
VECTARA_CUSTOMER_ID=your_vectara_customer_id
VECTARA_CORPUS_ID=your_vectara_corpus_id
VECTARA_API_KEY=your_vectara_api_key
Make sure that the .env
file is correctly formatted and located in the directory where your application expects it. If the connection error persists, double-check that the values in the .env
file are correct and that there are no typos or formatting issues [1].
Fixed by #2336