RasaHQ / rasa

💬 Open source machine learning framework to automate text- and voice-based conversations: NLU, dialogue management, connect to Slack, Facebook, and more - Create chatbots and voice assistants
https://rasa.com/docs/rasa/
Apache License 2.0
18.81k stars 4.62k forks source link

Rasa X form not working: IndexError - List index out of range #9437

Closed RWolfing closed 3 years ago

RWolfing commented 3 years ago

Rasa version: 2.6.2 Rasa SDK version (if used & relevant): 2.6.0 Rasa X version (if used & relevant): 0.40.1 Python version:

Operating system (windows, osx, ...): docker compose on a standard AWS setup

Issue:

I am having trouble with forms on my rasa x instance. The described issue does not occur when testing locally using rasa shell.

I have declared two forms, as soon as the chatbot starts a form the included error occurs and the bot becomes unresponsive. The error depends on the order of the form in my domain.yml. If I switch the order the previously broken form works but the second runs into the same error. - Edit: After some hours of poking around I am not sure anymore if this statement holds true.

Right now I am a bit clueless as to why this problem occurs. Help is appreciated...

Error (including full traceback):

rasa-production_1  | 2021-08-23 13:16:19 ERROR    rasa.core.channels.rest  - An exception occured while handling user message 'Ich habe Probleme beim Abspielen von Videos'.
rasa-production_1  | Traceback (most recent call last):
rasa-production_1  |   File "/opt/venv/lib/python3.8/site-packages/rasa/core/channels/rest.py", line 120, in receive
rasa-production_1  |     await on_new_message(
rasa-production_1  |   File "/opt/venv/lib/python3.8/site-packages/rasa/core/channels/channel.py", line 89, in handler
rasa-production_1  |     await app.agent.handle_message(message)
rasa-production_1  |   File "/opt/venv/lib/python3.8/site-packages/rasa/core/agent.py", line 576, in handle_message
rasa-production_1  |     return await processor.handle_message(message)
rasa-production_1  |   File "/opt/venv/lib/python3.8/site-packages/rasa/core/processor.py", line 108, in handle_message
rasa-production_1  |     await self._predict_and_execute_next_action(message.output_channel, tracker)
rasa-production_1  |   File "/opt/venv/lib/python3.8/site-packages/rasa/core/processor.py", line 657, in _predict_and_execute_next_action
rasa-production_1  |     action, prediction = self.predict_next_action(tracker)
rasa-production_1  |   File "/opt/venv/lib/python3.8/site-packages/rasa/core/processor.py", line 379, in predict_next_action
rasa-production_1  |     prediction = self._get_next_action_probabilities(tracker)
rasa-production_1  |   File "/opt/venv/lib/python3.8/site-packages/rasa/core/processor.py", line 921, in _get_next_action_probabilities
rasa-production_1  |     prediction = self.policy_ensemble.probabilities_using_best_policy(
rasa-production_1  |   File "/opt/venv/lib/python3.8/site-packages/rasa/core/policies/ensemble.py", line 816, in probabilities_using_best_policy
rasa-production_1  |     winning_prediction = self._best_policy_prediction(tracker, domain, interpreter)
rasa-production_1  |   File "/opt/venv/lib/python3.8/site-packages/rasa/core/policies/ensemble.py", line 693, in _best_policy_prediction
rasa-production_1  |     predictions = {
rasa-production_1  |   File "/opt/venv/lib/python3.8/site-packages/rasa/core/policies/ensemble.py", line 694, in <dictcomp>
rasa-production_1  |     f"policy_{i}_{type(p).__name__}": self._get_prediction(
rasa-production_1  |   File "/opt/venv/lib/python3.8/site-packages/rasa/core/policies/ensemble.py", line 728, in _get_prediction
rasa-production_1  |     prediction = policy.predict_action_probabilities(
rasa-production_1  |   File "/opt/venv/lib/python3.8/site-packages/rasa/core/policies/ted_policy.py", line 692, in predict_action_probabilities
rasa-production_1  |     confidence, is_e2e_prediction = self._pick_confidence(
rasa-production_1  |   File "/opt/venv/lib/python3.8/site-packages/rasa/core/policies/ted_policy.py", line 652, in _pick_confidence
rasa-production_1  |     predicted_action_name = domain.action_names_or_texts[np.argmax(confidences[0])]
rasa-production_1  | IndexError: list index out of range

Command or request that led to error:

Interactive session using Rasa X

Content of configuration file (config.yml) (if relevant):

# Configuration for Rasa NLU.
# https://rasa.com/docs/rasa/nlu/components/
language: de
pipeline:
  # # No configuration for the NLU pipeline was provided. The following default pipeline was used to train your model.
  # # If you'd like to customize it, uncomment and adjust the pipeline.
  # # See https://rasa.com/docs/rasa/tuning-your-model for more information.
  - name: WhitespaceTokenizer
  - name: RegexEntityExtractor
    case_sensitive: False
    use_lookup_tables: True
    use_regexes: True
  - name: LexicalSyntacticFeaturizer
  - name: CountVectorsFeaturizer
  - name: CountVectorsFeaturizer
    analyzer: char_wb
    min_ngram: 1
    max_ngram: 4
  - name: DIETClassifier
    epochs: 100
    constrain_similarities: true
  - name: EntitySynonymMapper
  - name: ResponseSelector
    retrieval_intent: out_of_scope
    scale_loss: false
    epochs: 100
  - name: FallbackClassifier
    threshold: 0.7
    ambiguity_threshold: 0.1
  - name: DucklingEntityExtractor
    url: "http://localhost:8000"
    dimensions: [ "email", "time" ]
    locale: "de_DE"
    timezone: "Europe/Berlin"
    timeout: 3

# Configuration for Rasa Core.
# https://rasa.com/docs/rasa/core/policies/
policies:
# # No configuration for policies was provided. The following default policies were used to train your model.
# # If you'd like to customize them, uncomment and adjust the policies.
# # See https://rasa.com/docs/rasa/policies for more information.
   - name: MemoizationPolicy
   - name: RulePolicy
   - name: TEDPolicy
     max_history: 5
     epochs: 100
     constrain_similarities: true

Content of domain file (domain.yml) (if relevant):

version: '2.0'
config:
  store_entities_as_slots: true
session_config:
  session_expiration_time: 60
  carry_over_slots_to_new_session: true
intents:
# ...
entities:
- platform
slots:
  platform:
    type: rasa.shared.core.slots.TextSlot
    initial_value: null
    auto_fill: true
    influence_conversation: false

responses:
  utter_ask_email:
    - text: Wie lautet ihre Email Adresse?
  utter_ask_platform:
    - text: Auf welcher Plattform tritt das Problem auf?
# ...

forms:
  issue_account_form:
    required_slots:
      email:
        - entity: email
          type: from_entity
      platform:
        - entity: platform
          type: from_entity

  issue_playback_form:
    required_slots:
      platform:
        - entity: platform
          type: from_entity

e2e_actions: []

Example Story, works fine until action: issue_playback_form

version: "2.0"
stories:
  - story: Playback issue
    steps:
      - intent: issue_playback
      - action: utter_open_incident
      - intent: confirm
      - action: issue_playback_form
      - active_loop: issue_playback_form
      - active_loop: null
      - action: utter_submit
      - checkpoint: cp_additional_problem
sara-tagger commented 3 years ago

Thanks for the issue, @koernerfelicia will get back to you about it soon!

You may find help in the docs and the forum, too 🤗
koernerfelicia commented 3 years ago

Hi @RWolfing, this does seem odd! Can I ask how you know that the form has been entered? Maybe you could share a few previous lines of the log output before rasa-production_1 | 2021-08-23 13:16:19 ERROR?

RWolfing commented 3 years ago

Hi, thanks for the fast response. I think I solved the problem...

The problem was a mismatch of the rasa versions used.

I always used the upload model functionality of rasa x. The rasa version of my instance was 2.6.x vs 2.8.x on my local machine. I think the models might be not backward compatible? Anyway, this caused the predictions to be completely off and the mentioned error to occur.

I upgraded the version to 2.8.x and so far everything works like a charm :)