Nebula Siwi: A Dialog System With Graph Database Backed Knowledge Graph

a PoC of Dialog System With Graph Database Backed Knowledge Graph.
Related GitHub Repo: https://github.com/wey-gu/nebula-siwi/
I created the Katacoda Interactive Env for this project 👉🏻 https://siwei.io/cources/
Now you can play with the data on Nebula Playground: https://nebula-graph.io/demo/
Siwi the voice assistant
Siwi (/ˈsɪwi/) is a PoC of Dialog System With Graph Database Backed Knowledge Graph.
For now, it’s a demo for task-driven(not general purpose) dialog bots with KG(Knowledge Graph) leveraging Nebula Graph with the minimal/sample dataset from Nebula Graph Manual/ NG中文手册.
Tips: Now you can play with the graph online without installing yourself!
Supported queries:
relation
:
- What is the relationship between Yao Ming and Lakers?
- How does Yao Ming and Lakers connected?
serving
:
- Which team had Yao Ming served?
friendship
:
- Whom does Tim Duncan follow?
- Who are Yao Ming’s friends?
1 Deploy and Try
TBD (leveraging docker and nebula-up)
2 How does it work?
This is one of the most naive pipeline for a specific domain/ single purpose chat bot built on a Knowledge Graph.
2.1 Backend
The Backend(Siwi API) is a Flask based API server:
-
Flask API server takes questions in HTTP POST, and calls the bot API.
-
In bot API part there are classfier(Symentic Parsing, Intent Matching, Slot Filling), and question actors(Call corresponding actions to query Knowledge Graph with intents and slots).
-
Knowledge Graph is built on an Open-Source Graph Database: Nebula Graph
2.2 Frontend
The Frontend is a VueJS Single Page Applicaiton(SPA):
- I reused a Vue Bot UI to showcase a chat window in this human-agent interaction, typing is supported.
- In addtion, leverating Chrome’s Web Speech API, a button to listen to human voice is introduced
2.3 A Query Flow
|
|
2.4 Source Code Tree
|
|
3 Manually Run Components
3.1 Backend
Install and run.
|
|
For OpenFunction/ KNative
|
|
Try it out Web API:
|
|
Call Bot Python API:
|
|
Then a response will be like this:
|
|
3.2 Frontend
Referring to siwi_frontend
4 Further work
- Use NBA-API to fallback undefined pattern questions
- Wrap and manage sessions instead of get and release session per request, this is somehow costly actually.
- Use NLP methods to implement proper Symentic Parsing, Intent Matching, Slot Filling
- Build Graph to help with Intent Matching, especially for a general purpose bot
- Use larger Dataset i.e. from wyattowalsh/basketball
5 Thanks to Upstream Projects ❤️
5.1 Backend
- I learnt a lot from the KGQA on MedicalKG created by Huanyong Liu
- Flask
- pyahocorasick created by Wojciech Muła
- PyYaml
5.2 Frontend
- VueJS for frontend framework
- Vue Bot UI, as a lovely bot UI in vue
- Vue Web Speech, for speech API vue wrapper
- Axios for browser http client
- Solarized for color scheme
- Vitesome for landing page design
Image credit goes to https://unsplash.com/photos/0E_vhMVqL9g