@Leabriah Spencer Were you able to test the if the api_key is getting set properly.
If you are not getting the correct values when using echo cmdlet in command prompt, then the respective environment variable is not configured correctly.
Please validate the environment variables by checking "System Properties" > "Environment Variables". (See screenshot below)
If you are using environment variables you need to use the code as below -
# Get configuration settings
load_dotenv()
azure_oai_endpoint =("https://{resourcename}.openai.azure.com/")
azure_oai_key = os.getenv("AOAIKey")
azure_oai_model = "gpt35turbo"
# Set OpenAI configuration settings
openai.api_type = "azure"
openai.api_base = azure_oai_endpoint
openai.api_version = "2023-05-15"
openai.api_key = azure_oai_key
Also, try hardcoding like this and see if it works.
openai.api_type = "azure"
openai.api_base = "https://{resource}.openai.azure.com/"
openai.api_version = "2023-05-15"
openai.api_key = "{key}"
Thanks
Saurabh