Skip to content

brunolcarli/Luci

Repository files navigation

Project icon

LUCI

Logical Unit for Communicational Interactivity

Version badge Docs Link test badge

LUCI is a conversational tamabotchi for discord.

Developers

Cloning and executing

Linux Badge Apple badge

Local machine

Clone this project and engage a python3 virtual environment the way as you like and install the requirements through Makefile.

Example using virtualevwrapper:

$ git clone https://github.com/brunolcarli/Luci.git
$ cd luci/
$ mkvirtualenv Luci
$ (Luci) make install

Create a .env file and add the following content:

TOKEN=<your_test_bot_token>
LISA_URL=<lisa_url>
BACKEND_URL=None
SETTINGS_MODULE=development
REDIS_HOST=<redis_server_host>
REDIS_PORT=<redis_server_port>

You should configure your own environment cloning both lisa and bot api:

  • LISA_URl is required since the bot requests text offense and sentiment to the service API.

  • BACKEND_URL is the long range memory storage (AKA database) which is a separated service.

  • REDIS_HOST and REDIS_PORT is the short term memory, and it depends on a redis-server.

Note: If SETTINGS_MODULE=production the bot will run on a flask server instance.

Execute the bot:

$ (Luci) make run

Training Models

The bot is trained over a serie of .json datasets on core/training/json/intentions/.

For each intention directory there are located a serie of dataset_x.json where x is a sequence number of the train dataset. You can create a new one containing the text and training target label on the following shape:

[
    {"text": "An example text.", "intention": 1},
    {"text": "Another example text.", "intention": 1},
    {"text": "Way othe example text.", "intention": 2},
    {"text": "keep going.", "intention": 2}
]

The training data must respect the intention archicture proposed on the docs, otherwise it may cause the model to behave unproperly.

Train data through Makefile:

$ (Luci) make train

You can view some models score and the number o sample data used for each intention through a cvross validation test:

$ (Luci) make no_free_lunch

Test the bot

The goal is give the models enough data to pass the test when executing:

$ (Luci) make test

Docker

Project icon

Set up the .env file as described above and build the container with docker-compose:

$ docker-compose build

Run with:

$ docker-compose up

Or run in background

$ docker-compose up -d