{"id":322,"date":"2023-04-25T08:14:14","date_gmt":"2023-04-25T15:14:14","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/semantic-kernel\/?p=322"},"modified":"2023-07-12T16:24:59","modified_gmt":"2023-07-12T23:24:59","slug":"the-power-of-persistent-memory-with-semantic-kernel-and-qdrant-vector-database","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/agent-framework\/the-power-of-persistent-memory-with-semantic-kernel-and-qdrant-vector-database\/","title":{"rendered":"The Power of Persistent Memory with Semantic Kernel and Qdrant Vector Database"},"content":{"rendered":"<p><a href=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/03\/skpatternmedium.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-90\" src=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/03\/skpatternmedium.png\" alt=\"Image skpatternmedium\" width=\"1364\" height=\"137\" srcset=\"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/03\/skpatternmedium.png 1364w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/03\/skpatternmedium-300x30.png 300w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/03\/skpatternmedium-1024x103.png 1024w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/03\/skpatternmedium-768x77.png 768w\" sizes=\"(max-width: 1364px) 100vw, 1364px\" \/><\/a><\/p>\n<p>A key component of leveraging machine learning large languages models (LLM) for natural language processing (NLP) in applications for chat search like ChatGPT, ranking and recommendation engines, anomaly detection, and semantic search is the ability to leverage massive amounts of unstructured data for search.<\/p>\n<h2>But where would we save and retrieve all the unstructured data that powers these applications?<\/h2>\n<p>This is where vector databases enters the AI room. In order to efficiently and effectively, search, index, and store this unstructured data stored as embeddings, vector databases have risen to the challenge.<\/p>\n<p>Combining a vector database, the cloud, and a framework like Semantic Kernel becomes a powerful combination in building Generative AI applications. So, let\u2019s take a journey on how to use the semantic search and vector database, <a href=\"http:\/\/qdrant.tech\">Qdrant<\/a>, running on Azure cloud and integrated with Semantic Kernel to enable a generative AI solution.<\/p>\n<p>Like any journey, preparation is key. Therefore, before starting we need to review our checklist to ensure that all the bases are covered:<\/p>\n<ol>\n<li>Is there a valid Azure Subscription that can be used? No worries if there is not an Azure subscription at your disposable, a free Azure subscription can be created by going to <a href=\"https:\/\/azure.microsoft.com\/en-us\/free\/\">Create Your Azure Free Account Today | Microsoft Azure<\/a><\/li>\n<li>Am I successfully logged into the Azure Subscription that will be used?<\/li>\n<li>Do I have permissions and scope set up in the Azure Subscription I have access to, to create a resource group and create resources like AKS? This is a big one, in working with customers we\u2019ve found that the not having the correct permissions and scopes has been the biggest challenge when deploying solutions. In starting off this journey in the correct way, it\u2019s essential to check if your account has the correct access.<\/li>\n<\/ol>\n<p><a href=\"https:\/\/github.com\/Azure-Samples\/qdrant-azure\"><img decoding=\"async\" class=\"alignnone wp-image-401 size-full\" src=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/04\/Screenshot-2023-04-26-at-12.39.56-PM.png\" alt=\"Qdrant + Azure \" width=\"1678\" height=\"954\" srcset=\"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/Screenshot-2023-04-26-at-12.39.56-PM.png 1678w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/Screenshot-2023-04-26-at-12.39.56-PM-300x171.png 300w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/Screenshot-2023-04-26-at-12.39.56-PM-1024x582.png 1024w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/Screenshot-2023-04-26-at-12.39.56-PM-768x437.png 768w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/Screenshot-2023-04-26-at-12.39.56-PM-1536x873.png 1536w\" sizes=\"(max-width: 1678px) 100vw, 1678px\" \/><\/a><\/p>\n<p>Once you have navigated to the GitHub repo, the repo should be cloned using the method you are most comfortable with. I\u2019m a command line type of person, so I do this by executing the following command in bash shell:<\/p>\n<p><code class=\"language-default\">% git clone https:\/\/github.com\/Azure-Samples\/qdrant-azure.git<\/code><\/p>\n<p>Now that the repo is cloned, let\u2019s create a Azure resource group to put the resources to be created to run Qdrant in the Azure cloud. I do with the Azure CLI in bash by issuing command:<\/p>\n<p><code>% az group create --name az-qdrant-sk-rg --location eastus<\/code><\/p>\n<p>It will return a JSON snippet if successful:<\/p>\n<p><code>{<br\/>\n\"id\": \"\/subscriptions\/...<br\/>\n&nbsp;&nbsp;&nbsp;...<br\/>\n&nbsp;&nbsp;&nbsp;\"type\": ...<br\/>\n}<\/code><\/p>\n<p>Alternatively, an Azure resource group could be easily created in the Azure Portal as well.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/04\/AzureResourceGroupPortal-1.png\"><img decoding=\"async\" class=\"wp-image-351 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/04\/AzureResourceGroupPortal-1.png\" alt=\"Image AzureResourceGroupPortal 1\" width=\"534\" height=\"292\" srcset=\"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/AzureResourceGroupPortal-1.png 1538w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/AzureResourceGroupPortal-1-300x164.png 300w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/AzureResourceGroupPortal-1-1024x560.png 1024w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/AzureResourceGroupPortal-1-768x420.png 768w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/AzureResourceGroupPortal-1-1536x840.png 1536w\" sizes=\"(max-width: 534px) 100vw, 534px\" \/><\/a><\/p>\n<p>Let\u2019s also create an Azure SSHKey that we will need later for deployment. Create an Azure SSH key in the Resource group created in the previous step by executing the following command<\/p>\n<p><code><strong>% <\/strong>az sshkey create --name \"qdrantSSHKey\" --resource-group \"&lt;<em>INSERT YOUR ResourceGroup<\/em>&gt;\"<\/code><\/p>\n<p>via the command line or via Azure Cloud Shell. Again, a JSON snippet will be returned of the form:<\/p>\n<p><code>{<br\/>\n&nbsp;&nbsp;&nbsp;\"id\": \"\/subscriptions\/...<br\/>\n&nbsp;&nbsp;&nbsp;...<br\/>\n&nbsp;&nbsp;&nbsp;\"type\": null<br\/>\n}<\/code><\/p>\n<p>Congratulations! You&#8217;ve created an SSHKey in Azure within your Resource Group.<\/p>\n<h2>Looks like we\u2019re off to the races &#8230;<\/h2>\n<p>Next stop, we will got back the <a href=\"http:\/\/github.com\/Azure-Samples\/qdrant-azure\">Qdrant on Azure GitHub repo<\/a> we pulled up in the browser. On the README in the repo, is an ARM (Azure Resource Manager) button.<\/p>\n<p>Click the ARM button, <strong>Deploy to Azure<\/strong>, to create an Kubernetes cluster in Azure to run Qdrant. <strong>Note<\/strong>: <strong><em>If you already have a AKS cluster set up or a K8s cluster running locally you can skip this step. <\/em><\/strong><\/p>\n<p>A Custom Deployment screen will open up in Azure Portal. Use the dropdown for <strong>Resource group<\/strong> to select the Azure Resource group we created previously. Add a value\/name for <strong>DNS Prefix<\/strong>, and lastly under the SSH public key source option select the <strong>Use an existing key stored in Azure <\/strong>option. Select the Azure SSHKey that was created in the earlier in our journey.<a href=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/04\/QdrantAzureTemplate-1.png\"><img decoding=\"async\" class=\"wp-image-356 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/04\/QdrantAzureTemplate-1.png\" alt=\"Image QdrantAzureTemplate 1\" width=\"666\" height=\"629\" srcset=\"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/QdrantAzureTemplate-1.png 1432w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/QdrantAzureTemplate-1-300x283.png 300w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/QdrantAzureTemplate-1-1024x967.png 1024w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/QdrantAzureTemplate-1-768x725.png 768w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/QdrantAzureTemplate-1-24x24.png 24w\" sizes=\"(max-width: 666px) 100vw, 666px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>A Custom Deployment screen will open up in Azure Portal. Use the dropdown for <strong>Resource group<\/strong> to select the Azure Resource group we created previously. Add a value\/name for <strong>DNS Prefix<\/strong>, and lastly under the SSH public key source option select the <strong>Use an existing key stored in Azure <\/strong>option.\u00a0Select the Azure SSHKey that was created in the earlier in our journey in the <strong>Stored Keys<\/strong> dropdown.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/04\/QdrantCustomTemplate.png\"><img decoding=\"async\" class=\"wp-image-336 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/04\/QdrantCustomTemplate.png\" alt=\"Image QdrantCustomTemplate\" width=\"626\" height=\"811\" srcset=\"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/QdrantCustomTemplate.png 1205w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/QdrantCustomTemplate-232x300.png 232w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/QdrantCustomTemplate-790x1024.png 790w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/QdrantCustomTemplate-768x995.png 768w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/QdrantCustomTemplate-1186x1536.png 1186w\" sizes=\"(max-width: 626px) 100vw, 626px\" \/><\/a><\/p>\n<p>Select <strong>Review + Create<\/strong> button, to Validate your deployment and all that is left here is to select <strong>Create<\/strong> button deploy your AKS cluster for Qdrant.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/04\/AzureTemplateValidation-1.png\"><img decoding=\"async\" class=\"wp-image-357 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/04\/AzureTemplateValidation-1.png\" alt=\"Image AzureTemplateValidation 1\" width=\"766\" height=\"536\" srcset=\"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/AzureTemplateValidation-1.png 1851w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/AzureTemplateValidation-1-300x210.png 300w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/AzureTemplateValidation-1-1024x717.png 1024w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/AzureTemplateValidation-1-768x538.png 768w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/AzureTemplateValidation-1-1536x1075.png 1536w\" sizes=\"(max-width: 766px) 100vw, 766px\" \/><\/a><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/04\/AzureTemplateDeployment-1.png\"><img decoding=\"async\" class=\"wp-image-358 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/04\/AzureTemplateDeployment-1.png\" alt=\"Image AzureTemplateDeployment 1\" width=\"809\" height=\"373\" srcset=\"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/AzureTemplateDeployment-1.png 2078w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/AzureTemplateDeployment-1-300x138.png 300w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/AzureTemplateDeployment-1-1024x472.png 1024w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/AzureTemplateDeployment-1-768x354.png 768w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/AzureTemplateDeployment-1-1536x707.png 1536w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/AzureTemplateDeployment-1-2048x943.png 2048w\" sizes=\"(max-width: 809px) 100vw, 809px\" \/><\/a><\/p>\n<h2>We\u2019re almost at the end of our journey, only 2 steps remain &#8230;<\/h2>\n<p>First is to ensure <strong>Qdrant<\/strong> is deployed to our AKS cluster by running the Helm chart located in the <strong>Qdrant Azure Github repo<\/strong> we cloned earlier and the second is to tie <strong>Qdrant<\/strong> vector database to the Semantic Kernel.<\/p>\n<p>To accomplish the first step, go to the location you cloned the repo. From the root directory of the repo, change to the directory <strong>Azure-Kubernetes-Svc<\/strong>. We\u2019re going to run commands to get the AKS credentials stored locally and to execute the Helm chart. Don\u2019t worry, if those words are foreign to you; there are scripts that will do all the heavy lifting for you.<\/p>\n<p>To get the tools, <strong>Kubectl<\/strong> and <strong>Helm<\/strong>, needed to get your <strong>Qdrant<\/strong> instance running correctly, follow the instructions provided in repo here: <a href=\"https:\/\/github.com\/Azure-Samples\/qdrant-azure\/tree\/main\/Azure-Kubernetes-Svc#prerequisites\">https:\/\/github.com\/Azure-Samples\/qdrant-azure\/tree\/main\/Azure-Kubernetes-Svc#prerequisites<\/a><\/p>\n<p>Now, that we\u2019ve got the tools and ready to rock and roll, let&#8217;s start deploying Qdrant to our AKS cluster. Issue the following command on the command line using Azure CLI:<\/p>\n<p><code>% az aks get-credentials --resource-group <em><strong>&lt;your-resource-group-name&gt;<\/strong><\/em> --name azqdrantcluster<\/code><strong><code>\n<\/code><\/strong><span style=\"font-size: 10pt;\"><em>**if you used the template, azqdrantcluster will be the name of your AKS cluster**<\/em><\/span><\/p>\n<p>Then execute the following <strong>Kubectl<\/strong> command on the command line: <code><\/code><\/p>\n<p><code>% kubectl get nodes<\/code><\/p>\n<p>This will verify that you can access your cluster and it\u2019s running successfully.<\/p>\n<p>Finally, let\u2019s get Qdrant humming on your cluster. Navigate to the <strong>qdrant-on-azure<\/strong> folder and run the following command. <code><\/code><\/p>\n<p><code>% helm install azqdrant-sk ..\/qdrant-on-azure\/ --create-namespace<\/code><\/p>\n<p>or for a custom namespace you can run<code><\/code><\/p>\n<p><code>% helm install azqdrant-sk ..\/qdrant-on-azure --namespace test-namespace --create-namespace<\/code><\/p>\n<p>And voil\u00e0 we have <strong>Qdrant<\/strong> running on <strong>Azure<\/strong>.<\/p>\n<p>Let&#8217;s get the IP address that will be used for Qdrant API calls by running: <strong><code>kubectl get services<\/code><\/strong>. Make sure to copy the <strong>External-IP<\/strong> of the <strong>azure-qdrant-loadbalancer<\/strong> as this will be needed in our final step in using <strong>Qdrant<\/strong> with the Semantic Kernel. See screenshots below for an example.<\/p>\n<p style=\"text-align: center;\"><strong><em>default namespace<\/em><\/strong><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/04\/AKSServicesDefaultNamespace-1.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-359\" src=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/04\/AKSServicesDefaultNamespace-1.png\" alt=\"Image AKSServicesDefaultNamespace 1\" width=\"2766\" height=\"1276\" srcset=\"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/AKSServicesDefaultNamespace-1.png 2766w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/AKSServicesDefaultNamespace-1-300x138.png 300w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/AKSServicesDefaultNamespace-1-1024x472.png 1024w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/AKSServicesDefaultNamespace-1-768x354.png 768w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/AKSServicesDefaultNamespace-1-1536x709.png 1536w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/AKSServicesDefaultNamespace-1-2048x945.png 2048w\" sizes=\"(max-width: 2766px) 100vw, 2766px\" \/><\/a><\/p>\n<p style=\"text-align: center;\"><strong><em>with custom namespace<\/em><\/strong><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/04\/AKSServicesCustomNamespace-1.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-360\" src=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/04\/AKSServicesCustomNamespace-1.png\" alt=\"Image AKSServicesCustomNamespace 1\" width=\"2811\" height=\"445\" srcset=\"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/AKSServicesCustomNamespace-1.png 2811w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/AKSServicesCustomNamespace-1-300x47.png 300w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/AKSServicesCustomNamespace-1-1024x162.png 1024w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/AKSServicesCustomNamespace-1-768x122.png 768w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/AKSServicesCustomNamespace-1-1536x243.png 1536w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/AKSServicesCustomNamespace-1-2048x324.png 2048w\" sizes=\"(max-width: 2811px) 100vw, 2811px\" \/><\/a><\/p>\n<p>I was always taught that it&#8217;s better to be safe than sorry in both engineering and in life. Therefore, let&#8217;s make sure that the Qdrant instance is functional and running as desired by creating a test collection. To test that <strong>Qdrant<\/strong> is running successfully, run the following command on the command line:<\/p>\n<p><code>% curl -X PUT <\/code><code><span class=\"hljs-string\">'http:\/\/<strong><em>&lt;your QDRANT-LOADBALANCER-EXTERNALIP-ADDRESS&gt;<\/em><\/strong>:6333\/collections\/test_collection'<\/span> \\ -H <span class=\"hljs-string\">'Content-Type: application\/json'<\/span> \\ --data-raw <span class=\"hljs-string\">'{ \"vectors\": { \"size\": 4, \"distance\": \"Dot\" } }'<\/span><\/code><\/p>\n<p>If this executes correctly you should see a json payload that shows something similar to:\u00a0 <code>{\"result\":true,\"status\":\"ok\",\"time\":0.407534142} <\/code><\/p>\n<p>See screenshot below for an example of the successful creation of your test <strong>Qdrant<\/strong> collection.<\/p>\n<p style=\"text-align: center;\"><code><\/code><strong style=\"text-align: center; font-size: 1rem;\"><em>testing of Qdrant creation of collection<\/em><\/strong><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/04\/QdrantAKSTestCollection-1.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-385\" src=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/04\/QdrantAKSTestCollection-1.png\" alt=\"Image QdrantAKSTestCollection 1\" width=\"2508\" height=\"403\" srcset=\"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/QdrantAKSTestCollection-1.png 2508w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/QdrantAKSTestCollection-1-300x48.png 300w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/QdrantAKSTestCollection-1-1024x165.png 1024w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/QdrantAKSTestCollection-1-768x123.png 768w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/QdrantAKSTestCollection-1-1536x247.png 1536w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/QdrantAKSTestCollection-1-2048x329.png 2048w\" sizes=\"(max-width: 2508px) 100vw, 2508px\" \/><\/a><\/p>\n<h2>Wow, we\u2019re at the final leg of our journey and we\u2019ve found our way to the Semantic Kernel with our <strong>Qdrant<\/strong> IP address in hand &#8230;<\/h2>\n<p>Go to the GitHub repo for the <strong>Semantic Kernel<\/strong> located here: <a href=\"https:\/\/github.com\/microsoft\/semantic-kernel\">https:\/\/github.com\/microsoft\/semantic-kernel<\/a>. Clone the repo using your method of choice for Git. Follow the steps noted in the readme to setup the semantic kernel.<\/p>\n<p>Now that we\u2019re all setup, we can run the sample for using <strong>Qdrant<\/strong> Memory with the Semantic Kernel. Go the folder named <strong>kernel-syntax-examples<\/strong> by navigating to: <strong>semantic-kernel\/samples\/dotnet\/kernel-syntax-examples\/ <\/strong>from the location\/directory you cloned the Semantic Kernel repo. Under that folder should see a C# project files and a list of code files with the heading Examples.<\/p>\n<p>Open up the <strong>KernelSyntaxExamples.csproj<\/strong> project in an IDE like <a href=\"https:\/\/code.visualstudio.com\/\">Visual Studio Code<\/a> and look for <strong>Example19_Qdrant.cs<\/strong>. This is the sample that will be run with the <strong>Qdrant <\/strong>instance we created.<\/p>\n<p>To set up the environment variables needed to run the sample, grab your <strong>OpenAI API key<\/strong> from your <strong>OpenAI<\/strong> account from <a href=\"https:\/\/platform.openai.com\/account\/api-keys\">https:\/\/platform.openai.com\/account\/api-keys<\/a> or from your Azure subscription&#8217;s <a href=\"https:\/\/azure.microsoft.com\/en-us\/products\/cognitive-services\/openai-service\/\">Azure OpenAI Service.<\/a> Also have in hand, the <strong>Qdrant External IP <\/strong>address we obtained earlier from <strong>Qdrant<\/strong> instance. Run the following commands on the command line:<\/p>\n<p><code>% dotnet user-secrets set \"OPENAI_API_KEY\" \"<strong><em>&lt;Insert your OpenAI API Key<\/em>&gt;<\/strong>\u201d<\/code><\/p>\n<p><code>% dotnet user-secrets set \"QDRANT_ENDPOINT\" \"http:\/\/<strong><em>&lt;Insert your Qdrant External-IP address<\/em><\/strong>&gt;\"<\/code><\/p>\n<p><code>% dotnet user-secrets set \"QDRANT_PORT\" \"6333\"<\/code><\/p>\n<p>In your open project, go to the <strong>Program.cs<\/strong> file to the Program class, you will see a list of the examples available. Comment out (or remove) all the samples except for the command for the <strong>Example19_Qdrant.cs<\/strong> sample which is the code line <span style=\"font-size: 1rem; text-align: var(--bs-body-text-align);\"><code>await Example19_Qdrant.RunAsync();<\/code> in the <strong>Program<\/strong> class. <\/span><\/p>\n<p><span style=\"font-size: 1rem; text-align: var(--bs-body-text-align);\">See screenshots as a visual of what this will look like in Visual Studio Code.<\/span><\/p>\n<p><span style=\"font-size: 1rem; text-align: var(--bs-body-text-align);\">\n<a href=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/04\/SK-Program-csfile-1.png\"><img decoding=\"async\" class=\"wp-image-392 aligncenter\" src=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/04\/SK-Program-csfile-1.png\" alt=\"Image SK Program csfile 1\" width=\"830\" height=\"468\" srcset=\"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/SK-Program-csfile-1.png 3200w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/SK-Program-csfile-1-300x169.png 300w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/SK-Program-csfile-1-1024x578.png 1024w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/SK-Program-csfile-1-768x433.png 768w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/SK-Program-csfile-1-1536x866.png 1536w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/SK-Program-csfile-1-2048x1155.png 2048w\" sizes=\"(max-width: 830px) 100vw, 830px\" \/><\/a>\n<\/span><\/p>\n<p>Build\/Compile the code and run the sample. You have now successfully implemented <strong>Qdrant<\/strong> with the <strong>Semantic Kernel<\/strong>.<\/p>\n<h2>Thanks for taking the ride with me.<\/h2>\n<table style=\"border-collapse: collapse; width: 100%;\">\n<tbody>\n<tr>\n<td style=\"width: 15%;\"><a href=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/04\/tara.png\"><img decoding=\"async\" class=\"alignnone wp-image-220\" src=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/04\/tara-150x150.png\" alt=\"Image tara\" width=\"100\" height=\"100\" srcset=\"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/tara-150x150.png 150w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/tara-24x24.png 24w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/tara-48x48.png 48w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/tara-96x96.png 96w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/04\/tara.png 256w\" sizes=\"(max-width: 100px) 100vw, 100px\" \/><\/a><\/td>\n<td style=\"width: 85%;\"><strong>Tara E. Walker<\/strong>, Principal Software Engineer @Microsoft<\/p>\n<p><em>Tara is a Principal Software Engineer in the Office of the CTO (OCTO) developing solutions using the latest AI\/ML workloads and cutting edge technologies at scale including Cloud Computing\/Cloud Native and Robotics. Prior to Microsoft she was at AWS and Turner Broadcasting\/Time Warner.<\/em><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/03\/skpatternsmallbw.png\"><img decoding=\"async\" class=\"alignnone size-full wp-image-92\" src=\"https:\/\/devblogs.microsoft.com\/semantic-kernel\/wp-content\/uploads\/sites\/78\/2023\/03\/skpatternsmallbw.png\" alt=\"Image skpatternsmallbw\" width=\"1211\" height=\"137\" srcset=\"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/03\/skpatternsmallbw.png 1211w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/03\/skpatternsmallbw-300x34.png 300w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/03\/skpatternsmallbw-1024x116.png 1024w, https:\/\/devblogs.microsoft.com\/agent-framework\/wp-content\/uploads\/sites\/78\/2023\/03\/skpatternsmallbw-768x87.png 768w\" sizes=\"(max-width: 1211px) 100vw, 1211px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A key component of leveraging machine learning large languages models (LLM) for natural language processing (NLP) in applications for chat search like ChatGPT, ranking and recommendation engines, anomaly detection, and semantic search is the ability to leverage massive amounts of unstructured data for search. But where would we save and retrieve all the unstructured data [&hellip;]<\/p>\n","protected":false},"author":117489,"featured_media":370,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[17,1,19],"tags":[],"class_list":["post-322","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-announcements","category-semantic-kernel","category-vector-database"],"acf":[],"blog_post_summary":"<p>A key component of leveraging machine learning large languages models (LLM) for natural language processing (NLP) in applications for chat search like ChatGPT, ranking and recommendation engines, anomaly detection, and semantic search is the ability to leverage massive amounts of unstructured data for search. But where would we save and retrieve all the unstructured data [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/posts\/322","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/users\/117489"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/comments?post=322"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/posts\/322\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/media\/370"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/media?parent=322"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/categories?post=322"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/agent-framework\/wp-json\/wp\/v2\/tags?post=322"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}