IBM WatsonX Information With Milvus To Construct a Slack Bot – DZone – Uplaza

In in the present day’s fast-paced work surroundings, fast and easy accessibility to info is essential for sustaining productiveness and effectivity. Whether or not it is discovering particular directions in a runbook or accessing key data switch (KT) paperwork, the power to retrieve related info swiftly could make a major distinction.

This tutorial will information you thru constructing an clever Slack bot that leverages IBM WatsonX.knowledge and Milvus for environment friendly data retrieval. By integrating these instruments, you may create a bot that may search and supply solutions to queries based mostly in your group’s data sources. We are going to use IBM WatsonX.knowledge to populate and question related paperwork and IBM WatsonX.ai to reply questions from the fetched paperwork.

The tutorial is split into two foremost components: the primary focuses on populating the database utilizing both IBM WatsonX Information or open-source Milvus, and the second half reveals find out how to run a Python program domestically to attach the bot to Slack, leveraging WatsonX.ai for clever responses to person queries.

By the tip of this tutorial, you may have a completely practical Slack bot that enhances your staff’s capacity to entry and make the most of vital info, boosting general productiveness.

Stipulations

Earlier than you start, guarantee you might have the next:

  • IBM Cloud account: Entry to IBM WatsonX.ai and WatsonX Information for data retrieval and AI mannequin integration
  • Milvus vector database: Familiarity with Milvus for storing and querying vectorized knowledge; you should utilize both the open-source Milvus or IBM’s managed Milvus service.
  • Slack workspace: Administrator entry to configure and deploy a Slack bot inside your workspace
  • Programming data: Proficiency in Python, together with expertise with APIs, working with cloud providers, and dealing with surroundings variables

Step 1: Setting Up WatsonX.knowledge and WatsonX Mission

Set Up WatsonX.knowledge

  1. Create an IBM Cloud account: Enroll at IBM Cloud in the event you do not have already got an account.
  2. Create a WatsonX.knowledge occasion: Within the IBM Cloud catalog, seek for and create a WatsonX.knowledge occasion by selecting up the plan and offering the required particulars.

Set Up WatsonX Mission

  1. Create a WatsonX Mission: On the IBM Cloud Dashboard, navigate to the WatsonX dwelling web page and launch the watsonx.ai beneath capabilities. Create a sandbox undertaking.
  2. Acquire Mission ID and URL:
    • Navigate to the Handle web page of your WatsonX undertaking to find the Mission ID.
    • Inside your newly created undertaking, beneath the “Manage” tab, choose “Services & integrations” on the left menu. 
    • Choose the blue “Associate service +” button. Select the out there “Watson Machine Learning” service title from the checklist.
    • Determine the URL of the Watson Machine Studying occasion related together with your undertaking. This URL varies based mostly on the area the place your ML occasion is created and will likely be within the following format: https://.ml.cloud.ibm.com.
      • Dallas: https://us-south.ml.cloud.ibm.com
      • London: https://eu-gb.ml.cloud.ibm.com
      • Frankfurt: https://eu-de.ml.cloud.ibm.com
      • Tokyo: https://jp-tok.ml.cloud.ibm.com

Step 2: Setting Up Milvus Server

You’ll be able to arrange the Milvus server in two methods: utilizing IBM WatsonX.knowledge or the open-source Milvus database.

Setting Up Milvus Utilizing IBM WatsonX.knowledge

  1. Log in to the WatsonX.knowledge Console.
  2. Navigate to Infrastructure Supervisor.
  3. Add Milvus Service:
    • Click on Add element and choose Add service.
    • Choose Milvus from the Sort checklist.
  4. Configure the Milvus Service:
    • Show Identify: Enter the Milvus service title.
    • Add Storage Bucket: Affiliate an exterior bucket or choose an IBM-managed bucket for the Starter measurement.
  5. Provision the Milvus Service: Click on Provision.

