API which manages user conversation with virtual assistant
HTTP RESTful API.
Requests pass data via JSON encoded bodies except for in GET requests where data will be passed via URL and query parameters.
Responses will always return JSON.
chatbot-api makes use of IBM`s watson api to create conversations. It uses natural language understanding, and integrated dialog tools to create conversation flows between serverless-registry-api and users.
The Chatbot API server can be run locally. Visit DESIGN.md to see all endpoints and corresponding responses.
Follow the steps in the Database, Configuration, and Run sections.
Start a local MongoDB server by running:
make db
For local development, create a Wastson Assitant
instance in a IBM Cloud Catalog. The instance will be created in a default
resource group.
Launch the Watson Assistant using dashboard and import the skill available in https://github.com/knative-scout/chat-bot-api/tree/master/training/data/skill-basic-dialogue.json
Configuration is passed via environment variables.
BOTUSER_KEY
: API key assigned to the botWORKSPACE_ID
:Unique id given to the created skillAPP_DB_HOST
: Database hostAPP_DB_NAME
: Database nameAPP_DB_USER
: User for this databaseAPP_DB_PASSWORD
: Database user password
You can create and inject your own training data / skill by using functions in https://github.com/knative-scout/chat-bot-api/tree/master/training/features
Start the server by running:
pip install -r requirements.txt
python app.py
Create a copy of deploy/values.secrets.example.yaml
named
deploy/values.secrets.ENV.yaml
for whichever deployment environment you wish
to configure.
Edit this file with your own values.
Never commit this file.
Initialize submodules:
git submodule update --init --recursive
Deploy production by running:
make deploy-prod
If this is the first time production has been deployed run:
make rollout-prod
- Search by selecting
searching apps
option
>>user: Hey
>>scout: Hi! I am Scout. I can help you with :
- Searching apps
- Deploy apps
- Learn serverless
>>user: (<Selects seraching apps option>)
>>scout: What type of app?
>>user: serverless apps
>>scout: (<List of all serverless apps>)
- Direct Search
>>user: get me serverless apps
>>scout: (<List of all serverless apps>)
- Search by selecting
deploy apps
option with access to cluster
>>user: Hey
>>scout: Hi! I am Scout. I can help you with :
- Searching apps
- Deploy apps
- Learn serverless
>>user: (<Selects deploy apps option>)
>>scout: What type of app?
>>user: serverless apps
>>scout: (<List of all serverless apps to deploy>)
>>user: (< Selects an app from list to deploy >)
>>scout: I remember the app you have selected. Please confirm that you have knative installed on a cluster and have access to that cluster.
>>user: Yes
>>scout: Your app id is <App id>.
< Provides command to deploy app on cluster>
- Direct Deploy cluster with access to cluster
>>user: Deploy serverless apps
>>scout: (<List of all serverless apps to deploy>)
>>user: (< Selects an app from list to deploy >)
>>scout: I remember the app you have selected. Please confirm that you have knative installed on a cluster and have access to that cluster.
>>user: Yes
>>scout: Your app id is <App id>.
< Provides command to deploy app on cluster>
- Deploy with no access to cluster
>>user: Deploy serverless apps
>>scout: (<List of all serverless apps to deploy>)
>>user: (< Selects an app from list to deploy >)
>>scout: I remember the app you have selected. Please confirm that you have knative installed on a cluster and have access to that cluster.
>>user: No, I don`t have a cluster
>>scout: To learn how to get your own cluster with knative, visit https://docs.openshift.com/container-platform/3.3/getting_started/administrators.html.
Do you want to save this app to deploy later?
>>user: Yes (< User goes away and creates the cluster >)
>>user: Deploy saved app.
>>scout: Sure. Please confirm you have access to cluster.
>>user: yes
>>scout: Your app id is <App id>.
< Provides command to deploy app on cluster>
- Ask questions by selecting
learn serverless
option
>>user: Hey
>>scout: Hi! I am Scout. I can help you with :
- Searching apps
- Deploy apps
- Learn serverless
>>user: (<Selects learn serverless option>)
>>scout: What do you want to learn ?
>>user: What are serverless architectures?
>>scout: (< Text providing an explanation and link to the resource >)
- Ask questions directly
>>user: What are serverless architectures?
>>scout: (< Text providing an explanation and link to the resource >)
User can ask to start over
at any point in conversation
>>user: Deploy serverless apps
>>scout: (<List of all serverless apps to deploy>)
>>user: (< Selects an app from list to deploy >)
>>scout: I remember the app you have selected. Please confirm that you have knative installed on a cluster and have access to that cluster.
>>user: start over
>>scout: Hi! I am Scout. I can help you with :
- Searching apps
- Deploy apps
- Learn serverless
User can ask to quit
at any point in conversation
>>user: Deploy serverless apps
>>scout: (<List of all serverless apps to deploy>)
>>user: (< Selects an app from list to deploy >)
>>scout: I remember the app you have selected. Please confirm that you have knative installed on a cluster and have access to that cluster.
>>user: Forget it
>>scout: Okay. Action aborted.