In at present’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 information 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.information and Milvus for environment friendly information retrieval. By integrating these instruments, you may create a bot that may search and supply solutions to queries primarily based in your group’s information sources. We are going to use IBM WatsonX.information to populate and question related paperwork and IBM WatsonX.ai to reply questions from the fetched paperwork.
The tutorial is split into two primary elements: the primary focuses on populating the database utilizing both IBM WatsonX Knowledge or open-source Milvus, and the second half reveals easy methods to run a Python program domestically to attach the bot to Slack, leveraging WatsonX.ai for clever responses to consumer queries.
By the top of this tutorial, you may have a completely useful Slack bot that enhances your staff’s means to entry and make the most of necessary info, boosting general productiveness.
Conditions
Earlier than you start, guarantee you’ve the next:
- IBM Cloud account: Entry to IBM WatsonX.ai and WatsonX Knowledge for information retrieval and AI mannequin integration
- Milvus vector database: Familiarity with Milvus for storing and querying vectorized information; you need to use 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 information: Proficiency in Python, together with expertise with APIs, working with cloud companies, and dealing with surroundings variables
Step 1: Setting Up WatsonX.information and WatsonX Challenge
Set Up WatsonX.information
- Create an IBM Cloud account: Join at IBM Cloud in the event you do not have already got an account.
- Create a WatsonX.information occasion: Within the IBM Cloud catalog, seek for and create a WatsonX.information occasion by selecting up the plan and offering the mandatory particulars.
Set Up WatsonX Challenge
- Create a WatsonX Challenge: On the IBM Cloud Dashboard, navigate to the WatsonX dwelling web page and launch the watsonx.ai beneath capabilities. Create a sandbox venture.
- Receive Challenge ID and URL:
- Navigate to the Handle web page of your WatsonX venture to find the Challenge ID.
- Inside your newly created venture, beneath the “Manage” tab, choose “Services & integrations” on the left menu.
- Choose the blue “Associate service +” button. Select the accessible “Watson Machine Learning” service identify from the listing.
- Determine the URL of the Watson Machine Studying occasion related together with your venture. This URL varies primarily based on the area the place your ML occasion is created and will probably 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
- Dallas:
Step 2: Setting Up Milvus Server
You’ll be able to arrange the Milvus server in two methods: utilizing IBM WatsonX.information or the open-source Milvus database.
Setting Up Milvus Utilizing IBM WatsonX.information
- Log in to the WatsonX.information Console.
- Navigate to Infrastructure Supervisor.
- Add Milvus Service:
- Click on Add element and choose Add service.
- Choose Milvus from the Kind listing.
- Configure the Milvus Service:
- Show Identify: Enter the Milvus service identify.
- Add Storage Bucket: Affiliate an exterior bucket or choose an IBM-managed bucket for the Starter dimension.
- Provision the Milvus Service: Click on Provision.
Create Knowledge Supply Connection to Milvus
- In Your WatsonX.ai Challenge:
- Beneath the “Asset” tab, choose New asset +.
- Hook up with Knowledge Supply:
- Select the tile Join to an information supply.
- Seek for Milvus and click on Choose.
- Present Connection Particulars:
- Title: Enter a title to 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 identify and licensed consumer credentials to entry the Milvus occasion.
Setting Up Open-Supply Milvus Server
1. Allocate Extra Reminiscence to Docker
Enhance Docker reminiscence to not less than 8GB via 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 Utility
Making a Slack Utility
- Navigate to Slack API.
- Click on on “Create App” -> “From Scratch”.
- Present an app identify and choose the workspace the place you wish to deploy your bot.
- Beneath your Slack software settings, navigate to “OAuth & Permissions.”
- Click on on “Add an OAuth Scope” and add “channels:history” and “chat:write” as bot token scopes.
Receive Tokens
- Get the
SLACK_TOKEN
from “OAuth & Permissions.” - Get the
SIGNING_SECRET
from “Basic Information.”
Step 4: Setting Up the Challenge and Operating the Utility
Clone the Repository and Set up Dependencies:
Clone the repository:
git clone https://github.com/PhaniDivi-613/doc-assistant
Navigate to the venture listing and set up the required modules:
cd doc-assistant
pip set up -r necessities.txt
Setup the Atmosphere:
Create an .env
file within the venture 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:
- Place all runbooks or information switch paperwork within the
knowledge_source
folder. - Populate the database by operating the
populate_db.py
script:
python populate_db.py --opensource-milvus # Use this flag if utilizing open-source Milvus
python populate_db.py # Use this if utilizing IBM watsonx.information
Run Your Python App and Create a Tunnel With Ngrok:
Begin your Python Flask software:
python3 app.py --opensource-milvus # If utilizing open-source Milvus
python3 app.py # If utilizing IBM watsonx.information
In a brand new terminal window, create a tunnel utilizing ngrok
:
Copy the forwarding URL from the ngrok
terminal output.
Replace Slack Configuration
- In your Slack software settings, navigate to “Event Subscriptions.”
- Replace the “Request URLs” discipline together with your
ngrok
URL adopted by/events-endpoint
. - Add bot consumer occasions:
message.channels
message.channels
- Save the modifications in your Slack software settings.
Work together With Your App
- Invite your bot to the Slack channel the place you need it to function.
- Within the Slack channel, ship a message to set off the bot. For instance:
@dev-assistant The right way to get atracker account settings utilizing CLI? - Await the bot to course of your request and generate a response.
Conclusion
By following these steps, you’ve efficiently arrange a Slack software built-in with a Milvus database for information 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 primarily based on the supplied runbooks and information sources.