Create Information Supply Connection to Milvus

  1. In Your WatsonX.ai Mission:
    • Below the “Asset” tab, choose New asset +.
  2. Hook up with Information Supply:
    • Select the tile Join to an information supply.
    • Seek for Milvus and click on Choose.
  3. Present Connection Particulars:
    • Title: Enter a title on your connection (e.g., “Milvus connection”).
    • Milvus Hostname, Port, Database Identify, Username, and Password:
      • Get the Milvus host and port info from the Infrastructure Supervisor (click on the Milvus service to open the Particulars web page).
      • Present the database title and approved person credentials to entry the Milvus occasion.

Setting Up Open-Supply Milvus Server

1. Allocate Further Reminiscence to Docker

Enhance Docker reminiscence to not less than 8GB by Docker desktop settings.

2. Obtain Docker Compose Configuration

Create a listing and obtain the Docker Compose file:

mkdir milvus_compose cd milvus_compose wget https://github.com/milvus-io/milvus/releases/obtain/v2.2.8/milvus-standalone-docker-compose.yml -O docker-compose.yml

3. Run Milvus Utilizing Docker Compose

  • Begin Milvus:

    docker compose up -d

  • Confirm containers are operating:

    docker ps -a

Step 3: Making a Slack Software

Making a Slack Software

  • Navigate to Slack API.
  • Click on on “Create App” -> “From Scratch”.
  • Present an app title and choose the workspace the place you need to deploy your bot.
  • Below your Slack utility settings, navigate to “OAuth & Permissions.”
  • Click on on “Add an OAuth Scope” and add “channels:history” and “chat:write” as bot token scopes.

Acquire Tokens

  1. Get the SLACK_TOKEN from “OAuth & Permissions.”
  2. Get the SIGNING_SECRET from “Basic Information.”

Step 4: Setting Up the Mission and Operating the Software

Clone the Repository and Set up Dependencies:

Clone the repository:

git clone https://github.com/PhaniDivi-613/doc-assistant

Navigate to the undertaking listing and set up the required modules:

cd doc-assistant
pip set up -r necessities.txt

Setup the Setting:

Create an .env file within the undertaking listing and populate it with the next values collected in earlier steps:

PROJECT_ID=
PROJECT_URL=
IC_API_KEY=
SLACK_TOKEN=
SIGNING_SECRET=

Populate the Database With Runbooks:

  1. Place all runbooks or data switch paperwork within the knowledge_source folder.
  2. Populate the database by operating the populate_db.pyscript:
python populate_db.py --opensource-milvus  # Use this flag if utilizing open-source Milvus
python populate_db.py  # Use this if utilizing IBM watsonx.knowledge

Run Your Python App and Create a Tunnel With Ngrok:

Begin your Python Flask utility:

python3 app.py --opensource-milvus  # If utilizing open-source Milvus
python3 app.py  # If utilizing IBM watsonx.knowledge

In a brand new terminal window, create a tunnel utilizing ngrok:

Copy the forwarding URL from the ngrok terminal output.

Replace Slack Configuration

  1. In your Slack utility settings, navigate to “Event Subscriptions.”
  2. Replace the “Request URLs” discipline together with your ngrok URL adopted by /events-endpoint.
  3. Add bot person occasions:
    • message.channels
    • message.channels
  4. Save the adjustments in your Slack utility settings.

Work together With Your App

  1. Invite your bot to the Slack channel the place you need it to function.
  2. Within the Slack channel, ship a message to set off the bot. For instance:
    @dev-assistant Learn how to get atracker account settings utilizing CLI?
  3. Look forward to the bot to course of your request and generate a response.

Conclusion

By following these steps, you might have efficiently arrange a Slack utility built-in with a Milvus database for data administration. Now you can work together together with your bot in Slack, check its performance, and expertise its AI-powered capabilities. This setup permits for environment friendly question dealing with and clever responses based mostly on the supplied runbooks and data sources.

Share This Article
Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

Exit mobile version