calpoly-csai / api

Official API for the NIMBUS Voice Assistant accessible via HTTP REST protocol.
https://nimbus.api.calpolycsai.com/
GNU General Public License v3.0
9 stars 4 forks source link

asking for "Help" results in an unhelpful IndexError #164

Closed mfekadu closed 3 years ago

mfekadu commented 4 years ago

Request

curl --location --request POST 'http://0.0.0.0:8080/ask' --header 'Content-Type: application/json' --data-raw '{
    "question": "Help"
}'

Stacktrace

[2020-05-28 00:36:57 -0700] [77013] [INFO] Booting worker with pid: 77013
initialized database session
initialized NimbusMySQLAlchemy
Saved model : /Users/mfekadu/GitHub/api/nimbus_nlp/models/classification/nlp-model_05_28_2020_00_36_59.pkl
[2020-05-28 00:37:17,308] ERROR in app: Exception on /ask [POST]
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/app.py", line 2446, in wsgi_app
    response = self.full_dispatch_request()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/app.py", line 1951, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask_cors/extension.py", line 161, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/app.py", line 1820, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/app.py", line 1949, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/flask/app.py", line 1935, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/mfekadu/GitHub/api/flask_api.py", line 122, in handle_question
    response = {"answer": nimbus.answer_question(question)}
  File "/Users/mfekadu/GitHub/api/nimbus.py", line 33, in answer_question
    ans_dict = self.predict_question(question)
  File "/Users/mfekadu/GitHub/api/nimbus.py", line 65, in predict_question
    nlp_props = self.variable_extractor.extract_variables(question)
  File "/Users/mfekadu/GitHub/api/nimbus_nlp/variable_extractor.py", line 75, in extract_variables
    entity = request.payload[0].text_extraction.text_segment.content
IndexError: list index (0) out of range
mfekadu commented 4 years ago

165 may resolve this