Azure-Samples / chat-with-your-data-solution-accelerator

A Solution Accelerator for the RAG pattern running in Azure, using Azure AI Search for retrieval and Azure OpenAI large language models to power ChatGPT-style and Q&A experiences. This includes most common requirements and best practices.
https://azure.microsoft.com/products/search
MIT License
675 stars 337 forks source link

The AZURE_OPENAI_SYSTEM_MESSAGE keeps reseting #1066

Open djseng opened 3 weeks ago

djseng commented 3 weeks ago

Describe the bug

When I set the AZURE_OPENAI_SYSTEM_MESSAGE then do an azd up the system message isn't set as expected.

Expected behavior

I'd expect the AZURE_OPENAI_SYSTEM_MESSAGE to be set, and used in the function app.

How does this bug make you feel?

Share a gif from giphy to tells us how you'd feel


Debugging information

Steps to reproduce

Steps to reproduce the behavior:

azd env refresh
azd set AZURE_OPENAI_SYSTEM_MESSAGE "You help people find information."
azd up

ssh to the function app

echo $AZURE_OPENAI_SYSTEM_MESSAGE

outputs nothing.

I also tried

azd env refresh
azd set AZURE_OPENAI_SYSTEM_MESSAGE "You help people find information."
azd deploy function

ssh to the function app

echo $AZURE_OPENAI_SYSTEM_MESSAGE

outputs nothing

Work Around

If I manually add a new AZURE_OPENAI_SYSTEM_MESSAGE environment variable then I see the expected SYSTEM_MESSAGE.

ssh to the function app

echo $AZURE_OPENAI_SYSTEM_MESSAGE

outputs the expected system message

Tasks

To be filled in by the engineer picking up the issue

Prasanjeet-Microsoft commented 3 weeks ago

Hello @djseng, can you please confirm whether we need to reproduce this steps in dev container platform or somewhere else?

djseng commented 3 weeks ago

@Prasanjeet-Microsoft this is when deploying to azure.

Prasanjeet-Microsoft commented 1 week ago

@djseng We have tried to reproduce the steps that is mentioned above. But it seems "set" is not a valid azd command to set the value of environment variable. Therefore, we have tried to find the alternate way to set the value of environment variables. Please find below commands that we have come across which is working fine:

  1. Ensure Azure CLI is Installed and Logged In

    • Make sure you have Azure CLI installed and authenticated (az login).
  2. Run the Azure CLI Command

    • Use the az webapp config appsettings set command to set the environment variable for your Azure Web App:

az webapp config appsettings set --resource-group YourResourceGroupName --name YourWebAppName --settings AZURE_OPENAI_SYSTEM_MESSAGE="You help people find information."

Replace:

This command sets the environment variable AZURE_OPENAI_SYSTEM_MESSAGE with the value "You help people find information." for your specified Azure Web App.

  1. Verify the Setting
    • After running the command, you can verify the environment variable setting using:

az webapp config appsettings list --resource-group YourResourceGroupName --name YourWebAppName --query "[?name=='AZURE_OPENAI_SYSTEM_MESSAGE'].[value]" --output table

This command lists the app settings (environment variables) for your Azure Web App YourWebAppName in YourResourceGroupName and filters specifically for AZURE_OPENAI_SYSTEM_MESSAGE.

Please find the attachments for your reference:

Screenshot 2024-07-05 182905 Screenshot 2024-07-05 183001 Screenshot 2024-07-05 183111

FYI @Roopan-Microsoft

djseng commented 4 days ago

@Prasanjeet-Microsoft azd (Azure Developer CLI) is not az (Azure CLI) ... azd is used heavily in this project's documentation to deploy and set environment variables for this project.