-
Notifications
You must be signed in to change notification settings - Fork 75
Skills
Skills are a key part of the multiskill AI assistants. Deepy provides a set of built-in capabilities, referred to as skills. For example, Deepy’s abilities include talking about Moonbase Sarang and having a chit-chat. In the coming months it will learn how to answer questions (using custom skills), provide weather forecasts, and how to query Wikipedia.
DeepPavlov Dream lets you teach Deepy new skills. Customers can access these new abilities by asking Deepy questions or making requests. You can build skills that provide users with many different types of abilities.
There are different types of skills, and different way to classify them. In general, skills can be seen as goal-oriented or chit-chat-based.
Goal-oriented skills are focused on solving particular user problems. They usually usually have a number of intents they can recognize, with [optionally] accompanying slots and entities, and may or may not be scenario-driven.
An example of a goal-oriented skill is our Harvesters Maintenance Skill. It can answer to questions like:
- What is the status of harvesters? - which is followed by the database lookup
- What is the status of harvester {N}? - which uses slot-filling to detect the number of a harvester, and then is followed by the database lookup
- Prepare rover for a trip - which is followed then by a fake call to a Rover API to prepare one for a trip.
These skills can be implemented using rules, using neural networks, or their combination.
You can use any kind of a framework to build your Goal-Oriented Skills. We provide an (in-development) Go-Bot Framework that enables development of the goal-oriented skills. Take a look at our Harvesters Maintenance Go-Bot Skill for details.
Chit-chat skills are focused on supporting a general conversation; it may be completely generic or more domain- or topic-specific.
An example of a chit-chat skill is our Program Y Skill. It supports discussion on a number of topics including but not limited to:
- Bot's profile
- User's profile
- Lunar Industries
These skills can be implemented using rules (e.g., AIML), neural models (e.g., seq2seq or seq2word like GPT), and their combinations.
You can use any kind of a framework to build your Chit-Chat Skills.
You can re-use existing skills, by replacing their contents with your own code. The easiest way is to use Harvesters Maintenance Skill, then remove the rest of the contents keeping only /respond
endpoint and Flask app default boilerplate code:
#!/usr/bin/env python
import logging
import time
import random
import re
import json
from flask import Flask, request, jsonify
from os import getenv
import sentry_sdk
logging.basicConfig(format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.INFO)
logger = logging.getLogger(__name__)
app = Flask(__name__)
@app.route("/respond", methods=["POST"])
def respond():
st_time = time.time()
dialogs = request.json["dialogs"]
responses = []
confidences = []
for dialog in dialogs:
sentence = dialog['human_utterances'][-1]['annotations'].get("spelling_preprocessing")
if sentence is None:
logger.warning('Not found spelling preprocessing annotation')
sentence = dialog['human_utterances'][-1]['text']
response = "Hello world!"
confidence = 0.8
responses.append(response)
confidences.append(confidence)
total_time = time.time() - st_time
logger.info(f"harvesters_maintenance_skill exec time = {total_time:.3f}s")
return jsonify(list(zip(responses, confidences)))
if __name__ == "__main__":
app.run(debug=False, host="0.0.0.0", port=3000)
You will need to appropriately process the user's utterance coming either directly from the user, or after being processed by the Spell Checking annotator when available (as shown above). After that you will need to provide the confidence of your skill's response. Finally, you'll need to send both the respond and the confidence back to the DeepPavlov Agent.
Registering a new skill is done by adding its configuration to the docker-compose.yml
located in the root directory, and to pipeline_conf.json
located in the /agent
subdirectory of the repository. After adding new skill, it should be built and run using docker-compose -f docker-compose.yml up --build _skill_name_
, followed by building and running agent by running command docker-compose -f docker-compose.yml build agent
followed by docker-compose -f docker-compose.yml up agent
.
You must register a skill before you can test it with your own copy of Deepy.
Currently, we provide 3 skills, including two different implementations of the *Harvesters Maintenance Skill (goal-oriented: generic and Go-Bot-based one) and one Program Y (chit-chat: AIML-based).
We plan to add new skills from our Dream 1.0 socialbot that was running on our Demo Website from September 3 to the end of November 2020. Check out our Roadmap.
- Skills Skills @ ReadTheDoc