Skip to content

2.7 Configure Env Variables

We are now ready to start coding the chat AI application in our local development environment. But to do this, we need to configure a few environment variables.


1. Create .env file

  1. Start by copying the .env.sample file to .env
1
cp .env.sample .env
  1. Let's review what this contains
1
cat .env

You will see something like this:

1
2
3
4
5
6
AIPROJECT_CONNECTION_STRING=<your-connection-string>
AISEARCH_INDEX_NAME="contoso-products"
EMBEDDINGS_MODEL="text-embedding-ada-002"
INTENT_MAPPING_MODEL="gpt-4o-mini"
CHAT_MODEL="gpt-4o-mini"
EVALUATION_MODEL="gpt-4o-mini"

2. Update Connection String

Note that defaults are provided for everything except the AIPROJECT_CONNECTION_STRING - let's fix that now!

  1. Open the Azure AI Project overview page. It should look like this:

    Project

  2. Look for the Project connection string under the Project details tab.

  3. Copy that into .env as the AIPROJECT_CONNECTION_STRING value.
  4. Save the changes to .env

3. Review Environment Variables

Let's review our environment variables:

  1. AIPROJECT_CONNECTION_STRING - is a single connection URI that allows access to all the Connected Resources in the Azure AI project (including Azure AI Search).
  2. AISEARCH_INDEX_NAME - is set to contoso-products and represents the index name that we will create and populate with product catalog data.
  3. EMBEDDINGS_MODEL - the deployed model we'll use for vectorizing queries (see: Ideate 3.2)
  4. INTENT_MAPPING_MODEL - the deployed model we'll use for intent mapping (see: Ideate 3.4)
  5. CHAT_MODEL - the deployed model we'll use for final chat response (see: Ideate 3.6)
  6. EVALUATION_MODEL - the deployed model we'll use for quality evaluation (see: Evaluate 4.3)

CONGRATULATIONS! Your local environment is configured for code!