Skip to content

Conversational agent with knowledge graph integration supporting multiple microworlds

Notifications You must be signed in to change notification settings

readerbench/conversational-agent

Repository files navigation

Pepper conversational agent

Description

Conversational agent (supporting Romanian language), that can make use of a knowledge graph database to represent, store and retrieve natural language information.

Setup and training

Configuring custom spaCy ro model:

python -m spacy link <absolute_path>/pepper/models/spacy-ro/ro_model0 ro

Training the agent with multiple microworlds

rasa train --data \
  microworlds/generic/data \
  microworlds/mem_assistant/data \
  microworlds/university_guide/data

Testing the NLU pipeline

A separate dataset for testing the NLU pipeline of the RASA agent is defined in microworlds/test.

rasa test nlu --nlu microworlds/test
rasa train --data microworlds/generic/data microworlds/mem_assistant/data microworlds/university_guide/data --config config.yml && rasa test nlu --nlu microworlds/test --config config.yml

Running the agent

Starting Pepper

  1. Start actions HTTP server: rasa run actions
  2. Start a RASA shell to communicate with the agent from the command line: rasa shell or start the REST API: rasa run -p 80 --enable-api --cors *

[Deprecated] Generating lookup tables

python3 grakn_lookup.py

GraphDB container

The knowledge base is implemented using a GraphDB graph database (based on RDF triples).

Running the GraphDB container

docker run -p7200:7200 -v graphdb:/opt/graphdb-instance --name graphdb graphdb

Programmatically creating a new GraphDB repository

curl -X POST --header "Content-Type:multipart/form-data" -F "config=@/opt/graphdb-free-9.4.1/configs/config.ttl" "http://localhost:7200/rest/repositories"

Deployment

Build docker images

docker build -t registry.gitlab.com/gabrielboroghina/pepper-conv-agent/pepper-web -f ../pepper-web-frontend/web-ui.prod.dockerfile .
docker push registry.gitlab.com/gabrielboroghina/pepper-conv-agent/pepper-web

docker build -t registry.gitlab.com/gabrielboroghina/pepper-conv-agent/rasa-server -f rasa-agent.dockerfile .
docker push registry.gitlab.com/gabrielboroghina/pepper-conv-agent/rasa-server

docker build -t registry.gitlab.com/gabrielboroghina/pepper-conv-agent/rasa-actions -f actions/rasa-actions.dockerfile .
docker push registry.gitlab.com/gabrielboroghina/pepper-conv-agent/rasa-actions

docker build -t registry.gitlab.com/gabrielboroghina/pepper-conv-agent/graphdb -f graphdb.dockerfile .
docker push registry.gitlab.com/gabrielboroghina/pepper-conv-agent/graphdb

Setup nodes

  1. Allow access to the Docker images registry (get deploy token e.g. from GitLab project's settings -> Repository -> Deploy tokens):
docker login -u <username> -p <deploy_token> registry.gitlab.com # Needs GitLab deploy token
  1. Copy deployment files to the remote machine(s): stack.yml and kong.yml

  2. Pull images and deploy the service stack:

docker swarm init # Initialize swarm of nodes
docker stack deploy -c stack.yml --with-registry-auth pepper # Start service stack

docker stack rm pepper # Stop the service stack
docker service ls # Check running services
docker container ls # Check running containers
docker service logs pepper_kong # Show logs from the kong service

About

Conversational agent with knowledge graph integration supporting multiple microworlds

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published