后台小程序开发的全方位指南
734
2022-10-31
basicRAT一个使用API.AI和python构建虚拟助理的框架
Create Virtual Assistants with Python
A flask extension serving as a framework to easily create virtual assistants using Dialogflow which may be integrated with platforms such as Actions on Google (Google Assistant).
Flask-Assistant allows you to focus on building the core business logic of conversational user interfaces while utilizing Dialogflow's Natural Language Processing to interact with users.
Now supports Dialogflow V2!
This project is heavily inspired and based on John Wheeler's Flask-ask for the Alexa Skills Kit.
Features
Mapping of user-triggered Intents to action functionsContext support for crafting dialogue dependent on the user's requestsDefine prompts for missing parameters when they are not present in the users request or past active contextsA convenient syntax resembling Flask's decoratored routingRich Responses for Google Assistant
Hello World
from flask import Flaskfrom flask_assistant import Assistant, askapp = Flask(__name__)assist = Assistant(app, project_id='GOOGLE_CLOUD_PROJECT_ID')@assist.action('Demo')def hello_world(): speech = 'Microphone check 1, 2 what is this?' return ask(speech)if __name__ == '__main__': app.run(debug=True)
How-To
Create an Assistant object with a Flask app.Use action decorators to map intents to the proper action function.Use action view functions to return ask or tell responses.
Documentation
Check out the Quick Start to jump right inView the full documentation
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~