<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Hemendra Singh on Medium]]></title>
        <description><![CDATA[Stories by Hemendra Singh on Medium]]></description>
        <link>https://medium.com/@hamusingh?source=rss-ae3e9376d47d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*NNbzKSAaDjLTrd9KqwiwAA.png</url>
            <title>Stories by Hemendra Singh on Medium</title>
            <link>https://medium.com/@hamusingh?source=rss-ae3e9376d47d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 08:04:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@hamusingh/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Zero-shot Learning Text Classification using Azure OpenAI Chat Bot]]></title>
            <link>https://medium.com/@hamusingh/zero-shot-learning-text-classification-using-azure-openai-chat-bot-152bfd46598d?source=rss-ae3e9376d47d------2</link>
            <guid isPermaLink="false">https://medium.com/p/152bfd46598d</guid>
            <category><![CDATA[classification]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Hemendra Singh]]></dc:creator>
            <pubDate>Fri, 16 Aug 2024 11:53:36 GMT</pubDate>
            <atom:updated>2024-08-16T11:53:36.173Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/256/1*N_nvtJ5sUT-TvV3ZpezxIg.png" /></figure><h3><strong>Pre-read</strong>:</h3><p>If you want to know, how to deploy the Chat Bot using Azure OpenAI with RAG support, please refer to the article below. <a href="https://medium.com/@hamusingh/creating-a-llm-based-chat-bot-with-rag-support-for-custom-own-data-using-azure-openai-508f5cc43af8">https://medium.com/@hamusingh/creating-a-llm-based-chat-bot-with-rag-support-for-custom-own-data-using-azure-openai-508f5cc43af8</a></p><h3><strong>Introduction:</strong></h3><p>Zero-shot classification is a pattern where a model can classify new, unseen examples that belong to classes that were not present in the training data.</p><p>In Zero-shot classification, we provide the model with a prompt and a sequence of texts that describes what we want our model to do, in natural language. Zero-shot classification excludes any examples of the desired task being completed. This differs from single or few-shot classification, as these tasks include a single or a few examples of the selected task.</p><h3>Testing the response in Azure OpenAI Studio:</h3><p>Assuming the Azure OpenAI chat bot has already been setup (Available in the pre-read), we can input a text classification question as given below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*zRPPbzxAAaTlklu-ej2ceg.png" /></figure><p>Below is the JSON response for the above chat with the chat bot.</p><pre>[<br> {<br>  &quot;role&quot;: &quot;system&quot;,<br>  &quot;content&quot;: [<br>   {<br>    &quot;type&quot;: &quot;text&quot;,<br>    &quot;text&quot;: &quot;You are an AI assistant that helps people find information.&quot;<br>   }<br>  ]<br> },<br> {<br>  &quot;role&quot;: &quot;user&quot;,<br>  &quot;content&quot;: [<br>   {<br>    &quot;type&quot;: &quot;text&quot;,<br>    &quot;text&quot;: &quot;Classify the following into the type of visit. It can either be Business or Pleasure.&quot;<br>   },<br>   {<br>    &quot;type&quot;: &quot;text&quot;,<br>    &quot;text&quot;: &quot;1. Sam visited the US for an official visit and meeting.&quot;<br>   },<br>   {<br>    &quot;type&quot;: &quot;text&quot;,<br>    &quot;text&quot;: &quot;Visit Type: ?&quot;<br>   },<br>   {<br>    &quot;type&quot;: &quot;text&quot;,<br>    &quot;text&quot;: &quot;2. Frank visited Germany for attending a marriage ceremony.&quot;<br>   },<br>   {<br>    &quot;type&quot;: &quot;text&quot;,<br>    &quot;text&quot;: &quot;Visit Type: ?&quot;<br>   }<br>  ]<br> },<br> {<br>  &quot;role&quot;: &quot;assistant&quot;,<br>  &quot;content&quot;: [<br>   {<br>    &quot;type&quot;: &quot;text&quot;,<br>    &quot;text&quot;: &quot;1. Sam visited the US for an official visit and meeting.\nVisit Type: Business\n\n2. Frank visited Germany for attending a marriage ceremony.\nVisit Type: Pleasure&quot;<br>   }<br>  ]<br> }<br>]</pre><h3>Integrating the Chat Bot using Python for Text Classification</h3><pre>def ChatBot():<br>    import os<br>    from openai import AzureOpenAI<br><br>    endpoint = os.getenv(&quot;ENDPOINT_URL&quot;, &quot;https://&lt;ednpoint-name&gt;.openai.azure.com/&quot;)<br>    deployment = os.getenv(&quot;DEPLOYMENT_NAME&quot;, &quot;&lt;model-name&gt;&quot;)<br>    azOpenAIKey = os.getenv(&quot;OpenAI_Key&quot;, &quot;&lt;Azure-OpenAI-Key&gt;&quot;)<br><br>    client = AzureOpenAI(<br>    api_key=azOpenAIKey,  <br>    api_version=&quot;2024-02-01&quot;,<br>    azure_endpoint = endpoint<br>    )<br><br>    payload = [<br>          {<br>            &quot;role&quot;: &quot;system&quot;,<br>            &quot;content&quot;: [<br>              {<br>                &quot;type&quot;: &quot;text&quot;,<br>                &quot;text&quot;: &quot;You are an AI assistant that helps people find information.&quot;<br>              }<br>            ]<br>          },<br>          {<br>            &quot;role&quot;: &quot;user&quot;,<br>            &quot;content&quot;: [<br>              {<br>                &quot;type&quot;: &quot;text&quot;,<br>                &quot;text&quot;: &quot;Classify the following into the type of visit. It can either be Business or Pleasure.&quot;<br>              },<br>              {<br>                &quot;type&quot;: &quot;text&quot;,<br>                &quot;text&quot;: &quot;1. Sam visited the US for an official visit and meeting.&quot;<br>              },<br>              {<br>                &quot;type&quot;: &quot;text&quot;,<br>                &quot;text&quot;: &quot;Visit Type: ?&quot;<br>              },<br>              {<br>                &quot;type&quot;: &quot;text&quot;,<br>                &quot;text&quot;: &quot;2. Frank visited Germany for attending a marriage ceremony.&quot;<br>              },<br>              {<br>                &quot;type&quot;: &quot;text&quot;,<br>                &quot;text&quot;: &quot;Visit Type: ?&quot;<br>              }<br>            ]<br>          }<br>        ]<br>    <br>    completion = client.chat.completions.create(<br>          model=deployment,<br>          max_tokens=800,<br>          temperature=0.7,<br>          top_p=0.95,<br>          messages=payload<br>    )<br>    <br>    print(completion.to_json())<br><br>if __name__ == &#39;__main__&#39;:<br>    ChatBot()</pre><p>Output:</p><pre>{<br>  &quot;id&quot;: &quot;chatcmpl-9vW9fx4zfZJbtN2JirzjErLGaolIn&quot;,<br>  &quot;choices&quot;: [<br>    {<br>      &quot;finish_reason&quot;: &quot;stop&quot;,<br>      &quot;index&quot;: 0,<br>      &quot;message&quot;: {<br>        &quot;content&quot;: &quot;1. Sam visited the US for an official visit and meeting.\nVisit Type: Business\n\n2. Frank visited Germany for attending a marriage ceremony.\nVisit Type: Pleasure&quot;,<br>        &quot;role&quot;: &quot;assistant&quot;<br>      },<br>      &quot;content_filter_results&quot;: {<br>        &quot;hate&quot;: {<br>          &quot;filtered&quot;: false,<br>          &quot;severity&quot;: &quot;safe&quot;<br>        },<br>        &quot;self_harm&quot;: {<br>          &quot;filtered&quot;: false,<br>          &quot;severity&quot;: &quot;safe&quot;<br>        },<br>        &quot;sexual&quot;: {<br>          &quot;filtered&quot;: false,<br>          &quot;severity&quot;: &quot;safe&quot;<br>        },<br>        &quot;violence&quot;: {<br>          &quot;filtered&quot;: false,<br>          &quot;severity&quot;: &quot;safe&quot;<br>        }<br>      }<br>    }<br>  ],<br>  &quot;created&quot;: 1723495327,<br>  &quot;model&quot;: &quot;gpt-4-turbo-2024-04-09&quot;,<br>  &quot;object&quot;: &quot;chat.completion&quot;,<br>  &quot;system_fingerprint&quot;: &quot;fp_e49e4201a9&quot;,<br>  &quot;usage&quot;: {<br>    &quot;completion_tokens&quot;: 34,<br>    &quot;prompt_tokens&quot;: 73,<br>    &quot;total_tokens&quot;: 107<br>  },<br>  &quot;prompt_filter_results&quot;: [<br>    {<br>      &quot;prompt_index&quot;: 0,<br>      &quot;content_filter_results&quot;: {<br>        &quot;hate&quot;: {<br>          &quot;filtered&quot;: false,<br>          &quot;severity&quot;: &quot;safe&quot;<br>        },<br>        &quot;jailbreak&quot;: {<br>          &quot;filtered&quot;: false,<br>          &quot;detected&quot;: false<br>        },<br>        &quot;self_harm&quot;: {<br>          &quot;filtered&quot;: false,<br>          &quot;severity&quot;: &quot;safe&quot;<br>        },<br>        &quot;sexual&quot;: {<br>          &quot;filtered&quot;: false,<br>          &quot;severity&quot;: &quot;safe&quot;<br>        },<br>        &quot;violence&quot;: {<br>          &quot;filtered&quot;: false,<br>          &quot;severity&quot;: &quot;safe&quot;<br>        }<br>      }<br>    }<br>  ]<br>}</pre><p>Formatted Output (choices[0].message.content):</p><pre>Sam visited the US for an official visit and meeting.<br>Visit Type: Business<br><br>Frank visited Germany for attending a marriage ceremony.<br>Visit Type: Pleasure</pre><p>As you can see, the Chat Bot has automatically classified both the visit type correctly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=152bfd46598d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a LLM based Chat Bot with RAG support for custom/own data using Azure OpenAI]]></title>
            <link>https://medium.com/@hamusingh/creating-a-llm-based-chat-bot-with-rag-support-for-custom-own-data-using-azure-openai-508f5cc43af8?source=rss-ae3e9376d47d------2</link>
            <guid isPermaLink="false">https://medium.com/p/508f5cc43af8</guid>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[openai]]></category>
            <category><![CDATA[chatbots]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Hemendra Singh]]></dc:creator>
            <pubDate>Sun, 11 Aug 2024 08:06:43 GMT</pubDate>
            <atom:updated>2024-08-12T18:25:27.564Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Introduction</strong></h3><p>LLMs (Large Language Models) are deep learning models that consume and train on massive datasets to excel in language processing tasks. They create new combinations of text that mimic natural language based on its training data.</p><p>RAG (Retrieval Augmented Generation) is a method that integrates external data into a Large Language Model prompt to generate relevant responses. This approach is particularly beneficial when using a large corpus of unstructured text based on different topics. It allows for answers/data avalaibale in the organization’s knowledge base (KB), providing a more tailored and accurate response. RAG is also advantageous when answering questions based on an organization’s private data or when the public data that the model was trained on might have become outdated. This helps ensure that the responses are always up-to-date and relevant, regardless of the changes in the data landscape.</p><h3>Objective</h3><p>Create a LLM (GPT-4) based chat bot capable of integrating RAG pattern into the chat for bringing in own/custom data knowledge for more relevant and up to date answers to user questions.</p><h3>Tools &amp; Technologies Used</h3><p>To achieve the RAG pattern using Azure, we would need to utilize the following services:</p><ul><li>Azure OpenAI Service</li><li>Azure AI Search</li><li>Azure Storage Account</li><li>Azure OpenAI Studio</li><li>GPT-4 LLM model</li></ul><h3><strong>Architecture</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*Fmlxaq0jBDHCtfc2BG2x5g.png" /></figure><h3>Implementation</h3><p><strong>Step 1 -</strong> <strong>Deploy and</strong> <strong>Setup Azure OpenAI service</strong>:</p><p>In order to setup Azure OpenAI service search for “Azure OpenAI” in the search box and hit create.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/1*tLu0eXCc8NyjDBcHX5TAwg.png" /></figure><p>Next, fill in the details to create the service:<br>Note, you may want to select a different location (Eg EastUS2), since all the required models and deployment types may not always be available due to lmiit/quotas and the required deployment type availablity.<br>Additonal Details: <a href="https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models#model-summary-table-and-region-availability">https://learn.microsoft.com/en-us/azure/ai-services/openai/concepts/models#model-summary-table-and-region-availability</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/1*HCgcz80CyghdHnahcf1DEw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*CbaKKlodbfIR5Vjvf6P9yA.png" /><figcaption>Select the Network Options as per your choice</figcaption></figure><p>Similarly fill the other tab Tags, review the details and hit the submit button. Post that, open the newly created Azure OpenAI Service to see the deployment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xher10sgigkEwHhqSZ1Dgg.png" /></figure><p><strong>Step 2 -</strong> <strong>Deploy and Setup the LLM model using Azure OpenAI Studio</strong>:</p><p>From the OpenAI Service page that we had just deployed, click on “Go to Azure OpenAI Studio” or search for it in Azure and open it. You will be able to see the below page (Note: This is the old look for Azure OpenAI Studio at the time of writing this article).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4tXNpXEAytMfqz3exY6BxQ.png" /></figure><p>From here, click on Deployments and click on “Create new deployment” and fill in the details. For this demonstraton we have used “gpt-4” model with version “turbo-2024–04–09” and with deployment type as “Standard” (Required for low latency requests) depoyments. You can also choose any other supported chat based model as required. Once deployed, you would be able to to see the deployment like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Urn5H8VKALSHCDUVrHRc6A.png" /></figure><p><strong>Step 3 -</strong> <strong>Deploy and SetupAzure Storage Account</strong>:</p><p>Search for “Azure storage”, fill in the details and deploy the storage account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dAF8CaU7rKDWcaZfnx1nXg.png" /></figure><p>Next, create a container. For theis demonstration we have created a container named “aidata”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jj-0z5cpD6nBnsoRiqTtag.png" /></figure><p><strong>Step 4 -</strong> <strong>Prepare your custom/own data source</strong></p><p>For this demonstration, we’ll prepare a JSON file with a few properties, having the following structure:</p><pre>[<br>    {<br>        &quot;id&quot;: &quot;1&quot;,<br>        &quot;keyword&quot;: &quot;Neeraj Chopra in Paris Olympics 2024&quot;,<br>        &quot;news&quot;: &quot;Neeraj Chopra won the silver medal in Javelin throw during the Paris Olympics 2024.&quot;<br>    },<br>    {<br>        &quot;id&quot;: &quot;2&quot;,<br>        &quot;keyword&quot;: &quot;Indian Hockey team in Paris Olympics 2024&quot;,<br>        &quot;news&quot;: &quot;Indian Hocket team won the Bronze medal at Paris Olympics 2024.&quot;<br>    }<br>]</pre><p>The above file is a JSON file containing an array of items with properties like id, keyword and news. We can add more data, properties into the JSON file as required. So this is a scalable approach for adding/deleting/modifying data and properties.</p><p><strong>Step 5</strong>— <strong>Deploy and Setup Azure AI Search</strong></p><p>Search for “Azure AI Search” on the Azure portal and deploy it.<br>Note: “Free” tier does not work with Azure OpenAI portal, so please choose “Basic” or above pricing tier.<br>Fill in the other details like Scale, Networking, Tags, review the deployment and hit submit to deploy the Azure AI Search instance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*DVCscP4914GQGIt44UMwbQ.png" /></figure><p>Post the deployment completion, go the Azure AI Search instance and you will see the details as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JK_os7F3FaPUtKHUifJyaA.png" /></figure><p>Next, we need to configure the data source, index and indexers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/223/1*nyu_8FgT7532XkStTfMjnw.png" /></figure><p>In Azure AI Search, a search index is your searchable content, available to the search engine for indexing, full text search, vector search, hybrid search, and filtered queries.</p><p>Data source is a way to connect the Azure AI search to an Azure Storage Account Blob and configure the container that needs to be indexed for searching. Fill in the required details and click save. Remember you need to select a Blob container by clicking on the “Choose an existing connection” or alternatively add the connection string manually (It can be obtained by going to the Azure Storage Account instance)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dAQObl-uQCUFidzzUD1YBw.png" /></figure><p>An indexer in Azure AI Search is a crawler that extracts textual data from cloud data sources and populates a search index using field-to-field mappings between source data and a search index.</p><p>To create an index click on the”Indexes” link, then click on “Add index” link and add the required details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5QP4K132haLfpGTwUol3Ow.png" /></figure><pre>{<br>  &quot;@odata.context&quot;: &quot;https://&lt;your-azurei-ai-search-instance-name&gt;.search.windows.net/$metadata#indexes/$entity&quot;,<br>  &quot;@odata.etag&quot;: &quot;\&quot;&lt;odata-etag&gt;\&quot;&quot;,<br>  &quot;name&quot;: &quot;&lt;index-name&gt;&quot;,<br>  &quot;defaultScoringProfile&quot;: null,<br>  &quot;fields&quot;: [<br>    {<br>      &quot;name&quot;: &quot;id&quot;,<br>      &quot;type&quot;: &quot;Edm.String&quot;,<br>      &quot;searchable&quot;: true,<br>      &quot;filterable&quot;: true,<br>      &quot;retrievable&quot;: true,<br>      &quot;stored&quot;: true,<br>      &quot;sortable&quot;: true,<br>      &quot;facetable&quot;: true,<br>      &quot;key&quot;: true,<br>      &quot;indexAnalyzer&quot;: null,<br>      &quot;searchAnalyzer&quot;: null,<br>      &quot;analyzer&quot;: null,<br>      &quot;normalizer&quot;: null,<br>      &quot;dimensions&quot;: null,<br>      &quot;vectorSearchProfile&quot;: null,<br>      &quot;vectorEncoding&quot;: null,<br>      &quot;synonymMaps&quot;: []<br>    },<br>    {<br>      &quot;name&quot;: &quot;keyword&quot;,<br>      &quot;type&quot;: &quot;Edm.String&quot;,<br>      &quot;searchable&quot;: true,<br>      &quot;filterable&quot;: true,<br>      &quot;retrievable&quot;: true,<br>      &quot;stored&quot;: true,<br>      &quot;sortable&quot;: true,<br>      &quot;facetable&quot;: true,<br>      &quot;key&quot;: false,<br>      &quot;indexAnalyzer&quot;: null,<br>      &quot;searchAnalyzer&quot;: null,<br>      &quot;analyzer&quot;: &quot;standard.lucene&quot;,<br>      &quot;normalizer&quot;: null,<br>      &quot;dimensions&quot;: null,<br>      &quot;vectorSearchProfile&quot;: null,<br>      &quot;vectorEncoding&quot;: null,<br>      &quot;synonymMaps&quot;: []<br>    },<br>    {<br>      &quot;name&quot;: &quot;news&quot;,<br>      &quot;type&quot;: &quot;Edm.String&quot;,<br>      &quot;searchable&quot;: true,<br>      &quot;filterable&quot;: true,<br>      &quot;retrievable&quot;: true,<br>      &quot;stored&quot;: true,<br>      &quot;sortable&quot;: true,<br>      &quot;facetable&quot;: true,<br>      &quot;key&quot;: false,<br>      &quot;indexAnalyzer&quot;: null,<br>      &quot;searchAnalyzer&quot;: null,<br>      &quot;analyzer&quot;: &quot;standard.lucene&quot;,<br>      &quot;normalizer&quot;: null,<br>      &quot;dimensions&quot;: null,<br>      &quot;vectorSearchProfile&quot;: null,<br>      &quot;vectorEncoding&quot;: null,<br>      &quot;synonymMaps&quot;: []<br>    }<br>  ],<br>  &quot;scoringProfiles&quot;: [],<br>  &quot;corsOptions&quot;: null,<br>  &quot;suggesters&quot;: [],<br>  &quot;analyzers&quot;: [],<br>  &quot;normalizers&quot;: [],<br>  &quot;tokenizers&quot;: [],<br>  &quot;tokenFilters&quot;: [],<br>  &quot;charFilters&quot;: [],<br>  &quot;encryptionKey&quot;: null,<br>  &quot;similarity&quot;: {<br>    &quot;@odata.type&quot;: &quot;#Microsoft.Azure.Search.BM25Similarity&quot;,<br>    &quot;k1&quot;: null,<br>    &quot;b&quot;: null<br>  },<br>  &quot;semantic&quot;: null,<br>  &quot;vectorSearch&quot;: null<br>}</pre><p>Next, we need to create an Indexer. For that, click on “Indexers” and then click on “Add Indexer”. Fill in the Name, Index (Choose the index that we crreated in the above step), Datasource (Choose the index that we crreated in the above step), select the schedule according to your requirement and hit the Save button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/959/1*VioT59jsrabulaWkmpDrlQ.png" /></figure><p>Once it is saved, click on Run (For the first time, to run it manually for testing). You will, see an output like this on the Indexers page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TZKoUYmWzMRmLrc8u4Z4kQ.png" /></figure><p>Next, you can verify that we have indexed the records for searching by clicking on the Index and hitting the Search button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ALOKw5-69M4D8Gg-6DmUFQ.png" /></figure><pre>{<br>  &quot;@odata.context&quot;: &quot;https://&lt;your-azure-ai-search-instance-name&gt;.search.windows.net/indexes(&#39;aiindex1&#39;)/$metadata#docs(*)&quot;,<br>  &quot;value&quot;: [<br>    {<br>      &quot;@search.score&quot;: 1,<br>      &quot;id&quot;: &quot;2&quot;,<br>      &quot;keyword&quot;: &quot;Indian Hockey team in Paris Olympics 2024&quot;,<br>      &quot;news&quot;: &quot;Indian Hocket team won the Bronze medal at Paris Olympics 2024.&quot;<br>    },<br>    {<br>      &quot;@search.score&quot;: 1,<br>      &quot;id&quot;: &quot;1&quot;,<br>      &quot;keyword&quot;: &quot;Neeraj Chopra in Paris Olympics 2024&quot;,<br>      &quot;news&quot;: &quot;Neeraj Chopra won the silver medal in Javelin throw during the Paris Olympics 2024.&quot;<br>    }<br>  ]<br>}</pre><p><strong>Step 6</strong>— <strong>Link the Azure Open AI Studio Chat Bot using with Azure AI Search</strong></p><p>Now, we have created all the required dependencies for Azure OpenAI Studio Chat to connect with Azure AI Search. Next step would be to connect out Chat Bot to the Azure AI Search service. But before that let’s do a test of what the LLM model would return without the custom/own data source added.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*JUlXb0BMsOQQBvlJzspfEw.png" /></figure><p>As you can see, the LLM model is not able to return relevant information about “Neeraj Chopra” at the Paris Olympics 2024.</p><p>Now, lets see how to connect the model with Azure AI Search using a RAG pattern to enable discovery of the above information.</p><p>Click on chat link on the Azure Open AI Studio</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/241/1*9D0zotclCkFW76ivARJt1w.png" /></figure><p>Next, click on “Add your data” tab and then click on “Add a data source” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/419/1*bjHGvVM19ABFT0q7_eNdsQ.png" /></figure><p>Next, fill in the details of data source. Select the data source as “Azure AI Search”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*kGyiADZ57RhsW1LiGWgFcg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*3_5D1IYZb-3hRcs7GdJ_2g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*loBIJJ1OL2aWh279khjZuw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*glVkPRF84oe4Qzj5GYxbEQ.png" /></figure><p>Click next, then review the details and click “Save and close”.</p><p><strong>Step 7</strong>— <strong>Test the Chat Bot</strong></p><p>Lets test the bot from Azure OpenAI Studio</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*p4CXOdDR2jdL8R5deEy6sA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KTiz02y9vboFh6LCDZz46g.png" /></figure><p>As you can see, now the infromation about “Neeraj Chopra” regarding Paris Olymipcs is available via the LLM chat bot.</p><p>Lets try to ask one more question to the Chat Bot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*_kC0H8qK6lzDq8aZwSpZRg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TLZpR8LmGfCAPJEXu3oqDg.png" /></figure><p>Here also, we were presented with custom/own information about the Indian Hockey team wining a Bronze medal at the Paris Olympics 2024. Without the custom/own data source, we would not get a relevant answer about this question.</p><p>The same request can be sent via REST API/SDK using Postman/any programming language and can be integrated into different systems easily.</p><p>An example of Python integration is shown below:</p><pre><br>def ChatBot():<br>    import os<br>    from openai import AzureOpenAI<br><br>    endpoint = os.getenv(&quot;ENDPOINT_URL&quot;, &quot;https://&lt;ednpoint-name&gt;.openai.azure.com/&quot;)<br>    deployment = os.getenv(&quot;DEPLOYMENT_NAME&quot;, &quot;&lt;model-name&gt;&quot;)<br>    search_endpoint = os.getenv(&quot;SEARCH_ENDPOINT&quot;, &quot;https://&lt;azure-ai-search-endpoint-name&gt;.search.windows.net&quot;)<br>    search_key = os.getenv(&quot;SEARCH_KEY&quot;, &quot;&lt;azure-ai-search-key&gt;&quot;)<br>    azOpenAIKey = os.getenv(&quot;OpenAI_Key&quot;, &quot;&lt;Azure-OpenAI-Key&gt;&quot;)<br><br>    client = AzureOpenAI(<br>    api_key=azOpenAIKey,  <br>    api_version=&quot;2024-02-01&quot;,<br>    azure_endpoint = endpoint<br>    )<br>        <br>    completion = client.chat.completions.create(<br>        model=deployment,<br>        messages= [<br>        {<br>        &quot;role&quot;: &quot;user&quot;,<br>        &quot;content&quot;: &quot;What happened to Neeraj Chopra at Paris Olymipcs?&quot;<br>        }],<br>        max_tokens=800,<br>        temperature=0.7,<br>        top_p=0.95,<br>        frequency_penalty=0,<br>        presence_penalty=0,<br>        stop=None,<br>        stream=False,<br>        extra_body={<br>        &quot;data_sources&quot;: [{<br>            &quot;type&quot;: &quot;azure_search&quot;,<br>            &quot;parameters&quot;: {<br>                &quot;endpoint&quot;: f&quot;{search_endpoint}&quot;,<br>                &quot;index_name&quot;: &quot;aiindex1&quot;,<br>                &quot;semantic_configuration&quot;: &quot;default&quot;,<br>                &quot;query_type&quot;: &quot;simple&quot;,<br>                &quot;fields_mapping&quot;: {<br>                &quot;content_fields_separator&quot;: &quot;\n&quot;,<br>                &quot;content_fields&quot;: [<br>                    &quot;news&quot;<br>                ],<br>                &quot;filepath_field&quot;: None,<br>                &quot;title_field&quot;: &quot;keyword&quot;,<br>                &quot;url_field&quot;: None,<br>                &quot;vector_fields&quot;: []<br>                },<br>                &quot;in_scope&quot;: True,<br>                &quot;filter&quot;: None,<br>                &quot;strictness&quot;: 3,<br>                &quot;top_n_documents&quot;: 5,<br>                &quot;authentication&quot;: {<br>                &quot;type&quot;: &quot;api_key&quot;,<br>                &quot;key&quot;: f&quot;{search_key}&quot;<br>                }<br>            }<br>            }]<br>        }<br>    )<br>    print(completion.to_json())<br><br>if __name__ == &#39;__main__&#39;:<br>    ChatBot()</pre><p>Output:</p><pre>{<br>  &quot;id&quot;: &quot;c9912c03-96d1-459c-a777-b0b3644ef3da&quot;,<br>  &quot;choices&quot;: [<br>    {<br>      &quot;finish_reason&quot;: &quot;stop&quot;,<br>      &quot;index&quot;: 0,<br>      &quot;message&quot;: {<br>        &quot;content&quot;: &quot;Neeraj Chopra won the silver medal in the Javelin throw during the Paris Olympics 2024 [doc1].&quot;,<br>        &quot;role&quot;: &quot;assistant&quot;,<br>        &quot;end_turn&quot;: true,<br>        &quot;context&quot;: {<br>          &quot;citations&quot;: [<br>            {<br>              &quot;content&quot;: &quot;Neeraj Chopra won the silver medal in Javelin throw during the Paris Olympics 2024.&quot;,<br>              &quot;title&quot;: &quot;Neeraj Chopra in Paris Olympics 2024&quot;,<br>              &quot;url&quot;: null,<br>              &quot;filepath&quot;: null,<br>              &quot;chunk_id&quot;: &quot;0&quot;<br>            },<br>            {<br>              &quot;content&quot;: &quot;Indian Hocket team won the Bronze medal at Paris Olympics 2024.&quot;,<br>              &quot;title&quot;: &quot;Indian Hockey team in Paris Olympics 2024&quot;,<br>              &quot;url&quot;: null,<br>              &quot;filepath&quot;: null,<br>              &quot;chunk_id&quot;: &quot;0&quot;<br>            }<br>          ],<br>          &quot;intent&quot;: &quot;[\&quot;What happened to Neeraj Chopra at Paris Olympics?\&quot;, \&quot;Neeraj Chopra Paris Olympics performance\&quot;, \&quot;Details of Neeraj Chopra&#39;s incident at Paris Olympics\&quot;]&quot;<br>        }<br>      }<br>    }<br>  ],<br>  &quot;created&quot;: 1723486557,<br>  &quot;model&quot;: &quot;gpt-4&quot;,<br>  &quot;object&quot;: &quot;extensions.chat.completion&quot;,<br>  &quot;system_fingerprint&quot;: &quot;fp_e49e4201a9&quot;,<br>  &quot;usage&quot;: {<br>    &quot;completion_tokens&quot;: 63,<br>    &quot;prompt_tokens&quot;: 2645,<br>    &quot;total_tokens&quot;: 2708<br>  }<br>}</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=508f5cc43af8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scrum For SRE Teams]]></title>
            <link>https://medium.com/@hamusingh/scrum-for-sre-teams-b9969125114d?source=rss-ae3e9376d47d------2</link>
            <guid isPermaLink="false">https://medium.com/p/b9969125114d</guid>
            <category><![CDATA[scrum]]></category>
            <category><![CDATA[sre]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[site-reliability-engineer]]></category>
            <category><![CDATA[agile]]></category>
            <dc:creator><![CDATA[Hemendra Singh]]></dc:creator>
            <pubDate>Fri, 24 Jul 2020 09:52:12 GMT</pubDate>
            <atom:updated>2020-07-24T11:36:10.670Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*05q_PBbqEOwYM98ufw6Mjg.jpeg" /></figure><p><strong>Introduction</strong><br>Traditionally SRE (Site Reliability Engineering) oriented teams have used Kanban for working and getting their tasks done. But that causes fewer releases of tools, products during the Release cycle which they might have developed for internal consumption by other teams.</p><p>Kanban is good for operations, but remember SRE is not only about operations, it is also about treating operations as if it were a software problem.</p><p><strong>Some of the goals of an SRE team can be stated as follows</strong>:</p><ol><li>Own Product Reliability, Availability.</li><li>Carry out Performance Engineering for the Products.</li><li>Ensure product SLOs and SLAs are met.</li><li>Help the products achieve the required HA (High Availability) &amp; DR (Disaster Recovery) expectations.</li><li>By using Chaos Engineering make the products reliable under stress.</li><li>Incident Management.</li><li>Remove Toil from the existing Processes.</li><li>Improve Product Observability.</li></ol><p><strong>SRE teams can adopt Scrum in 2 ways</strong>:</p><ol><li><strong>Have one Scrum and one Kanban board</strong>: This approach suggests having 1 board as Scrum board which will be used for delivering product increments i.e. the products, tools, automation the team works on. The ideal sprint time is 2 weeks. The next board in this case would be a Kanban board which will be used to create On-Call tickets. On-Call tickets are created by SRE team members who are currently engaged in day to day operations of providing support to the products on boarded to the SRE team. Since SRE owns reliability, availability, etc. managing On-Call tickets is one of the key steps to ensure success. One of the demerit of this approach is lack of observability of what is going on with the On-Call tickets.</li><li><strong>Have only one Scrum board</strong>: This approach suggests having only one Scrum board for both development and operations. This increases observability in not only development work but also in operations work and the team tends to be more Agile and focused towards ticket closures and delivering a product increment. Since Kanban does not have any fixed closure dates like Scrum, it can decrease the capacity of the SRE team to handle On-Call tickets.</li></ol><p><strong>How to plan the SRE Sprint</strong>?<br>Planning the sprint carefully for an SRE team is indeed very essential as you need to take into account the On-Call part of the SRE and Ad-Hoc requests which are going to come your way during the sprint.</p><p>A part of capacity should be dedicated for On-Call and some should left for the Ad-Hoc tasks that other teams would request from you. The Ad-Hoc tasks can simply be architecture consultations, understanding how to use SRE tools, understanding dashboards, meetings for SLO agreement, High priority work, troubleshooting production issues, etc.</p><p><strong>How to Scale SRE services and practices using Scrum</strong>?<br>In order to scale the services, more focus should be given in delivering SRE as a Services, by delivering product increments during the Scrum Sprint. The aim should be to identify the areas which require manual effort or human intervention and automate it by delivering tools to do that job instead of a SRE team member putting effort in it. For example, when the SRE On-Call member receives an alert about an incident with one of the product that SRE has on boarded, the first level of troubleshooting can be automated to check if the software/machine can handle the current incident and if any action is needed it can auto heal the system. If the software/machine cannot handle the given incident on its own only then it should communicate the same to the On-Call member. This ensures the SRE Team avoids toil and is more focused towards delivering productive tools which can make the systems more reliable than ever before.</p><p><strong>Conclusion<br></strong>SRE and Scrum go hand in hand in delivering value, eliminating toil, improving observability, delivering better reliability for products.</p><p>By adopting Scrum, SRE Teams can be more aligned with the core principle of SRE which is “Treating operations as if it were a software problem”.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b9969125114d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>