Skip to content

Latest commit

 

History

History
197 lines (87 loc) · 5.45 KB

README.md

File metadata and controls

197 lines (87 loc) · 5.45 KB

🧪 Lab 2 - Deploy to Cloud

We created a prototype of Microsoft Fabric in Lab 1 with Semantic Kernel and Qdrant. At this time, we need to implement the development of the Copilot application. At this time, we need to combine cloud applications to realize it. There is no doubt that Microsoft Azure will be the focus of Lab 2.

☁️ Introduce Cloud Native

Cloud native applications are built from the ground up—optimized for cloud scale and performance. They’re based on microservices architectures, use managed services, and take advantage of continuous delivery to achieve reliability and faster time to market.

In Copilot applications, we can fully integrate with cloud-native applications. In Lab 1, Qdrant is used locally in the form of containers, and we can deploy it in combination with Azure Kubernetes Service. For the interaction with the knowledge base, we can also publish it as a Serverless API through Azure Function.

statck

🛠️ Deploy Qdrant in Azure Kubernetes Service

🌪️ What is Azure Kubernetes Service

Azure Kubernetes Service (AKS) simplifies deploying a managed Kubernetes cluster in Azure by offloading the operational overhead to Azure. As a hosted Kubernetes service, Azure handles critical tasks, like health monitoring and maintenance. When you create an AKS cluster, a control plane is automatically created and configured. This control plane is provided at no cost as a managed Azure resource abstracted from the user. You only pay for and manage the nodes attached to the AKS cluster.

🌪️ Deploy

Prerequirement

  1. Install Azure CLI https://learn.microsoft.com/en-us/cli/azure/install-azure-cli

  2. Install Heml https://helm.sh/docs/intro/install/

  3. Apply Azure or Azure For Student

🏃‍♂️ Let's Go

  1. Clone GitHub Repo git clone https://github.com/Azure-Samples/qdrant-azure.git

  2. In Termianl

   
   az login

   az account set --subscription "Your Subscription"

   az group create --name "Azure Resource Group" --location "Azure Region"

   az sshkey create --name "qdrantSSHKey" --resource-group "AIGroup"
  1. Click go to AKS

  2. Follow this to finish AKS settings

AKS

  1. In Terminal
kubectl get nodes

cd YourQdrantOnAzureFolder/Azure-Kubernetes-Svc

helm install azqdrant-sk ./qdrant-on-azure --create-namespace
  1. Check your Qdrant on Azure , In terminal
kubectl get services

AKS

  1. The covered red part is the public address of our Qdrant on Azure. Congratulations, you have successfully deployed your Qdrant on Azure in the cloud. You can re-run the Notebook after modifying the Qdrant address connected to the Lab 1 Notebook Kernel
IKernel kernel = Kernel.Builder
            .WithAzureChatCompletionService("Your Deplpyment model name", "Azure OpenAI Endpoint", "Azure OpenAI Key")
            .WithAzureTextEmbeddingGenerationService("Your Deplpyment model name", "Azure OpenAI Endpoint", "Azure OpenAI Key")
            .WithQdrantMemoryStore("http://YourQdrantonAzureIP:6333", 1536)
            .Build();

🛠️ Azure Function

Azure Functions is a serverless solution that allows you to write less code, maintain less infrastructure, and save on costs. Instead of worrying about deploying and maintaining servers, the cloud infrastructure provides all the up-to-date resources needed to keep your applications running.

As shown in the above architecture diagram, we use Serverless as the interactive API of Copilot

🏃‍♂️ Let‘s go

  1. Go to ./code/lab2/MSFabricBots

  2. Change MSFabricBots.Funcs/appsettings.json in your Codespaces

{
    "AzureOpenAI": {
      "deployName": "Your GPT-3 ModelName",
      "endpoint": "Your Azure Endpoint",
      "apiKey": "Your Azure OpenAI Key",
      "embeddingDeployName": "Your Embedding Endpoint",
      "vectorDBEndpoint": "http://YourAKSEndPoint:6333",
      "memoryCollectionName":"fbkb-concept"
    }
}
  1. Open Terminal
cd ./code/lab2/MSFabricBots/MSFabricBots.Funcs

func host start
  1. Open your GitHub Codepsaces Thunder Client Extension

Run1

  1. In Azure Portal create Function App

func

  1. Go to your Azure Function , confirm your Configuration

func1

  1. In Your GitHub Codespaces , go to terminal
cd ./code/lab2/MSFabricBots/MSFabricBots.Funcs

func azure functionapp publish lukaoaifunc --csharp

func2

  1. Check it in your GitHub Codespaces Thunder Client Extension

run2

🔁 Continue

We have created the vector database and API through cloud native technology. Congratulations, you have completed the Copilot backend-based operation through Lab 2. In our Lab 3, we start from the front end

🪵 Resources

  1. Learn Azure Function Service

  2. Learn Azure Kubernetes Service