Application Runtime: Setting Up Demo App

Page content

  1. Set last variable and validate your .env file
  2. Create demo application .env file
  3. Installing demo application dependencies
  4. Start the demo app
  5. Try the demo app

1. Set last variable and validate your .env file

We need an Azure Blob SAS token so the demo app can pull relevant images whenever they are identified in the query response. Run the following command:


bash ./helper.sh get-blob-sas

Verify Environment Variables

Let’s verify that all necessary variables are set for the demo app to be configured successfully. Run the command below and ensure that every variable appears in your output as shown in the example below.

Command:


cat .env

Example output:

AZURE_OPENAI_ENDPOINT=<endpoint-url>
AZURE_OPENAI_KEY=<key-1-value>
AZURE_OPENAI_CHATGPT_EMBEDDING_DEPLOYMENT=aoai-rag-oyd-embedding
AZURE_OPENAI_CHATGPT_EMBEDDING_MODEL_NAME=<embedding-model-name>
AZURE_OPENAI_CHATGPT_DEPLOYMENT=aoai-rag-oyd-chat
AZURE_OPENAI_API_VERSION=<chat-model-api-version>
search_service_name=<service-name>
base_url=<url>
search_service_key=<primary-admin-key>
storage_account_name=<storage-account-name>
subscription_id=<subscription-id>
function_app=<function-app-name>
func_storage_account_name=<func-storage-account-name>
sas_token=<azure-blob-sas-token>

2. Create demo application .env file

Create .env file for the demo app


bash ./helper.sh create-dot-env-demo-app

The .env file for the demo app is located in the ./demo-app directory. Run the following command to validate that the file was created successfully and contains all the required variables with assigned values.

Command:


cat .env

Example output:

AZURE_OPENAI_ENDPOINT=https://la-openai-test.openai.azure.com/
AZURE_OPENAI_KEY=ca2195a42c5e4714ac9b2b49bb52aab6
AZURE_OPENAI_CHATGPT_DEPLOYMENT=test-gpt4o
AZURE_OPENAI_API_VERSION=2024-04-01-preview
AZURE_OPENAI_CHATGPT_EMBEDDING_DEPLOYMENT=embedding-model
SEARCH_ENDPOINT=https://6sglalvnynqxsservice.search.windows.net
SEARCH_INDEX=search-aoai-emb
SEARCH_API_KEY=tKETEOqUBp6bfmiDVKPIXgZ92u2DSWzdERZ8Yjpn2QAzSeBYZjmW
SEARCH_SEMANTIC_CONFIGURATION=search-aoai-emb-semantic-configuration
SEARCH_QUERY_TYPE=vector_semantic_hybrid
BLOB_SAS_TOKEN="<azure-blob-sas-token>"

3. Installing demo application dependencies

Install demo app python dependencies


bash ./helper.sh install-demo-app-dependencies

4. Start the demo app

Run the demo app.


bash ./helper.sh run-demo-app

A clear sign your application is running successfully is when you see output similar to the following:

You can now view your Streamlit app in your browser.

Local URL: http://localhost:8501
Network URL: http://<IP-ADDRESS>:8501
External URL: http://<IP-ADDRESS>:8501

5. Try the demo app

Open the demo app in your browser http://localhost:8501. In chat window, type “Tell me about Kubernetes”. You should see a response and an overall demo app UI view similar to the image below.

Upon successful chat query response, you should be a text response with an image, a high level archtecture about AKS similar to the image shown below.

Note

The Tokens per Minute Rate Limit for both models was not configured to be very high. If you experience throttling while interacting with your documents and encounter errors with messages similar to the one below, consider increasing the rate limits for each model to resolve the issue. For more information about quotas, refer to manage Azure OpenAI Service quota.

{
   "error" : {
      "code" : "429",
      "message" : "Rate limit is exceeded. Try again in 2 seconds."
   }
}
drawing

Congratulations! You successfully executed end-to-end demo, and the request made through each component of the solution. Ab next, you’ll learn how to extend it and bring your own data.


Β« Application Runtime: Overview | Application Runtime: Extending With Your Own PDF Β»