用api.ai构建虚拟助手的框架
Flask-Assistant的Python项目详细描述
使用python创建虚拟助手
一种烧瓶扩展,用作一个框架,使用Dialogflow轻松创建虚拟助手,该框架可以集成 使用Actions on Google(google)等平台 助理)。
Flask助手允许您专注于构建核心业务逻辑 利用dialogflow的自然语言 与用户交互的语言处理。
现在支持dialogflow v2!
这个项目的灵感来自约翰·惠勒 Flask-ask亚历山大 技能工具包。
功能
- 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
- Rich Responses for Google Assistant
你好,世界
fromflaskimportFlaskfromflask_assistantimportAssistant,askapp=Flask(__name__)assist=Assistant(app,project_id='GOOGLE_CLOUD_PROJECT_ID')@assist.action('Demo')defhello_world():speech='Microphone check 1, 2 what is this?'returnask(speech)if__name__=='__main__':app.run(debug=True)
如何
- 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.
文档
- 查看Quick Start 直接跳进去
- 查看全部 documentation