<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Yulong Liu</title>
    <description>The latest articles on Forem by Yulong Liu (@liuyl).</description>
    <link>https://forem.com/liuyl</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1072846%2F481359a5-f9b7-45fb-ba28-ab126703cfbb.jpeg</url>
      <title>Forem: Yulong Liu</title>
      <link>https://forem.com/liuyl</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/liuyl"/>
    <language>en</language>
    <item>
      <title>[Tutorial] Setup Your in House AI Slack Bot for Data Analytics in Natural Language</title>
      <dc:creator>Yulong Liu</dc:creator>
      <pubDate>Thu, 27 Apr 2023 13:40:20 +0000</pubDate>
      <link>https://forem.com/liuyl/tutorial-setup-your-in-house-ai-slack-bot-for-data-analytics-in-natural-language-1nbg</link>
      <guid>https://forem.com/liuyl/tutorial-setup-your-in-house-ai-slack-bot-for-data-analytics-in-natural-language-1nbg</guid>
      <description>&lt;p&gt;Learn more about our open source project on &lt;a href="https://github.com/logunify/dsensei/"&gt;Github&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In today's data-driven world, organizations are constantly looking for ways to make their data analysis process more efficient and streamlined.  The recent surge in Large Language Model technologies has revolutionized the field of analytics by enabling natural language interactions, which gave access to data analytics to everyone. DSensei is an open-source Slack bot that connects this technology with people by enabling &lt;br&gt;
them to request data analytics in plain English directly within their familiar instant messaging tool.&lt;/p&gt;

