Search code examples
pythonflaskassistant

Can't run the example of flask-assistant python library


I am trying to run flask-assistant library for Google Assistant development. I followed the instructions from here.

I installed the flask-assistant library in a virtualenv. My webhook.py looks like this:

from flask import Flask
from flask_assistant import Assistant, ask, tell

app = Flask(__name__)
assist = Assistant(app, route='/', project_id='GOOGLE_CLOUD_PROJECT_ID')


@assist.action('greeting')
def greet_and_start():
    speech = "Hey! Are you male or female?"
    return ask(speech)

@assist.action("give-gender")
def ask_for_color(gender):
    if gender == 'male':
        gender_msg = 'Sup bro!'
    else:
        gender_msg = 'Haay gurl!'

    speech = gender_msg + ' What is your favorite color?'
    return ask(speech)

@assist.action('give-color', mapping={'color': 'sys.color'})
def ask_for_season(color):
    speech = 'Ok, {} is an okay color I guess'.format(color)
    return ask(speech)

if __name__ == '__main__':
    app.run(debug=True)

I did everything as it said but at the step where I have to run schema webhook.py I get this error:

Traceback (most recent call last):
  File "/Users/alexmarginean/Documents/Projects/travelrr-google-assistant/venv/bin/schema", line 7, in <module>
    from api_ai.cli import schema
  File "/Users/alexmarginean/Documents/Projects/travelrr-google-assistant/venv/lib/python3.7/site-packages/api_ai/cli.py", line 15, in <module>
    "Schema generation and management is not yet available for Dialogflow V2, please define intents and entities in the Dialogflow console"
DeprecationWarning: Schema generation and management is not yet available for Dialogflow V2, please define intents and entities in the Dialogflow console

I tried to switch to BETA V2 and V1 but problem is still there. I also checked if my tokens are right and they are. I also tried to update the schema library but no luck. I'm not sure how to solve this.


Solution

  • Quoting an issue from the flask-assistant project's GitHub repository, the owner/developer of flask-assistant says (as of 1 March 2019):

    [He has] not yet updated the schema functionality to support the dialogflow V2 API.

    Looks like there is no support yet for V2 API.