WhatTheHack/068-AzureOpenAIApps
Israel Ekpo 0fe93a05e7
[NEW HACK] 068-AzureOpenAIApps (#903)
* saving changes

* adding more samples for f02

* saving changes

* Saving changes to assistants

        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/application_settings.py
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/assistant_configurations/priscilla.txt
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/assistant_configurations/sarah.txt
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/assistant_configurations/solomon.txt
        new file:   Student/Resources/Challenge-00/ContosoAIAppsBackend/controllers/app_llm_quota_enforcement_manger.py
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/controllers/ask_esther.py
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/controllers/ask_miriam.py
        renamed:    Student/Resources/Challenge-00/ContosoAIAppsBackend/controllers/azure_blob.py -> Student/Resources/Challenge-00/ContosoAIAppsBackend/controllers/azure_blob_contoso_documents.py
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/controllers/azure_document_intelligence.py
        new file:   Student/Resources/Challenge-00/ContosoAIAppsBackend/controllers/azure_service_bus_grapefruit.py
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/controllers/azure_service_bus_lemon.py
        new file:   Student/Resources/Challenge-00/ContosoAIAppsBackend/controllers/azure_service_bus_orange.py
        new file:   Student/Resources/Challenge-00/ContosoAIAppsBackend/controllers/azure_service_bus_tangerine.py
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/controllers/contoso_yachts_data_pipeline.py
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/controllers/contoso_yachts_rest_service.py
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/function_app.py
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/local.settings.json.example
        new file:   Student/Resources/Challenge-00/ContosoAIAppsBackend/models/exam_submissions.py
        new file:   Student/Resources/Challenge-00/ContosoAIAppsBackend/models/meal_preferences.py
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/rest-api-yachts-management.http
        new file:   Student/Resources/Challenge-00/ContosoAIAppsBackend/shared/assistant_tools_common.py
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/shared/assistant_tools_esther.py
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/shared/assistant_tools_miriam.py
        new file:   Student/Resources/Challenge-00/ContosoAIAppsBackend/shared/assistant_tools_priscilla.py
        new file:   Student/Resources/Challenge-00/ContosoAIAppsBackend/shared/assistant_tools_sarah.py
        new file:   Student/Resources/Challenge-00/ContosoAIAppsBackend/shared/assistant_tools_solomon.py
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/shared/document_intelligence_utils.py
        new file:   Student/Resources/Challenge-00/ContosoAIAppsBackend/shared/grade_exam_submission.py
        new file:   Student/Resources/Challenge-00/ContosoAIAppsBackend/shared/quota_enforcement_manager.py
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/shared/redis_utils.py
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/shared/service_bus_utils.py
        new file:   Student/Resources/Challenge-00/ContosoAIAppsBackend/shared/yacht_management_utils.py

* saving changes

* saving sample documents

* saving changes

* Added Additional Submissions

        new file:   Student/Resources/Challenge-00/ContosoAIAppsBackend/challenge-artifacts/new-submissions/f01-grapefruit-nikki.pdf
        new file:   Student/Resources/Challenge-00/ContosoAIAppsBackend/challenge-artifacts/new-submissions/f01-lemon-george.pdf
        new file:   Student/Resources/Challenge-00/ContosoAIAppsBackend/challenge-artifacts/new-submissions/f01-tangerine-peter.pdf
        new file:   Student/Resources/Challenge-00/ContosoAIAppsBackend/challenge-artifacts/new-submissions/f02-grapefruit-david.pdf
        new file:   Student/Resources/Challenge-00/ContosoAIAppsBackend/challenge-artifacts/new-submissions/f02-orange-izzy.pdf
        new file:   Student/Resources/Challenge-00/ContosoAIAppsBackend/challenge-artifacts/new-submissions/f02-tangerine-kevin.pdf
        new file:   Student/Resources/Challenge-00/ContosoAIAppsBackend/challenge-artifacts/new-submissions/f03-lemon-nikki.pdf
        new file:   Student/Resources/Challenge-00/ContosoAIAppsBackend/challenge-artifacts/new-submissions/f03-orange-devanshi.pdf

* Adding Changes to AI Assistants

        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/assistant_configurations/priscilla.json
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/assistant_configurations/priscilla.txt
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/assistant_configurations/sarah.json
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/assistant_configurations/sarah.txt
        new file:   Student/Resources/Challenge-00/ContosoAIAppsBackend/controllers/ask_priscilla.py
        new file:   Student/Resources/Challenge-00/ContosoAIAppsBackend/controllers/ask_sarah.py
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/controllers/azure_document_intelligence.py
        new file:   Student/Resources/Challenge-00/ContosoAIAppsBackend/controllers/contoso_students_rest_service.py
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/controllers/contoso_yachts_data_pipeline.py
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/controllers/contoso_yachts_rest_service.py
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/document-intelligence-dictionary.json.example
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/function_app.py
        new file:   Student/Resources/Challenge-00/ContosoAIAppsBackend/models/activity_preferences.py
        deleted:    Student/Resources/Challenge-00/ContosoAIAppsBackend/models/meal_preferences.py
        new file:   Student/Resources/Challenge-00/ContosoAIAppsBackend/models/students.py
        new file:   Student/Resources/Challenge-00/ContosoAIAppsBackend/rest-api-students-management.http
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/shared/application_initialization_logic.py
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/shared/assistant_tools_priscilla.py
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/shared/assistant_tools_sarah.py
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/shared/crypto_utils.py
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/shared/document_intelligence_utils.py
        modified:   Student/Resources/Challenge-00/ContosoAIAppsBackend/shared/grade_exam_submission.py
        new file:   Student/Resources/Challenge-00/ContosoAIAppsBackend/shared/student_management_utils.py

* Update requirements.txt

* saving changes

* Update document-intelligence-dictionary.json

* Update document-intelligence-dictionary.json.example

* saving changes

* saving changes

* saving changes

* saving changes

* Update Challenge-04.md

* Update Challenge-05.md

* Add files via upload

* Update Challenge-05.md

* Update Challenge-05.md

* Add files via upload

* Update Challenge-05.md

* Update Challenge-05.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update Challenge-03.md

* Update Challenge-03.md

* Update Challenge-03.md

* Update Challenge-04.md

* Update Challenge-05.md

* Update Challenge-05.md

* Update Challenge-05.md

* Update Challenge-03.md

* Update Challenge-05.md

* Update Challenge-05.md

* Update Challenge-05.md

* Updated some text in the Coach guide and student guide

* Update Challenge-02.md

Typo

* Update Solution-00.md

* Update Solution-04.md

* Update Solution-04.md

* Update Solution-03.md

* Update Solution-05.md

* Update Solution-05.md

* Update Challenge-01.md

* Update Challenge-01.md

* Update Challenge-01.md

* Update Challenge-01.md

* Update Challenge-01.md

* Update Challenge-01.md

* Update Challenge-01.md

* Update Challenge-01.md

* Update Challenge-01.md

* Update Challenge-01.md

* Update Challenge-00.md

* Update Challenge-00.md

* Update rest-api-yachts-management.http

* Update rest-api-yachts-management.http

* Update Challenge-01.md

* Update Challenge-01.md

* saving changes

* adding documentation for AI Search

* Reformatting the frontend so that the input file is closer to the AI assistant avatar image

	modified:   ContosoAIAppsFrontend/src/app/ask-elizabeth/ask-elizabeth.component.html
	modified:   ContosoAIAppsFrontend/src/app/ask-esther/ask-esther.component.html
	modified:   ContosoAIAppsFrontend/src/app/ask-miriam/ask-miriam.component.html
	modified:   ContosoAIAppsFrontend/src/app/ask-priscilla/ask-priscilla.component.html
	modified:   ContosoAIAppsFrontend/src/app/ask-sarah/ask-sarah.component.html
	modified:   ContosoAIAppsFrontend/src/environments/environment.ts

* adding description to ai assistants

* Update Challenge-02.md

* Saving the assistant config for the coaches guide

  new file:   Coach/Solutions/assistant_configurations/elizabeth.json
        new file:   Coach/Solutions/assistant_configurations/elizabeth.txt
        new file:   Coach/Solutions/assistant_configurations/esther.json
        new file:   Coach/Solutions/assistant_configurations/esther.txt
        new file:   Coach/Solutions/assistant_configurations/miriam.json
        new file:   Coach/Solutions/assistant_configurations/miriam.txt
        new file:   Coach/Solutions/assistant_configurations/priscilla.json
        new file:   Coach/Solutions/assistant_configurations/priscilla.txt
        new file:   Coach/Solutions/assistant_configurations/sarah.json
        new file:   Coach/Solutions/assistant_configurations/sarah.txt
        new file:   Coach/Solutions/assistant_configurations/solomon.json
        new file:   Coach/Solutions/assistant_configurations/solomon.txt

* Update Challenge-03.md

* Update Challenge-02.md

* Update Challenge-02.md

* Update Challenge-02.md

* Update Challenge-02.md

* Update Challenge-03.md

* Update Challenge-02.md

* Update Challenge-02.md

* Update Challenge-00.md

updated language around capacity issues

* Update Challenge-00.md

updated clarification of which versions of the AOAI & ADI apis are available in which regions!

* Update Challenge-00.md

fixed broken URL

* Update Challenge-00.md

* Update Challenge-00.md

moved Capacity issues to hidden section.  Added proper markdown attribute to hidden section HTML tags.

* Update Solution-04.md

Added text on how to handle a 429 too many requests error

* Update Solution-04.md

* Update Challenge-00.md

* Update Challenge-00.md

* Update Challenge-01.md

* Update Challenge-00.md

* Update Challenge-01.md

* Update Challenge-01.md

* Update Challenge-03.md

* Update Challenge-03.md

* Update Challenge-03.md

* Update Challenge-03.md

* Update Solution-03.md

* Update Challenge-02.md

* Update Challenge-02.md

* Update Challenge-02.md

* Update Challenge-00.md

Clarified setup of frontend & backend

* Update Solution-00.md

updates to C0 coach guide

* added screenshot for C0 coach guide

* Update Solution-00.md

* Add files via upload

updated screenshot

* Delete 068-AzureOpenAIApps/images/open-codepsace-in-vscode.png

deleted old screenshot

* Update Solution-00.md

* Update Solution-00.md

* Add files via upload

added screenshot for managing multiple terminals

* Update Solution-00.md

added screenshot

* Update Solution-00.md

* Add files via upload

updated screenshot

* Update Solution-00.md

* Delete 068-AzureOpenAIApps/images/manage-multiple-terminals-vscode.png

deleted old screensho

* Update Challenge-00.md

removed TODO to explain how to open additional Terminal sessions in VS Code.  This will be in the coach guide.

* Update Solution-00.md

added capacity troubleshooting issues.

* Update Solution-00.md

Service Principal notes

* Update Challenge-00.md

added aka.ms link for Resources.zip

* Update Challenge-00.md

added 'infra' folder to Codespace inventory descriptioni

* Update Solution-00.md

added warning to C0 coach guide about Local Workstation instructions not being tested.

* Update Solution-00.md

added TOC

* Update Solution-00.md

* Update Challenge-00.md

* Add files via upload

added new screenshot for capacity error

* Update Solution-00.md

* Update miriam.json

Changed the name of the customer_email_address to customer_email

* Update .env.sample

* Added mapping to AI Design Win

Also added image to show how to restore quota

* Update README.md

* Update Challenge-00.md

* Update Challenge-00.md

Added instructions for local workstation for how to create a virtual environment for Python

* Update Challenge-01.md

deleted the creation of a container command, since all containers are created during deployment

* Update Challenge-03.md

making sure the document-intelligence-dictionary.json extractor model names match the bullet points

* Update Challenge-03.md

added the name of the file that contains the classifier model name

* Update Challenge-03.md

added more detailed instructions regarding document-intelligence-dictionary.json

* Update Challenge-03.md

added instructions regarding success criteria

* Update Challenge-04.md

added details about config file

* Update Challenge-02.md

* Update Challenge-02.md

testing extra line to fix table rendering in GH Pages

* Update Solution-00.md

* Update Solution-00.md

* Updating Question# as per feedback

Changed second question 4 to question 5

* Changed assistant names as per feedback

Elizabeth was changed to Donald
Esther was changed to Callum
Miriam was changed to Veta
Sarah was changed to Murphy

* Update Challenge-00.md

* Update Solution-00.md

* Updated assistant images

Added prompts for generation of assistant images

* Added instructions to update codespace timeout

* Updates for the coachs guide for CORS issue on front end

* Update Challenge-04.md

Clarify values for LLM_QUOTA_ENFORCEMENT

* Changed path for artifacts

* Remove .devcontainer and infra since they aren't needed here

* Added sequence for Priscilla

* Updated old name of assistant to new name in Markdown

Changed MIRIAM to VETA

* Updating markdown for Assistants that should be available

Priscilla and Murphy should be available in Challenge 0 - All others in Challenge 2

* added a description for the JSON tool

* Updated text for expected assistants

* Added message to clarify that the other assistants will not respond correctly.

* Update README.md

* Update README.md

Updated coach's guide from base template

* Create .wordlist.txt

initial commit of spell check white list for this hack

* Update Solution-00.md

Resolve spell check issues

* Update .wordlist.txt

* Update .wordlist.txt

* Update Solution-01.md

* Update Solution-02.md

resolved spelling issues with code blocks

* Update Solution-03.md

* Update .wordlist.txt

* Update README.md

* Update .wordlist.txt

* Update Challenge-00.md

* Update Challenge-00.md

* Update Challenge-01.md

* Update Challenge-01.md

Resolved spelling issues and placed variable names in backticks for clearer reading.

* Update Challenge-01.md

fixed bolding - part 1

* Update Challenge-01.md

fixed bolding part 2

* Update Challenge-00.md

* Update .wordlist.txt

* Update Challenge-02.md

Resolved spelling issues with mostly backtiks

* Update Challenge-02.md

* Update Challenge-03.md

* Update Challenge-03.md

resolved spelling issues with backticks

* Update Challenge-03.md

added descriptive text to the learning resource links

* Update Challenge-02.md

try to fix broken fence

* Update Challenge-04.md

resolved spelling errors and code blocks

* Update Challenge-04.md

Added descriptive text to learning resource links

* Update .wordlist.txt

* Update Challenge-05.md

resolve spelling issues and code block for code terms.

* Update Challenge-05.md

add descriptive text to Learning Resource links

* Update Challenge-05.md

resolve spelling issue

* Update Challenge-00.md

Clarified Cloud Shell usage

* Update Challenge-03.md

Made updates to remove references to when this hack had the students write code

* Update Challenge-01.md

grammar fixes part 1

* Update Challenge-01.md

* Update Challenge-01.md

* Update Challenge-01.md

* Update Challenge-02.md

* Update Challenge-02.md

upper cased all Python instances

* Update Challenge-02.md

fixed casing on yachts

* Update Challenge-02.md

* Update Challenge-02.md

updated text explaining how to use the REST Client to test and debug.

* Update Challenge-00.md

* Update Challenge-00.md

added note about WSL on Local Workstation

* Deleted Confluent content from this branch

* Update Challenge-02.md

fixed spelling issue

* reverted 066 file

* revert 066 file again

* reverting env.sample file

* revert .gitignore

* merged codepsace back in

* resolved spelling error

* created "new" version of C1

* resolved spelling issues.

* Update Challenge-03.md

Made a lot of changes to reflect that we now automated the uploading of documents to blob storage and also that we no longer expect the student to write code for this challenge.

* Update Challenge-04.md

Removed tips since we aren't expecting them to write code for this challenge anymore

* Update Challenge-05.md

* Update Challenge-04.md

* Update Challenge-03.md

* Update Challenge-05.md

* Updated C1-New, added new RAG images

* Update Challenge-03.md

resolved spelling issue

* Update .wordlist.txt

* Added "NEW" variant of homepage

* Update Challenge-01.md

* no message

* Initial commit of new hack home page so it can be compared to the old one.

* Update .wordlist.txt

* Updated C0 to reference the Citrus Bus application

* Updated C3 intro with context about the Citrus Bus app.

* Update Challenge-03.md

grammar

* Update Challenge-05.md

* old readme to README-OLD.md, new readme to README.md

* Removed OLD C1

* Update README.md

* Update Challenge-03.md

* Delete 068-AzureOpenAIApps/README-OLD.md

* Update Solution-01.md

* Update README.md

---------

Co-authored-by: Israel Ekpo <israel.ekpo@microsoft.com>
Co-authored-by: Pete Rodriguez <perktime@users.noreply.github.com>
Co-authored-by: Peter C. Laudati <plaudati@hotmail.com>
Co-authored-by: Devanshi Thakar <33441411+devanshithakar12@users.noreply.github.com>
Co-authored-by: Wayne Smith <weretygr@hotmail.com>
Co-authored-by: nikkiconley <nconley769@gmail.com>
Co-authored-by: Amanda Wong <wongamanda@uchicago.edu>
Co-authored-by: Pete Rodriguez <pedrorod@microsoft.com>
2024-11-15 14:22:55 -05:00
..
Coach [NEW HACK] 068-AzureOpenAIApps (#903) 2024-11-15 14:22:55 -05:00
Student [NEW HACK] 068-AzureOpenAIApps (#903) 2024-11-15 14:22:55 -05:00
images [NEW HACK] 068-AzureOpenAIApps (#903) 2024-11-15 14:22:55 -05:00
.wordlist.txt [NEW HACK] 068-AzureOpenAIApps (#903) 2024-11-15 14:22:55 -05:00
README.md [NEW HACK] 068-AzureOpenAIApps (#903) 2024-11-15 14:22:55 -05:00

README.md

What The Hack - Building AI Apps with Azure OpenAI and the Azure Ecosystem

Introduction

This hands-on set of challenges will provide participants with experience on how to integrate the Azure OpenAI service with Microsoft Azure platform services.

This hack assumes you a have basic understanding of generative AI fundamentals such as:

  • Prompt Engineering
  • Large & Small Language Model (LLM/SLM) Comparisons
  • Chunking & Embedding
  • Retrieval Augmented Generation (RAG)
  • Responsible AI Concepts

If you are just starting out with Azure OpenAI, we recommend you try the OpenAI Fundamentals What The Hack.

The architecture used by many generative AI applications is the Retrieval Augmented Generation (RAG) pattern. LLMs are trained with public data from the Internet. They do not have access to, or knowledge of your organization's data.

In an app using the RAG architecture pattern, the application retrieves information from a retrieval system that queries the organization's data. The application then provides that data to augment and ground a LLM with knowledge so that the LLM can generate content that returns an answer to the end user (often through a chatbot or virtual assistant interface).

RAG Architecture Pattern

Building AI applications on Microsoft Azure involves the following concerns:

  • Which LLM or SLM SKUs and versions do you need to use and why?
  • Automating data pipelines to ensure the organization's changing source data is available to application's retrieval system over time.
  • Data hygiene and ensuring that the organization's data is in the right format and optimized so that the LLM can respond properly to user queries.
  • Understanding how to configure and use a vector database, such as Azure AI Search, to power the retrieval system.
  • Optimizing costs by minimizing the amount of retrieved data sent to the LLM to answer user queries properly.
  • Maintaining state, controlling usage throughput, and storing relevant metadata to simplify user interaction with virtual agents. This requires use of queueing mechanisms, key-value, and document stores such as Azure Service Bus, Azure Redis Cache and Azure Cosmos DB.

Contoso Yachts and the Citrus Bus Application

Contoso Yachts is a 40-person organization that specializes in booking tours of the Contoso Islands. The customer service agents at Contoso Yachts use virtual assistants from their in-house developed "Citrus Bus" application to help their customers book tours and learn more about the islands.

As a major employer on the islands, Contoso Yachts has also expanded into the education vertical, extending their Citrus Bus application with advanced AI services to help educators on the island grade test scores.

In this hack, you will explore the architecture and configuration of the Citrus Bus application by getting hands-on and:

  • Loading the company's source data into a retrieval system through automation.
  • Configuring prompt engineering to enable virtual assistants to invoke functions and process user requests.
  • Configuring the underlying Azure AI platform services, like Document Intelligence, to parse and prepare the company's data for the LLM
  • Optimizing use of Azure OpenAI LLMs through caching.
  • Understanding the overall solution for how to address the various design concerns in a generative AI application.

Learning Objectives

The objective of the hack is to make participants aware and comfortable with the different strategies and scenarios for integrating the Azure Open AI service with Azure Platform products necessary to build, deploy and maintain highly performant AI applications in production.

The participants will learn how to:

  • Select different architectures to implement Open AI solutions on Azure based on the scenarios.
  • Understand when to use Open AI products and when to leverage Azure AI Services or other solutions
  • Provision and configure Azure Open AI resources.
  • Understand the different libraries, frameworks, capabilities and tools available to implement intelligent AI apps.
  • Implement Q&A virtual assistants using RAG architectures powered by vector stores, full text search and hybrid search.
  • Understand techniques and options available on Azure for processing and storing data used for implementing RAG architectures.
  • Perform capacity planning and quota enforcement for Open AI resources.
  • Easily observe what is taking place inside the deployed applications
  • Implement solutions for batch and near real-time use cases.

Challenges

Prerequisites

  • Access to an Azure subscription with Owner access
  • A GitHub account to use GitHub Codespaces as a developer workspace in the cloud OR
  • A local workstation with Visual Studio Code and other tools to run Python.

Contributors

We seize this opportunity to express our sincere gratitude to all our contributors that helped with the design and development of the content used for this hack.

We thank them for sharing their experience and creativity to design the scenarios and for taking the time to review the content that has been developed.