Skip to main content

A simple package for interfacing with Dialogflow

Project description


Affability allows for an easy utilization of Google's DialogFlow for natural language understanding. It allows for calling a single function and returning the result from Dialogflow as a class containing all the pertinent data such as detected intent.

This can be utilized to understand commands and then perform the relevant tasks based from the detected intent. Affability is ultimately designed to have the ability to assist with a quadruped robot project in the future.


Installing using the requirements.txt file:

pip install -r requirements.txt

Installing manually:

pip install SpeechRecognition
pip install dialogflow


pip install Affability


Using the understand function:

The understand function contains 5 parameters: text, credentials, projectID, languageCode, and sessionID. Text is text to be analyzed, credentials is the file path of the authentication key, projectID is the project ID, languageCode is the language, and sessionID is the session ID. All parameters are strings.

understand('textToBeAnalyzed', 'filepath', 'projectIDname', 'en-US', 'me') 

The understand function returns the results as an organizer class. This class contains detectedIntent, confidence, reply, action, requiredParamsPresent, and replyParams.

class organizer:
    def __init__(self, detectedIntent, confidence, reply, action, requiredParamsPresent, replyParams):
        self.detectedIntent = detectedIntent
        self.confidence = confidence
        self.reply = reply
        self.action = action
        self.requiredParamsPresent = requiredParamsPresent
        self.replyParams = replyParams

For example, to extract and print detected intent:

reply = understand('textToBeAnalyzed', 'filepath', 'projectIDname', 'en-US', 'me') 

Sample usage

The file demonstrates the ease of communicating with Dialogflow through Affability.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for Affability, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size Affability-1.0.0-py3-none-any.whl (2.8 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size Affability-1.0.0.tar.gz (1.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page