sample-app-aoai-chatGPT
sample-app-aoai-chatGPT copied to clipboard
Must provide an 'engine' or 'deployment_id' parameter
Provided all the .env values but receive the following error when sending a question in the chat.
AZURE_OPENAI_KEY="123"
AZURE_OPENAI_MODEL="abc"
AZURE_OPENAI_MODEL_NAME="gpt-35-turbo"
AZURE_OPENAI_RESOURCE="abc"
The WebUI starts as expected, but after clicking the send button the following error occurs: openai.error.InvalidRequestError: Must provide an 'engine' or 'deployment_id' parameter to create a <class 'openai.api_resources.chat_completion.ChatCompletion'>
The error you are facing indicates that you need to provide an 'engine' or 'deployment_id' parameter when creating an instance of 'ChatCompletion' in the OpenAI library.
Make sure you are correctly providing the values for the environment variables 'AZURE_OPENAI_KEY', 'AZURE_OPENAI_MODEL' and 'AZURE_OPENAI_MODEL_NAME'.
Make sure these values are correct and not missing or incorrect in your .env file. Also, make sure you are correctly passing the 'engine' or 'deployment_id' parameter when creating the 'ChatCompletion' instance in your code.
Depending on the OpenAI library version you are using, the method for creating an instance may vary. Make sure you follow the updated docs and use the correct syntax.
When I provide the correct values in my .env file and test the app local, it works.
When I run az webapp up
as indicated in the README, when I test the deployed web app, I get the same error as @Vayain, because the .env file is not included in the deploy.
Could we make a change in the repository to make it easier for users to include the .env file, or to provide guidance to users on how to make the web app get the env variables?
Thanks all for raising this issue. We are working on improvements to the local development/deployment experience and will update the documentation accordingly when these are ready.
In the mean time, for @Vayain and @amenegola: after deploying with az webapp up
you can set the environment variables on the deployed app service using az webapp config appsettings set
. See more details here: https://learn.microsoft.com/en-us/cli/azure/webapp/config/appsettings?view=azure-cli-latest#az-webapp-config-appsettings-set