Repository for publishing the integrated story of Maximo Manage + Watson.ai + Watson Assistant & Discovery
This example of github repo is to demonstrate of the ability to leverage certain AI and Generative AI functionality already built into the product as well as all the new use cases that are being continuosuly added into the product. this is an example of showcasing Watson Assistant be integrated with Maximo Manage module
Below diagram presents the architecture view of application flow
High level architecture
Technical Flow
Pre-Requisites for setup
- Maximo Manage module installed and ability to make API requests to the application
- Watson Assistant Project created to upload the code snippet
- Environment to deploy "Flask" or 'IBM Code engine" to setup API's to make requests (API) from Watson Assistant
In this documentation lets explore about the following.
- How to run the application locally
- How to create Docker image
- How to deploy the Docker image in the Code Engine (to access the app remotely)
- Creating Open API using Swagger
- Create Custom Extension in Watson Assistant
- Add Custom Extension to Watson Assistant
- Create Action in Watson Assistant to call the custom extension
To run the application locally follow the below steps.
CLICK ME
-
Download this repo
-
Goto to the root folder of the repo.
-
Do the following steps.
-
Create
.env
file with the below entries. -
Update all the properties accordingly.
LOGLEVEL=INFO
GENAI_API="https://us-xxxxxx.ibm.com/ml/v1/text/generation?version=2023-05-29"
### IBMCloud API Key
GENAI_KEY="xxxxxxx"
GENAI_PROJECT_ID="1c915286-xxxxxxfa4e"
MAXIMO_ATTRRIBUTE_URL="https://xxxxxx.com/maximo/api/os/MXAPIMAXATTRIBUTE?oslc.where=persistent=1%20and%20objectname=%22"
MAXIMO_RUNSQL_URL="https://xxxxxxxxxxxx.com/maximo/api/script/runsql?lean=1&ignorecollectionref=1"
MAXIMO_API_KEY="xxxxxxxxxxxxx"
- Runs the below command to start the app
python main.py
- Open the below urls in a browser to verify the app is running.
- Run the below curl script to test the maximo api.
curl -X 'POST' \
'http://localhost:8080/maximo/' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-d '{
"query": "What is the worktype of workorder 1309?"
}'
It would give the output like the below.
{
"result": [
{
"WORKTYPE": "PM"
}
]
}
You can create docker images using podman and run the app in the code engine.
Here docker.io is used as a image repository. You can use as per your wish.
In the below example we used gandigit
as a docker id. You have to change it to your docker id.
CLICK ME
- Run the below command to login into docker.io
podman login -u gandigit docker.io
- Run the below command to create docker image
podman build --platform linux/amd64 -f Dockerfile -t docker.io/gandigit/maixmo-db-interface:latest .
- Run the below command to push the created image to the repository
podman push docker.io/gandigit/maixmo-db-interface:latest
Lets deploy the created docker image in the Code Engine.
CLICK ME
- In Projects screen, click on
Create
button
-
Choose
Location
as per your need. -
Enter any Project
Name
-
Click on
Create
button
Project is created.
- Click on the created project
- In Application screen, click on
Create
button
-
Enter any Application
Name
-
Enter the
Docker Image name
that we already created. -
Click on
Configure image
button
- Choose
https://index.docker.io/v1/
in theRegistry server
drop down list.
The rest of the details would be auto filled based on the docker image name that we entered in the previous screen.
- Click on
Done
button in the image configuration screen.
- Click on
Create
button
- Application got created.
- Click on the application name from the above screen.
The application page get displayed.
- Click on
Configuration
tab.
-
Click on
Environment Variables
tab. -
Click on
Add environment variable
menu.
-
Choose
Literal value
Option. -
Enter
Environment variable name
andValue
columns values. -
Click on
Add
Option.
-
Click on
Add
Option. The variable got created. -
Similarly create an entry for each Environment variables mentioned in the
.env-sample
file.
- Click on
Deploy
Option to redeploy the app with the created environment variables.
- In the application screen, Click on the
Open URL
link to open the application.
Lets create open API using swagger. This open api json is needed to create extension in Watson Assistant for WA and this app integration.
CLICK ME
-
Open the URL https://converter.swagger.io/ in your browser
-
In the
GET / Convertor
method, click on theTry it out
button
-
In the
URL
text box enter the App url suffixed withswagger.json
- Click on
Execute
button
The Open API json should have got created.
-
Click on
Download
button -
Open the downloaded json and update the App url as highlighted
The download file may look like this ./files/OpenAPI-Maximo.json
- In the above file you need to change the line no. 10
"url": "https://xxxx.appdomain.cloud"
with the appropriate url from the code engine.
Lets create Custom Extension in Watson Assistant to call the app.
CLICK ME
- In Watson Assistant, Click on
Integration
button
- Click on
Build custom extension
button
- Click on
Next
button
- Enter any Name for the extension.
- Click on
Drag and drop file here or click to upload
link
-
Choose the Open API Json that was generated in the previous section.
-
Click on
Next
button
-
See the list of APIs imported.
-
Click on
Finish
button
Once the Custom Extension is created, it has to be added to WA.
CLICK ME
- In the created Extension, Click on
Add
button
- Click on
Add
button
- Click on
Next
button
- Click on
Next
button
- Click on
Finish
button
Now this extension can be used in WA.
Lets create action in WA to use this extension.
CLICK ME
CLICK ME
- Click on
Actions
menu in WA
- Click on
New action
button
- Click on
Start from scratch
tile
- Enter name for the action.
- Click on
Save
button
- Click on
customer starts with
Tile
-
Edit the default start phrase to any. Ex:
Hi
-
Click on
Save
button
CLICK ME
- Click on Step 1 title
-
Enter the text like
Welcome to Maximo Assistant
-
Click on
Save
icon -
Click on
New Step
button to create new step.
CLICK ME
-
Enter the text like
Enter your Query :
-
Click on
Define customer response
link -
Click on
T Free Text
Option
- It looks like this.
CLICK ME
-
Click on
New Step
button on the above screen -
Enter the text like
Processing your Query .....
-
Click on
Continue to next step
link -
Click on
Use an extension
Option
- Choose
Maximo-Db-Interface
forExtension
- Choose
Post method example
forOperation
- Choose
Tr query
forParameters
- In
To
field chooseAction step variables
- Choose
2. Enter your query:
forTo
field (This is from the 2nd step)
- It will look like the below.
- Click on
Apply
button
- It will look like the below.
CLICK ME
-
Click on
New Step
button on the above screen -
Enter the text like
Here is the response for your Query. .....
-
Click on
Fx
icon -
Click on
Maximo-Db-interface (step 3)
Option
- Choose
body.result
.
The Python app returns JSON with a key called result
, which WA retrieved from the Open API uploaded in the extension creation section above
- It will look like the below.
CLICK ME
-
Click on
Preview
button on the above screen -
Enter the text
Hi
(Remember that thecustomer starts with
the step where we entered 'Hi'.)
- It shows 3 options. Choose the action
Gan Maximo Assistant
that we created
- Enter your query
What is the worktype of workorder 1309?
- See the response from the app.