&lt;p&gt;In this post, we'll walk through the steps to setup Dsensei in Slack connecting to BigQuery as its data source.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A Slack account with admin access to the workspace to install Dsensei&lt;/li&gt;
&lt;li&gt;An OpenAI API key (you can generate from this &lt;a href="https://platform.openai.com/account/api-keys"&gt;link&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;A Google Cloud account with &lt;code&gt;roles/iam.serviceAccountCreator&lt;/code&gt; IAM role to create a service account for BigQuery (see this &lt;a href="https://cloud.google.com/iam/docs/service-accounts-create#permissions"&gt;doc&lt;/a&gt; for detail)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Setup
&lt;/h2&gt;

&lt;p&gt;Now let's start the setup process.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1. Create an Setup Slack App
&lt;/h3&gt;

&lt;p&gt;First let's create a new Slack App and install it to the workspace:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sign in to your Slack account in browser and navigate to &lt;a href="https://api.slack.com/apps"&gt;https://api.slack.com/apps&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;Click on the "Create New App" button to create a new app, and select "From an app manifest".&lt;/li&gt;
&lt;li&gt;Select the workspace you want to install the app into.&lt;/li&gt;
&lt;li&gt;Inside the "Enter app manifest below" dialog select the format to YAML and paste the following manifest:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt; &lt;span class="na"&gt;display_information&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;sensei&lt;/span&gt;
&lt;span class="na"&gt;features&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;app_home&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;home_tab_enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;false&lt;/span&gt;
    &lt;span class="na"&gt;messages_tab_enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
    &lt;span class="na"&gt;messages_tab_read_only_enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;false&lt;/span&gt;
  &lt;span class="na"&gt;bot_user&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;display_name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;sensei&lt;/span&gt;
    &lt;span class="na"&gt;always_online&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
  &lt;span class="na"&gt;slash_commands&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/info&lt;/span&gt;
      &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Get information about DB&lt;/span&gt;
      &lt;span class="na"&gt;usage_hint&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;/info [dbs] | [tables db] | [schema db.table]&lt;/span&gt;
      &lt;span class="na"&gt;should_escape&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;false&lt;/span&gt;
&lt;span class="na"&gt;oauth_config&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;scopes&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;bot&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;app_mentions:read&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;chat:write&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;commands&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;im:history&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;files:write&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;files:read&lt;/span&gt;
&lt;span class="na"&gt;settings&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;event_subscriptions&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;bot_events&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;app_mention&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;message.im&lt;/span&gt;
  &lt;span class="na"&gt;interactivity&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;is_enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
  &lt;span class="na"&gt;org_deploy_enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;false&lt;/span&gt;
  &lt;span class="na"&gt;socket_mode_enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;true&lt;/span&gt;
  &lt;span class="na"&gt;token_rotation_enabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="no"&gt;false&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2. Setup BigQuery Credentials
&lt;/h3&gt;

&lt;p&gt;Then let's create a Google Cloud Service Account Dsensei to access Bigquery:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Sign in to your Google Cloud console in browser and navigate to &lt;a href="https://console.cloud.google.com/iam-admin/serviceaccounts"&gt;https://console.cloud.google.com/iam-admin/serviceaccounts&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Select the project you want Dsensei to have access to and you should get into the service account management page.&lt;/li&gt;
&lt;li&gt;Click "+Create service account".&lt;/li&gt;
&lt;li&gt;Input "Dsensei" to the "Service account name" and "dsensei" to the "Service account ID", optionally you can also put some description. Click "CREATE AND CONTINUE".
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UuoEbnFu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.dsensei.dev/blog/setup-in-house-slack-bot-for-data-analytics/gcp-service-account-step1.png" alt="screenshot" width="621" height="601"&gt;
&lt;/li&gt;
&lt;li&gt;Grant the "BigQuery Data Viewer" and "BigQuery Job User" role to the service account and click "Done".
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Om_QBBso--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.dsensei.dev/blog/setup-in-house-slack-bot-for-data-analytics/gcp-service-account-step2.png" alt="screenshot" width="594" height="602"&gt;
&lt;/li&gt;
&lt;li&gt;Locate the newly create service account in the list, toggle the "Action" menu and click the "Manage keys" button.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--v4aHlwoc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.dsensei.dev/blog/setup-in-house-slack-bot-for-data-analytics/gcp-service-account-locate.png" alt="screenshot" width="765" height="497"&gt;
&lt;/li&gt;
&lt;li&gt;In the "Keys" tab click "ADD KEY" -&amp;gt; "Create new key" to open the key creation dialog.&lt;/li&gt;
&lt;li&gt;Inside the key creation dialog, select "JSON" key type and click "CREATE".&lt;/li&gt;
&lt;li&gt;It should download the json file, save the json file into the proper path and we will use it later.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Step 3. Setup DSensei Service
&lt;/h3&gt;

&lt;p&gt;Now with the Slack App and BigQuery access setup, let's setup the Dsensei service:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Checkout the Dsensei repo: &lt;code&gt;git clone https://github.com/logunify/dsensei.git&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Switch to Node 18. You can do that with &lt;code&gt;nvm use 18&lt;/code&gt;, details about nvm installation and usage can be found in this &lt;a href="https://github.com/nvm-sh/nvm#installing-and-updating"&gt;doc&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Inside the checked out dsensei folder, run &lt;code&gt;npm install&lt;/code&gt; to install all the dependencies.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Config credentials, we provide a template on the config, you can use it by renaming &lt;code&gt;.env.example&lt;/code&gt; to &lt;code&gt;.env&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Config slack credentials:&lt;/li&gt;
&lt;li&gt;Goto &lt;a href="https://api.slack.com/apps"&gt;https://api.slack.com/apps&lt;/a&gt; and select the app you just created.&lt;/li&gt;
&lt;li&gt;On the sidebar, select "OAuth &amp;amp; Permissions", and find the oauth token under "Oauth Tokens for Your Workspace" section. It should start with &lt;code&gt;xoxb-&lt;/code&gt;. Copy the token put it under &lt;code&gt;SLACK_BOT_TOKEN&lt;/code&gt; in the &lt;code&gt;.env&lt;/code&gt; file.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oDWe73ZH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.dsensei.dev/blog/setup-in-house-slack-bot-for-data-analytics/slack-bot-token-screenshot.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oDWe73ZH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.dsensei.dev/blog/setup-in-house-slack-bot-for-data-analytics/slack-bot-token-screenshot.png" alt="screenshot" width="488" height="463"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Then select the "Basic Information" on sidebar, and find the "Signing Secret" under the "App Credentials" section. Copy the secret and put it under &lt;code&gt;SLACK_SIGNING_SECRET&lt;/code&gt; in the &lt;code&gt;.env&lt;/code&gt; file.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YDCizD17--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.dsensei.dev/blog/setup-in-house-slack-bot-for-data-analytics/signing-secret-screenshot.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YDCizD17--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.dsensei.dev/blog/setup-in-house-slack-bot-for-data-analytics/signing-secret-screenshot.png" alt="screenshot" width="529" height="524"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Finally locate "App-Level Tokens" section under the "Basic Information" tab and click the "Generate Token and Scopes" button to generate a app token. Add the &lt;code&gt;connections:write&lt;/code&gt; scope in the dialog and click "Generate" to generate the token. The Slack App Token should start with &lt;code&gt;xapp-&lt;/code&gt;. Copy the token and put it under &lt;code&gt;SLACK_APP_TOKEN&lt;/code&gt; in the &lt;code&gt;.env&lt;/code&gt; file.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hH_AxrHD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.dsensei.dev/blog/setup-in-house-slack-bot-for-data-analytics/app-token-screenshot.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hH_AxrHD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.dsensei.dev/blog/setup-in-house-slack-bot-for-data-analytics/app-token-screenshot.png" alt="screenshot" width="603" height="395"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Config OpenAI API key:&lt;/li&gt;
&lt;li&gt;Find your OpenAI API key in this &lt;a href="https://platform.openai.com/account/api-keys"&gt;page&lt;/a&gt;, copy the token and put it under &lt;code&gt;OPENAI_API_KEY&lt;/code&gt; in the &lt;code&gt;.env&lt;/code&gt; file.&lt;/li&gt;
&lt;li&gt;Config BigQuery key:&lt;/li&gt;
&lt;li&gt;In the &lt;code&gt;.env&lt;/code&gt; file, set &lt;code&gt;BQ_KEY&lt;/code&gt; to the path to the key file we generated above for the service account, like &lt;code&gt;/Users/foo/gcp/dsensei.json&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;[Optional] Whitelist dataset and tables.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You might want to limit the dataset / tables this tool can access, you can do so by list the dataset in a comma separated string in the &lt;code&gt;DATABASES&lt;/code&gt; field, and / or comma separated &lt;code&gt;dataset.tablename&lt;/code&gt; list in the &lt;code&gt;TABLES&lt;/code&gt; field.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Start DSensei and Verify in Slack!
&lt;/h2&gt;

&lt;p&gt;That's it, now we should have everything setup, let's start Dsensei and verify it in Slack!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;[Optional] For the demo purpose, we copy a public sample &lt;a href="https://console.cloud.google.com/marketplace/product/bigquery-public-data/thelook-ecommerce"&gt;ecommerce dataset&lt;/a&gt; into our BigQuery project and name it &lt;code&gt;ecommerce&lt;/code&gt;:

&lt;ul&gt;
&lt;li&gt;Goto this &lt;a href="https://console.cloud.google.com/bigquery?p=bigquery-public-data&amp;amp;d=thelook_ecommerce&amp;amp;page=dataset"&gt;link&lt;/a&gt; and click "COPY" &lt;/li&gt;
&lt;li&gt;Select "CREATE NEW DATASET"&lt;/li&gt;
&lt;li&gt;Change the Project ID to the project we generate the service account in Step 2&lt;/li&gt;
&lt;li&gt;Click "CREATE DATASET"&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;npm run prod&lt;/code&gt; to start Dsensei service. You should see Dsensei initialize and loading schema in the logs. In our example, in looks like below:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;2023-04-26T23:10:00.526Z [SlackApp] info: 
    ____    _____                                _  
   / __ \  / ___/  ___    ____    _____  ___    (_)
  / / / /  \__ \  / _ \  / __ \  / ___/ / _ \  / /
 / /_/ /  ___/ / /  __/ / / / / (__  ) /  __/ / /
/_____/  /____/  \___/ /_/ /_/ /____/  \___/ /_/

2023-04-26T23:10:00.529Z [DataSourceLoader] info: Use data source from BigQuery
[INFO]  socket-mode:SocketModeClient:0 Going to establish a new connection to Slack ...
2023-04-26T23:10:00.782Z [SlackApp] info: Sensei is up running, listening on port 3000
2023-04-26T23:10:00.986Z [BigQuery] info: Loaded databases: ecommerce
[INFO]  socket-mode:SocketModeClient:0 Now connected to Slack
2023-04-26T23:10:01.414Z [BigQuery] info: Loaded table: ecommerce.distribution_centers
2023-04-26T23:10:01.448Z [BigQuery] info: Loaded table: ecommerce.users
2023-04-26T23:10:01.452Z [BigQuery] info: Loaded table: ecommerce.events
2023-04-26T23:10:01.454Z [BigQuery] info: Loaded table: ecommerce.products
2023-04-26T23:10:01.456Z [BigQuery] info: Loaded table: ecommerce.inventory_items
2023-04-26T23:10:01.504Z [BigQuery] info: Loaded table: ecommerce.orders
2023-04-26T23:10:01.529Z [BigQuery] info: Loaded table: ecommerce.order_items
2023-04-26T23:10:01.530Z [BigQuery] info: All 1 databases are loaded.
2023-04-26T23:10:04.334Z [BigQuery] info: Enrichment finished.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;Now is the fun part, let's play around with Dsensei in Slack:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a new channel and add &lt;code&gt;sensei&lt;/code&gt; to the channel (you can also locate the "sensei" under the "Apps" section on the left and ping it directly):
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eZCq80yH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.dsensei.dev/blog/setup-in-house-slack-bot-for-data-analytics/dsensei-slack-channel.png" alt="screenshot" width="800" height="423"&gt;
&lt;/li&gt;
&lt;li&gt;We start with commands to verify that schemas have been loaded. Send &lt;code&gt;/info dbs&lt;/code&gt; to get all the database and here's the response:
&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Your databases: 
--------------------
ecommerce
&lt;/code&gt;&lt;/pre&gt;



&lt;ul&gt;
&lt;li&gt;Send &lt;code&gt;/info tables ecommerce&lt;/code&gt; to get all the tables under &lt;code&gt;ecommerce&lt;/code&gt; dataset and here's the response:
&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Your tables in ecommerce: 
--------------------
distribution_centers
events
inventory_items
order_items
orders
products
users
&lt;/code&gt;&lt;/pre&gt;



&lt;ul&gt;
&lt;li&gt;Send &lt;code&gt;/info schema ecommerce products&lt;/code&gt; to get the detailed schema of the &lt;code&gt;products&lt;/code&gt; table and here's the response:
&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Table ecommerce.products schema:
name                    type     description
--------------------------------------------
                    id  INTEGER             
                  cost    FLOAT             
              category   STRING             
                  name   STRING             
                brand   STRING             
          retail_price    FLOAT             
            department   STRING             
                  sku   STRING             
distribution_center_id  INTEGER             
&lt;/code&gt;&lt;/pre&gt;



&lt;ul&gt;
&lt;li&gt;After verify the schemas are loaded, we will test with some data questions. Say we want to know the number of orders this month, we can simply just send "&lt;code&gt;@sensei how many new orders do I have this month?&lt;/code&gt;" and Dsensei will respond in a thread:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NiSXLp6L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.dsensei.dev/blog/setup-in-house-slack-bot-for-data-analytics/response-in-thread.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NiSXLp6L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.dsensei.dev/blog/setup-in-house-slack-bot-for-data-analytics/response-in-thread.png" alt="screenshot" width="550" height="542"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We can follow up with Dsensei within the thread, for instance with the number of orders we have this month, we want to know how does it compared with last month. Dsensei will memorize context of all conversation with the thread so we can directly ask the follow up question by sending "&lt;code&gt;@sensei how does it compare with last month?&lt;/code&gt;" in the thread, and we get:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qIAsyrMa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.dsensei.dev/blog/setup-in-house-slack-bot-for-data-analytics/follow-up-in-thread.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qIAsyrMa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.dsensei.dev/blog/setup-in-house-slack-bot-for-data-analytics/follow-up-in-thread.png" alt="screenshot" width="554" height="603"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;pretty cool huh?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It can answer more advanced question that needs to conduct more sql query. For instance, we want to know the brands that process their more effectively and limit to only brands with more than 100 orders to reduce the bias, which entails the question as: "&lt;code&gt;@sensei for those brands having more than 100 orders, give me the top 5 brands that fastest at shipping their orders?&lt;/code&gt;". &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TNuHm355--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.dsensei.dev/blog/setup-in-house-slack-bot-for-data-analytics/complex-query.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TNuHm355--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://www.dsensei.dev/blog/setup-in-house-slack-bot-for-data-analytics/complex-query.png" alt="screenshot" width="610" height="659"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Now we have everything setup, enjoy your analytics with DSensei!&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Closing Thought
&lt;/h2&gt;

&lt;p&gt;In conclusion, leveraging the power of chatbot to access and analyze data can greatly improve the efficiency and effectiveness of data analysis processes in organizations. DSensei is a great open-source Slack bot that can help you achieve this goal by allowing you to access and analyze data through natural language commands. By following the steps outlined in this post, you can easily set up DSensei and link it to your BigQuery data source to start benefiting from its features.&lt;/p&gt;

&lt;p&gt;We’re passionately developing this project and would love for you to be a part of our community on &lt;a href="https://github.com/logunify/dsensei"&gt;Discord&lt;/a&gt; where you can receive the latest news, report bugs, and make feature requests. Please also feel free to submit any feedback on github directly.&lt;/p&gt;

&lt;p&gt;Try a live demo of DSensei in our &lt;a href="https://join.slack.com/t/dsensei-demo/shared_invite/zt-1tt55ia3p-jMlofj8YHGnCMjuu30vJeg"&gt;Slack Channel&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Learn more about our open source project on &lt;a href="https://github.com/logunify/dsensei/"&gt;Github&lt;/a&gt;&lt;/p&gt;

</description>
      <category>chatgpt</category>
      <category>data</category>
      <category>analytics</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
