Create Virtual Assistants with Python
Flask-Assistant allows you to focus on building the core business logic of conversational user interfaces while utilizing API.AI's Natural Language Processing to interact with users.
- Recent Updates:
This project is heavily inspired and based on John Wheeler's Flask-ask for the Alexa Skills Kit.
- Mapping of user-triggered Intents to action functions
- Context support for crafting dialogue dependent on the user's requests
- Define prompts for missing parameters when they are not present in the users request or past active contexts
- A convenient syntax resembling Flask's decoratored routing
- Internal API.AI schema generation and registration
from flask import Flask from flask_assistant import Assistant, ask app = Flask(__name__) assist = Assistant(app) @assist.action('Demo') def hello_world(): speech = 'Microphone check 1, 2 what is this?' return ask(speech) if __name__ == '__main__': app.run(debug=True)
- Create an Assistant object with a Flask app and the route to your webhook URL.
- Use action decorators to map the intents to the proper action function.
- Use action view functions to return ask or tell responses.