How to use Semantic Kernel Bot in-a-box to interact with data using natural language & AI
Published Feb 07 2024 12:41 AM 3,059 Views
Iron Contributor

Semantic kernel Bot in-a-box


The era of information has made it incredibly valuable to interact with and gain insights from data. With the emergence of advanced AI technologies, integrating natural language processing with data has opened up new possibilities for data interaction. Semantic Kernel is a technology that combines artificial intelligence with software development to bring together large language models and software functionality. It is designed to show how AI can work together with human expertise and technical knowledge to create a solution where we can use intelligent tools that blend seamlessly into our digital world.


In this blog post, we are thrilled to discuss two new features for Semantic Kernel's AI-powered assistant - SQLPlugin and UploadPlugin.  SQLPlugin uses SQL to extract insights that can transform the way professionals interact with data, while UploadPlugin lets users upload documents and retrieve knowledge. These cutting-edge advancements are transforming how businesses operate, making them more efficient and productive.

1. Architecture

architecture (1).jpg




The process for message flow is as follows:


  1. End-users connect to a messaging channel where your bot is published, for example, Web, PowerBI dashboard, or Teams.
  2. Messages are processed through Azure Bot Services, which communicates with a .NET application running on App Services.
  3. The .NET application has a Semantic Kernel Stepwise Planner at its core, which elaborates a series of steps to process the user's request and then executes it.
  4. Each plan step is formulated through Azure OpenAI and then executed against Cognitive Search (traditional RAG pattern) or Azure SQL (structured data RAG).
  5. Cognitive search simplifies data retrieval from multiple cloud sources by ingesting and indexing the data, while Azure SQL contains customer data from the AdventureWorksLT sample.
  6. Azure OpenAI decides which data source each question gets routed to. Questions may also span multiple data sources.

2. Pre-requisites

3. Recommended deployment parameters

For this tutorial, you will deploy Document Intelligence, SQL, and Cognitive Search resources using the Semantic Kernel Bot-in-a-box accelerator. This will ensure a seamless and efficient setup process with optimal deployment parameters.

  • Azure_location = "East US 2"
  • gptModel = "gpt-4" 
  • gptVersion = "1106-preview" 
  • deployDocIntel
  • deploySql = True 
  • deploySearch = true 
  • publicNetworkAccess = True 

4. Deploy to Azure

  1. Clone this repository locally:

git clone


Then, access to the semantic-kernel-bot-in-a-box




  1. Deploy resources:

Running the following command in your terminal : 

azd up

Add the parameters by following the recommended parameters to use SQL assistant and upload the document for search using retrieval-augmented generation.


3. Use Case 1: SQL-powered GenAI assistant.


Consider the task of extracting the top 10 product figures with prices and categories. With the SQL Assistant plugin, the analyst can easily extract the top 10 product figures with prices and categories. The GPT-4 model interprets the request and translates it into SQL, providing a structured representation of the data sourced directly from the database.

    1. Select your Azure Bot resource from the menu on the Azure portal for this first use case.

    2. Test the bot by asking some sample questions
      •  Can you provide the top 10 list of all products, their prices, and the categories they belong to?
      •  How much in total sales do we have?
      • What are my biggest customers?
      • What are my top-selling products?





4. Use Case 2: AI Search Retrieval-augmented generation.


Envision a scenario where users effortlessly extract valuable information from uploaded documents. Integrated with GPT-4, a document processing system adeptly analyzes diverse document types, including PDFs. Simultaneously, the system collaborates with HR processes, extracting insights from employee data for strategic workforce planning. This seamless integration enhances efficiency and reduces manual effort in extracting information from various document formats.


      1. To retrieve the information, kindly select the document you wish to use.
      2. After uploading, you can enter your prompt by typing it in.
        Sample prompt :
        How does HRM contribute to achieving an organization’s strategic goals through its functional objectives?



5. Embed the web chat.


In the context of communication applications, a channel refers to a means of establishing a connection between a bot and its users. By registering with Azure, a bot can leverage channels to facilitate effective communication with its users.


To configure a bot to connect to a channel, complete the following steps:

      1. Select the bot that you want to configure.
      2. In the left pane, select Channels under Settings.
      3. Select the channel icon you want to add to your bot in the right pane. You may need to scroll down to see the list of all Available Channels.





Embed the web chat control on a web page.

      1. Under Settings, select Channels. Then select Web Chat.
      2. The Web Chat page will open. Select the Default Site from the list of Sites.
      3. Copy the first Secret key and the Embed code.





6. Integrated the Bot in Power BI Dashboard

To enrich your reports and dashboards, you can easily incorporate HTML content by either manually entering the embedded code or copying and pasting it from popular websites like YouTube, Twitter, and This feature provides a convenient way to enhance your reports and dashboards' visual appeal and functionality.

      1. From the Add tile window, select Web content > Next.
      1. Add information to the Add web content tile window:
      1. To display a title above the tile, select Display title and subtitle and enter a Title and an optional Subtitle.
      2. Enter the embed code. In this example, we're copying and pasting a Twitter feed.
      3. Select Apply.





On the dashboard, resize and move the web content tile as needed.





Congratulations on exploring the Semantic Kernel Bot in-a-box, the innovative solution revolutionizing data interaction. This advanced platform features the SQL-Powered GenAI Assistant and the Upload document Plugin, which can easily manage complex analyses and document processing. Azure's infrastructure ensures a secure and scalable environment that's easy to set up. With Power BI dashboards, you'll get real-time insights and analytics. The Semantic Kernel Bot in-a-box makes data interaction more user-friendly and accessible, and it's a great example of how AI can transform howt we work with data.


7. Ressources

Create AI agents with Semantic Kernel | Microsoft Learn

How to quickly start with Semantic Kernel | Microsoft Learn

Azure OpenAI Service models - Azure OpenAI | Microsoft Learn

AI-in-a-Box/gen-ai/semantic-kernel-bot-in-a-box at main · Azure/AI-in-a-Box (

1 Comment
Version history
Last update:
‎Feb 07 2024 09:34 AM
Updated by: