{"id":3609,"date":"2024-10-01T02:31:52","date_gmt":"2024-10-01T09:31:52","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/azure-sql\/?p=3609"},"modified":"2024-10-02T06:42:06","modified_gmt":"2024-10-02T13:42:06","slug":"smart-resume-matching-with-azure-sql-db-document-intelligence","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/azure-sql\/smart-resume-matching-with-azure-sql-db-document-intelligence\/","title":{"rendered":"Smart Resume Matching: Document RAG with Azure SQL DB &amp; Document Intelligence"},"content":{"rendered":"<p>Hey Azure SQL enthusiasts! \ud83d\udc4b<\/p>\n<p>We had a hiring event last week, and as I was going through a stack of digital resumes, I thought, &#8220;There has to be an easier way to do this.&#8221; That&#8217;s when it hit me\u2014why not use Azure SQL DB\u2019s new <a href=\"https:\/\/devblogs.microsoft.com\/azure-sql\/eap-for-vector-support-refresh-introducing-vector-type\/#:~:text=The%20new%20vector%20data%20type.%20We%E2%80%99re%20now%20even%20more%20excited\">vector<\/a> data type to revolutionize our hiring process? Not only could we find the perfect candidate faster, but we could also identify key focus areas for the interview. It\u2019s a win-win!<\/p>\n<p>So, buckle up because today, we\u2019re diving into how Azure SQL DB\u2019s vector capabilities can enable advanced resume matching. We\u2019ll be using Azure Document Intelligence and Azure OpenAI to make this magic happen. Let\u2019s get started!<\/p>\n<h2><strong>The Challenge: Finding the Perfect Candidate<\/strong><\/h2>\n<p>Imagine you\u2019re a recruiter with a stack of digital resumes taller than your inbox. You need to find candidates with specific skills and experiences, but manually reviewing each resume is time-consuming and prone to errors. You also need to know what focus areas to address in the interview if a candidate is a match but has some missing skills. What if there was a way to automate this process, ensure you never miss a great candidate, and make your interview process better? Enter Azure SQL DB\u2019s native vector capabilities!<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/Designer-17.jpeg\"><img decoding=\"async\" class=\"alignleft size-full wp-image-3619\" src=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/Designer-17.jpeg\" alt=\"funny cat image -Recruiter with stack of resumes\" width=\"1024\" height=\"1024\" srcset=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/Designer-17.jpeg 1024w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/Designer-17-300x300.jpeg 300w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/Designer-17-150x150.jpeg 150w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/Designer-17-768x768.jpeg 768w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/Designer-17-24x24.jpeg 24w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/Designer-17-48x48.jpeg 48w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/Designer-17-96x96.jpeg 96w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h2><strong>The Solution: Vector Similarity Search<\/strong><\/h2>\n<p>By leveraging Azure SQL DB\u2019s new <a href=\"https:\/\/devblogs.microsoft.com\/azure-sql\/eap-for-vector-support-refresh-introducing-vector-type\/#:~:text=The%20new%20vector%20data%20type.%20We%E2%80%99re%20now%20even%20more%20excited\">vector<\/a> data type, we can store embeddings (vector representations) of resume content and perform similarity searches using built-in vector functions. This allows us to match resumes to job descriptions with incredible accuracy. Here\u2019s how we do it:<\/p>\n<h3><strong>Getting Started<\/strong><\/h3>\n<p>For the purpose of this sample tutorial, we\u2019ll use a simple\u00a0<a href=\"https:\/\/github.com\/Azure-Samples\/azure-sql-db-vector-search\/blob\/main\/RAG-with-Documents\/RAG-with-resumes.ipynb\">Python notebook<\/a>\u00a0so that you can have everything up and running in less than 2 hours. Here\u2019s a quick overview of what you\u2019ll need to get started:<\/p>\n<h4><strong>Dataset<\/strong><\/h4>\n<p>We use a sample dataset from\u00a0<a href=\"https:\/\/www.kaggle.com\/datasets\/snehaanbhawal\/resume-dataset\">Kaggle<\/a>\u00a0containing PDF resumes for this tutorial. For this tutorial, we will use 120 resumes from the\u00a0<strong>Information-Technology<\/strong>\u00a0folder<\/p>\n<h4><strong>Prerequisites<\/strong><\/h4>\n<ul>\n<li><span style=\"font-size: 10pt;\"><strong>Azure Subscription<\/strong>:\u00a0<a href=\"https:\/\/azure.microsoft.com\/free\/cognitive-services?azure-portal=true\">Create one for free<\/a><\/span><\/li>\n<li><span style=\"font-size: 10pt;\"><strong>Azure SQL Database<\/strong>:\u00a0<a href=\"https:\/\/learn.microsoft.com\/azure\/azure-sql\/database\/free-offer?view=azuresql\">Set up your database for free<\/a><\/span><\/li>\n<li><span style=\"font-size: 10pt;\"><strong>Azure Document Intelligence<\/strong>\u00a0<a href=\"https:\/\/learn.microsoft.com\/azure\/ai-services\/document-intelligence\/create-document-intelligence-resource?view=doc-intel-4.0.0\">Create a Free Azure Document Intelligence resource<\/a><\/span><\/li>\n<li><span style=\"font-size: 10pt;\"><strong>Azure OpenAI Access<\/strong>: Apply for access in the desired Azure subscription at\u00a0<a href=\"https:\/\/aka.ms\/oai\/access\">https:\/\/aka.ms\/oai\/access<\/a><\/span><\/li>\n<li><span style=\"font-size: 10pt;\"><strong>Azure OpenAI Resource<\/strong>: Deploy an embeddings model (e.g.,\u00a0text-embedding-small\u00a0or\u00a0text-embedding-ada-002) and a\u00a0GPT-4.0\u00a0model for chat completion. Refer to the\u00a0<a href=\"https:\/\/learn.microsoft.com\/azure\/ai-services\/openai\/how-to\/create-resource\">resource deployment guide<\/a><\/span><\/li>\n<li><span style=\"font-size: 10pt;\"><strong>Azure Data Studio<\/strong>: Download\u00a0<a href=\"https:\/\/azure.microsoft.com\/products\/data-studio\">here<\/a>\u00a0to manage your Azure SQL database and\u00a0<a href=\"https:\/\/learn.microsoft.com\/azure-data-studio\/notebooks\/notebooks-python-kernel\">execute the notebook<\/a><\/span><\/li>\n<\/ul>\n<h3><strong>Step 1: Extract &amp; chunk content from PDF Resumes<\/strong><\/h3>\n<p>First, we use Azure Document Intelligence to extract and chunk content from PDF resumes.<\/p>\n<h4><strong>Why Azure Document Intelligence?<\/strong><\/h4>\n<p><a href=\"https:\/\/azure.microsoft.com\/en-in\/products\/ai-services\/ai-document-intelligence\">AI Document Intelligence <\/a>is an AI service that applies advanced machine learning to extract text, key-value pairs, tables, and structures from documents automatically and accurately.\nThis means you can turn documents into usable data and shift your focus to acting on information rather than compiling it.<\/p>\n<p>Here is an example of a Resume in PDF format from the dataset:<a href=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/resume.png\">\n<img decoding=\"async\" class=\"alignleft size-full wp-image-3615\" src=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/resume.png\" alt=\"Image resume\" width=\"1273\" height=\"775\" srcset=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/resume.png 1273w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/resume-300x183.png 300w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/resume-1024x623.png 1024w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/resume-768x468.png 768w\" sizes=\"(max-width: 1273px) 100vw, 1273px\" \/><\/a><\/p>\n<p>One of the best parts about using Azure Document Intelligence is how easy it is to get started with <strong>prebuilt<\/strong> models. These models are designed to handle common document types like invoices, receipts, and more! Here\u2019s why you\u2019ll love using them:<\/p>\n<ul>\n<li><span style=\"font-size: 10pt;\"><strong>No Training Required:<\/strong> <a href=\"https:\/\/learn.microsoft.com\/en-us\/azure\/ai-services\/document-intelligence\/choose-model-feature?view=doc-intel-4.0.0\">Prebuilt models<\/a> are ready to use out of the box &amp; like having a team of document experts at your disposal. You don\u2019t need to spend time training them on your data.<\/span><\/li>\n<li><span style=\"font-size: 10pt;\"><strong>High Accuracy:<\/strong> These models are built and maintained by Microsoft, ensuring high accuracy and reliability.<\/span><\/li>\n<li><span style=\"font-size: 10pt;\"><strong>Easy Integration<\/strong>: With simple API calls, you can integrate these models into your applications quickly and efficiently.<\/span><\/li>\n<li><span style=\"font-size: 10pt;\"><strong>Scalability:<\/strong> Azure\u2019s infrastructure ensures that your document processing can scale with your needs, handling everything from a few documents to millions.<\/span><\/li>\n<\/ul>\n<p>We define DocumentAnalysisClient\u00a0 to send requests to the <a href=\"https:\/\/learn.microsoft.com\/python\/api\/overview\/azure\/ai-formrecognizer-readme?view=azure-python\">Azure Document Intelligence<\/a>\u00a0service and receive responses containing the extracted text from the PDF resumes. It\u00a0provides operations for analyzing input documents using prebuilt and custom models through the\u00a0<code>begin_analyze_document<\/code>\u00a0and\u00a0<code>begin_analyze_document_from_url<\/code>\u00a0APIs.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/10\/docanalysisclient.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-3659\" src=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/10\/docanalysisclient.png\" alt=\"Image docanalysisclient\" width=\"1512\" height=\"387\" srcset=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/10\/docanalysisclient.png 1512w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/10\/docanalysisclient-300x77.png 300w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/10\/docanalysisclient-1024x262.png 1024w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/10\/docanalysisclient-768x197.png 768w\" sizes=\"(max-width: 1512px) 100vw, 1512px\" \/><\/a><\/p>\n<p>You can also visualize how the document text extraction is performed using the\u00a0<a href=\"https:\/\/documentintelligence.ai.azure.com\/\">Document Intelligence Studio<\/a><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/visualizedocintelligence.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-3645\" src=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/visualizedocintelligence.png\" alt=\"Image visualizedocintelligence\" width=\"1576\" height=\"517\" srcset=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/visualizedocintelligence.png 1576w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/visualizedocintelligence-300x98.png 300w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/visualizedocintelligence-1024x336.png 1024w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/visualizedocintelligence-768x252.png 768w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/visualizedocintelligence-1536x504.png 1536w\" sizes=\"(max-width: 1576px) 100vw, 1576px\" \/><\/a><\/p>\n<h4><strong>Why are we chunking? <\/strong><\/h4>\n<p>When dealing with content that exceeds the embedding limit of our model, we need to break it into smaller pieces. This is because the model that generates embeddings can only handle a certain amount of text at a time.<\/p>\n<p>Here, we divide the extracted text into fixed chunks of 500 tokens. These chunks are later passed to the <strong>text-embedding-small<\/strong> model to generate text embeddings, as the model has an input token limit of <strong>8192<\/strong><\/p>\n<p>This process breaks down resumes into manageable pieces, making them easier to analyze and process. Think of it as turning a giant pizza into bite-sized slices\u2014much easier to handle!<\/p>\n<p><strong>Note<\/strong>: There are different ways of <a href=\"https:\/\/learn.microsoft.com\/en-us\/azure\/ai-services\/document-intelligence\/concept-retrieval-augmented-generation?view=doc-intel-4.0.0#introduction\">chunking<\/a> content, and the method you choose can depend on your specific needs and the structure of the text you\u2019re working with.<\/p>\n<p>We now have our Resumes extracted &amp; chunked:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/pdfchunkingoutput.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-3612\" src=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/pdfchunkingoutput.png\" alt=\"Image pdfchunkingoutput\" width=\"1225\" height=\"591\" srcset=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/pdfchunkingoutput.png 1225w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/pdfchunkingoutput-300x145.png 300w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/pdfchunkingoutput-1024x494.png 1024w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/pdfchunkingoutput-768x371.png 768w\" sizes=\"(max-width: 1225px) 100vw, 1225px\" \/><\/a><\/p>\n<h2><strong>Step 2: Generating Embeddings<\/strong><\/h2>\n<p>Next, we generate embeddings from the chunked content using the <a href=\"https:\/\/learn.microsoft.com\/en-us\/azure\/ai-services\/openai\/how-to\/embeddings?tabs=console\">Azure OpenAI API.<\/a> These embeddings are vector representations of the text, capturing the semantic meaning of the content.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/get_embedding.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-3647\" src=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/get_embedding.png\" alt=\"Image get embedding\" width=\"1030\" height=\"484\" srcset=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/get_embedding.png 1030w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/get_embedding-300x141.png 300w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/get_embedding-1024x481.png 1024w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/get_embedding-768x361.png 768w\" sizes=\"(max-width: 1030px) 100vw, 1030px\" \/><\/a><\/p>\n<p>Each chunk now has a text embedding as seen below:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/embeddings.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-3646\" src=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/embeddings.png\" alt=\"Image embeddings\" width=\"667\" height=\"321\" srcset=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/embeddings.png 667w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/embeddings-300x144.png 300w\" sizes=\"(max-width: 667px) 100vw, 667px\" \/><\/a><\/p>\n<h3><strong>Step 3: Storing Embeddings in Azure SQL DB<\/strong><\/h3>\n<p>We then store these embeddings in Azure SQL DB using the new\u00a0<a href=\"https:\/\/devblogs.microsoft.com\/azure-sql\/announcing-eap-native-vector-support-in-azure-sql-database\">Vector<\/a> data type. This allows us to perform similarity searches using built-in vector functions, enabling us to find the most suitable candidates based on their resumes.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/insertintosqldb.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-3649\" src=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/insertintosqldb.png\" alt=\"Image insertintosqldb\" width=\"760\" height=\"460\" srcset=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/insertintosqldb.png 760w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/insertintosqldb-300x182.png 300w\" sizes=\"(max-width: 760px) 100vw, 760px\" \/><\/a><\/p>\n<p>We now have our data in the SQL DB which we can use for Vector Search. This means that even if the exact words don\u2019t match, the underlying meaning can still be understood and matched effectively.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/10\/vectorstoredinsqldb.png\"><img decoding=\"async\" class=\"aligncenter wp-image-3660 size-full\" src=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/10\/vectorstoredinsqldb.png\" alt=\"\" width=\"1696\" height=\"666\" srcset=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/10\/vectorstoredinsqldb.png 1696w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/10\/vectorstoredinsqldb-300x118.png 300w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/10\/vectorstoredinsqldb-1024x402.png 1024w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/10\/vectorstoredinsqldb-768x302.png 768w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/10\/vectorstoredinsqldb-1536x603.png 1536w\" sizes=\"(max-width: 1696px) 100vw, 1696px\" \/><\/a><\/p>\n<p>For example: If your search query is focused on project management skills, the embeddings can help find candidates with relevant experience, even if they use different terminology:<\/p>\n<p><strong>Search Query: \u201cproject management\u201d<\/strong><\/p>\n<p><strong>Matched Candidate Skills:<\/strong><\/p>\n<ul>\n<li>\u201cLed multiple software development projects\u201d<\/li>\n<li>\u201cCertified Scrum Master with experience in Agile methodologies\u201d<\/li>\n<li>\u201cManaged cross-functional teams to deliver projects on time and within budget\u201d<\/li>\n<\/ul>\n<p>The embeddings capture the essence of \u201cproject management\u201d and match it with various related skills and experiences. It\u2019s like having a supercharged recruiter at your fingertips!<\/p>\n<p>Let&#8217;s now query our ResumeDocs table to get the top similar candidates given the User search query.<\/p>\n<p><strong>Vector Search in SQL DB:<\/strong> Given any user search query, we can obtain the vector representation of that text. We then use this vector to calculate the cosine distance against all the resume embeddings stored in the database. By selecting only the closest matches, we can identify the resumes most relevant to the user\u2019s query. This helps in finding the most suitable candidates based on their resumes.<\/p>\n<p>The most common distance is the cosine similarity, which can be calculated quite easily in SQL with the help of the built-in vector distance functions.<\/p>\n<p><strong>VECTOR_DISTANCE(&#8216;distance metric&#8217;, V1, V2)<\/strong><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/vectordistancefunction.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-3650\" src=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/vectordistancefunction.png\" alt=\"Image vectordistancefunction\" width=\"1765\" height=\"750\" srcset=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/vectordistancefunction.png 1765w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/vectordistancefunction-300x127.png 300w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/vectordistancefunction-1024x435.png 1024w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/vectordistancefunction-768x326.png 768w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/vectordistancefunction-1536x653.png 1536w\" sizes=\"(max-width: 1765px) 100vw, 1765px\" \/><\/a><\/p>\n<h3><strong>Step 4: Augmenting LLM Generation<\/strong><\/h3>\n<p>Finally, we enhance language model generation with the Vector Search results from our Azure SQL Database. By informing a GPT-4o chat model with the results of our Vector search, we can provide rich, context-aware answers about candidates based on their resumes.<\/p>\n<p>The function\u00a0<code>generate_completion<\/code> is defined to help ground the gpt-4o model with prompts and system instructions. Note that we are passing the results of the\u00a0<code>vector_search_sql<\/code> we defined earlier<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/10\/systempromptLLM.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-3658\" src=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/10\/systempromptLLM.png\" alt=\"Image systempromptLLM\" width=\"1197\" height=\"576\" srcset=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/10\/systempromptLLM.png 1197w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/10\/systempromptLLM-300x144.png 300w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/10\/systempromptLLM-1024x493.png 1024w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/10\/systempromptLLM-768x370.png 768w\" sizes=\"(max-width: 1197px) 100vw, 1197px\" \/><\/a><\/p>\n<p>We can now create interactive loop where you can pose questions to the model and receive information grounded in your data.<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/LLMresponse.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-3651\" src=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/LLMresponse.png\" alt=\"Image LLMresponse\" width=\"1256\" height=\"684\" srcset=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/LLMresponse.png 1256w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/LLMresponse-300x163.png 300w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/LLMresponse-1024x558.png 1024w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/LLMresponse-768x418.png 768w\" sizes=\"(max-width: 1256px) 100vw, 1256px\" \/><\/a>\nLet&#8217;s look at Candidate 2:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/candidate2.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-3653\" src=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/candidate2.png\" alt=\"Image candidate2\" width=\"1299\" height=\"396\" srcset=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/candidate2.png 1299w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/candidate2-300x91.png 300w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/candidate2-1024x312.png 1024w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/candidate2-768x234.png 768w\" sizes=\"(max-width: 1299px) 100vw, 1299px\" \/><\/a><a href=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/candidate3.png\">\n<img decoding=\"async\" class=\"aligncenter size-full wp-image-3654\" src=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/candidate3.png\" alt=\"Image candidate3\" width=\"1267\" height=\"410\" srcset=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/candidate3.png 1267w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/candidate3-300x97.png 300w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/candidate3-1024x331.png 1024w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/candidate3-768x249.png 768w\" sizes=\"(max-width: 1267px) 100vw, 1267px\" \/><\/a><\/p>\n<p>We also can get a short summary at the end along with a Fun Microsoft fact about the technology we are hiring for as we had defined in the prompt:<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/finalsummary.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-3655\" src=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/finalsummary.png\" alt=\"Image finalsummary\" width=\"1315\" height=\"439\" srcset=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/finalsummary.png 1315w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/finalsummary-300x100.png 300w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/finalsummary-1024x342.png 1024w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/12\/finalsummary-768x256.png 768w\" sizes=\"(max-width: 1315px) 100vw, 1315px\" \/><\/a><\/p>\n<p>Hence by utilizing <strong>Azure SQL DB\u2019s<\/strong> vector capabilities along with the power of Azure Document Intelligence and Azure OpenAI, you can totally transform your hiring game.<\/p>\n<p>No more missing out on the perfect candidate, and your interviews will be more on point than ever. But why stop at resumes? Dive into your own documents\u2014whether they\u2019re project reports, research papers\u2014and uncover hidden gems. This cool approach not only saves you time but also boosts the quality of your recruitment and document analysis. Happy exploring and hiring! \ud83d\ude80<\/p>\n<h2 id=\"private-preview-sign-up\">Private Preview Sign-up<\/h2>\n<p>We are currently accepting requests from customers who would like to participate in the private preview and try out the Native Vector Support for SQL feature. If you are interested, please fill out\u00a0<a href=\"https:\/\/aka.ms\/azuresql-vector-eap\" target=\"_blank\" rel=\"noopener\">https:\/\/aka.ms\/azuresql-vector-eap<\/a><\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/05\/QRCode-for-Vector-Support-in-Azure-SQL-Database-Private-Preview-Sign-up-1.png\" data-featherlight=\"image\"><img decoding=\"async\" class=\"size-medium wp-image-3210 aligncenter lazyloaded\" src=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/05\/QRCode-for-Vector-Support-in-Azure-SQL-Database-Private-Preview-Sign-up-1-300x300.png\" alt=\"Image QRCode for Vector Support in Azure SQL Database Private Preview Sign up 1\" width=\"300\" height=\"300\" data-src=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/05\/QRCode-for-Vector-Support-in-Azure-SQL-Database-Private-Preview-Sign-up-1-300x300.png\" srcset=\"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/05\/QRCode-for-Vector-Support-in-Azure-SQL-Database-Private-Preview-Sign-up-1-300x300.png 300w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/05\/QRCode-for-Vector-Support-in-Azure-SQL-Database-Private-Preview-Sign-up-1-1024x1024.png 1024w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/05\/QRCode-for-Vector-Support-in-Azure-SQL-Database-Private-Preview-Sign-up-1-150x150.png 150w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/05\/QRCode-for-Vector-Support-in-Azure-SQL-Database-Private-Preview-Sign-up-1-768x768.png 768w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/05\/QRCode-for-Vector-Support-in-Azure-SQL-Database-Private-Preview-Sign-up-1-1536x1536.png 1536w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/05\/QRCode-for-Vector-Support-in-Azure-SQL-Database-Private-Preview-Sign-up-1-24x24.png 24w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/05\/QRCode-for-Vector-Support-in-Azure-SQL-Database-Private-Preview-Sign-up-1-48x48.png 48w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/05\/QRCode-for-Vector-Support-in-Azure-SQL-Database-Private-Preview-Sign-up-1-96x96.png 96w, https:\/\/devblogs.microsoft.com\/azure-sql\/wp-content\/uploads\/sites\/56\/2024\/05\/QRCode-for-Vector-Support-in-Azure-SQL-Database-Private-Preview-Sign-up-1.png 1890w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hey Azure SQL enthusiasts! \ud83d\udc4b We had a hiring event last week, and as I was going through a stack of digital resumes, I thought, &#8220;There has to be an easier way to do this.&#8221; That&#8217;s when it hit me\u2014why not use Azure SQL DB\u2019s new vector data type to revolutionize our hiring process? Not [&hellip;]<\/p>\n","protected":false},"author":159391,"featured_media":3619,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[601,599,1,582,411,619,615],"tags":[602,510,588,627,591],"class_list":["post-3609","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai","category-azure-openai","category-azure-sql","category-openai","category-python","category-t-sql","category-vectors","tag-azure-openai","tag-azure-sql-database","tag-azure-sql-db","tag-rag","tag-vector-search"],"acf":[],"blog_post_summary":"<p>Hey Azure SQL enthusiasts! \ud83d\udc4b We had a hiring event last week, and as I was going through a stack of digital resumes, I thought, &#8220;There has to be an easier way to do this.&#8221; That&#8217;s when it hit me\u2014why not use Azure SQL DB\u2019s new vector data type to revolutionize our hiring process? Not [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/posts\/3609","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/users\/159391"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/comments?post=3609"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/posts\/3609\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/media\/3619"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/media?parent=3609"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/categories?post=3609"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/azure-sql\/wp-json\/wp\/v2\/tags?post=3609"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}