gpt-researcher: Azure OpenAI .env params not working

Describe the bug When trying to use Azure Openai by setting the .env file, I get the following issue:

"Did not find openai_api_key, please add an environment variable OPENAI_API_KEY which contains it, or pass openai_api_key as a named parameter. (type=value_error)

To Reproduce clone repo create .env: EMBEDDING_PROVIDER=azure_openai LLM_PROVIDER = azure_openai AZURE_OPENAI_API_KEY=xxxxxxx AZURE_OPENAI_ENDPOINT=https://xxxxxxx.openai.azure.com/ OPENAI_API_VERSION=2023-03-15-preview FAST_LLM_MODEL=gpt-4o SMART_LLM_MODEL=gpt-4o AZURE_EMBEDDING_MODEL=text-embedding-3-large TAVILY_API_KEY=xxxxxx

Expected behavior No error

Desktop (please complete the following information):

  • OS: MacOS latest
  • Browser chrome

EDIT: also tried with FAST_LLM and SMART_LLM env variable names, same result

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 23 (13 by maintainers)

Most upvoted comments

After some trial and error. I did get it to work with Azure. I used the following ENV vars. Please note, I would get an error and ultimately failure if I did not use both OPENAI_API_VERSION and AZURE_OPENAI_API_VERSION

Also, my API version that works is different, which is understandable. This is an Azure thing, and does not have to do with gpt-researcher

EMBEDDING="azure_openai:text-embedding-3-small"
AZURE_OPENAI_API_KEY=
AZURE_OPENAI_ENDPOINT=
OPENAI_API_VERSION=2024-02-15-preview
AZURE_OPENAI_API_VERSION=2024-02-15-preview
FAST_LLM=azure_openai:gpt-4o-mini # note that the deployment name must be the same as the model name
SMART_LLM=azure_openai:gpt-4o # note that the deployment name must be the same as the model name

@danieldekay for now only the smart llm is used. We changed the summarization logic

@danieldekay is our local Azure expert & left some docs here 😃

Is it working for you on master Dan?