Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ConversationError when retrieving end-to-end story #8114

Closed
nbeuchat opened this issue Mar 4, 2021 · 18 comments · Fixed by #8271 or #8299
Closed

ConversationError when retrieving end-to-end story #8114

nbeuchat opened this issue Mar 4, 2021 · 18 comments · Fixed by #8271 or #8299
Assignees
Labels
area:rasa-oss 🎡 Anything related to the open source Rasa framework area:rasa-oss/server Issues focused running rasa as server (e.g. via `rasa run`) area:rasa-oss/training-data Issues focused around Rasa training data (stories, NLU, domain, etc.) effort:atom-squad/1 Label which is used by the Rasa Atom squad to do internal estimation of task sizes. feature:ux-cli+training-data Feature: Improve user experience with Rasa CLI and training data for developers type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors.

Comments

@nbeuchat
Copy link
Contributor

nbeuchat commented Mar 4, 2021

Rasa version: 2.3.4

Python version: 3.7.9

Operating system (windows, osx, ...): Ubuntu

Issue:
When trying to retrieve the end-to-end story through the API, I get a ConversationError for several users (but not all). I can get the tracker as JSON without any issue though.

Error (including full traceback):

{
    "version": "2.3.4",
    "status": "failure",
    "message": "An unexpected error occurred. Error: 'start'",
    "reason": "ConversationError",
    "details": {},
    "help": null,
    "code": 500
}

Command or request that led to error:

GET {{protocole}}://{{url}}/conversations/{{sender_id}}/story?token={{token}}
@nbeuchat nbeuchat added area:rasa-oss 🎡 Anything related to the open source Rasa framework type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors. labels Mar 4, 2021
@sara-tagger
Copy link
Collaborator

Thanks for raising this issue, @koernerfelicia will get back to you about it soon✨

Please also check out the docs and the forum in case your issue was raised there too 🤗

@wochinge
Copy link
Contributor

wochinge commented Mar 5, 2021

Is there anything else in the log messages @nbeuchat ?

@nbeuchat
Copy link
Contributor Author

nbeuchat commented Mar 5, 2021

Hi @wochinge ! Ah yes, for some reason I couldn't find them in the log last time. Anyway, here you go:

sender_id=2368913086550157 Traceback (most recent call last):
  File "/opt/venv/lib/python3.8/site-packages/rasa/server.py", line 811, in retrieve_story
    stories = get_test_stories(
  File "/opt/venv/lib/python3.8/site-packages/rasa/server.py", line 311, in get_test_stories
    return YAMLStoryWriter().dumps(story_steps, is_test_story=True)
  File "/opt/venv/lib/python3.8/site-packages/rasa/shared/core/training_data/story_writer/yaml_story_writer.py", line 73, in dumps
    self.dump(stream, story_steps, is_appendable, is_test_story)
  File "/opt/venv/lib/python3.8/site-packages/rasa/shared/core/training_data/story_writer/yaml_story_writer.py", line 94, in dump
    result = self.stories_to_yaml(story_steps, is_test_story)
  File "/opt/venv/lib/python3.8/site-packages/rasa/shared/core/training_data/story_writer/yaml_story_writer.py", line 119, in stories_to_yaml
    stories.append(self.process_story_step(story_step))
  File "/opt/venv/lib/python3.8/site-packages/rasa/shared/core/training_data/story_writer/yaml_story_writer.py", line 149, in process_story_step
    processed = self.process_event(event)
  File "/opt/venv/lib/python3.8/site-packages/rasa/shared/core/training_data/story_writer/yaml_story_writer.py", line 163, in process_event
    return self.process_user_utterance(event, self._is_test_story)
  File "/opt/venv/lib/python3.8/site-packages/rasa/shared/core/training_data/story_writer/yaml_story_writer.py", line 220, in process_user_utterance
    rasa.shared.core.events.format_message(
  File "/opt/venv/lib/python3.8/site-packages/rasa/shared/core/events.py", line 98, in format_message
    return TrainingDataWriter.generate_message(
  File "/opt/venv/lib/python3.8/site-packages/rasa/shared/nlu/training_data/formats/readerwriter.py", line 93, in generate_message
    entities = sorted(message.get("entities", []), key=lambda k: k["start"])
  File "/opt/venv/lib/python3.8/site-packages/rasa/shared/nlu/training_data/formats/readerwriter.py", line 93, in <lambda>
    entities = sorted(message.get("entities", []), key=lambda k: k["start"])
KeyError: 'start'

@wochinge
Copy link
Contributor

wochinge commented Mar 5, 2021

Mhm, how does your NLU pipeline look like? Might be a duplicate of #5263

@nbeuchat
Copy link
Contributor Author

nbeuchat commented Mar 5, 2021

We have a few custom pipeline components but as far as I can see, all of them sets the start/end of entities.

However, I looked at the json I get from the tracker endpoint and it seems the only entities that come without a start are from the trigger_intent endpoint (which makes sense because there is no text for these so start/end don't make much sense):

        {
            "event": "user",
            "timestamp": 1614975110.5258033,
            "metadata": {
                "is_external": true
            },
            "text": "EXTERNAL: receive_notify_new_apartments",
            "parse_data": {
                "intent": {
                    "name": "receive_notify_new_apartments"
                },
                "entities": [
                    {
                        "entity": "slug",
                        "value": "ABCDE"
                    }
                ],
                "text": "EXTERNAL: receive_notify_new_apartment",
                "message_id": null,
                "metadata": {
                    "is_external": true
                }
            },
            "input_channel": "facebook",
            "message_id": null
        },

which is expected because I'm sending the following as a trigger_intent:

{
	"name": "receive_notify_new_apartment",
	"entities": {"slug": "ABCDE"}
}

@nbeuchat
Copy link
Contributor Author

@wochinge do you know if there is any workaround for this? I basically can't retrieve stories for users for which we used the trigger_intent at the moment

@oytuntez
Copy link

We have the same situation – can't view stories when trigger_intent is used.

@wochinge
Copy link
Contributor

The workaround would be to define some values for start and end in the trigger_intent request for now 😬 Would you mind submitting a bugfix PR?

@wochinge wochinge added area:rasa-oss/server Issues focused running rasa as server (e.g. via `rasa run`) area:rasa-oss/training-data Issues focused around Rasa training data (stories, NLU, domain, etc.) feature:ux-cli+training-data Feature: Improve user experience with Rasa CLI and training data for developers labels Mar 12, 2021
@gausie gausie added the effort:atom-squad/1 Label which is used by the Rasa Atom squad to do internal estimation of task sizes. label Mar 12, 2021
@nbeuchat
Copy link
Contributor Author

The workaround would be to define some values for start and end in the trigger_intent request for now

Doesn't really work for existing conversations, unfortunately 😉 But also, not sure what format we are supposed to send the trigger_intent as in that case? Given that the API expects:


{
  "name": "greet",
  "entities": {
    "temperature": "high"
  }
}

I can try a PR, not sure if I'll have much time for it right now.

@wochinge
Copy link
Contributor

@joejuzl Will work on it this week. Good pointer regarding the API spec 🙌🏻

@nbeuchat
Copy link
Contributor Author

That's awesome 🎉!

@nbeuchat
Copy link
Contributor Author

@wochinge @joejuzl I wanted to see if you knew when a fix for this will be released? We have so many external intents now that it basically makes this endpoint unusable for 95% of our conversations 😞 Thank you!! 🙏

@joejuzl
Copy link
Contributor

joejuzl commented Mar 25, 2021

@nbeuchat it will be released in 2.4.3 which should be this week

@nbeuchat
Copy link
Contributor Author

Fantastic! Thanks a lot for the feedback @joejuzl 😃

@oytuntez
Copy link

oytuntez commented Mar 25, 2021 via email

@nbeuchat
Copy link
Contributor Author

I'd be happy to @oytuntez! Our chatbot is on Facebook Messenger and we extensively use what they call "webviews" (if you're interested, I had a lighting talk at the Rasa Summit, it's on YouTube here). As part of the interaction is from an "app" within the chatbot, we send information of what the user did within their session through an external intent so that the bot can take it from there and suggest what to do next. We also use external intents to send updates on specific listings that a user had added to their favorites for example.

Feel free to reach out to me if you want more details 😃

@oytuntez
Copy link

oytuntez commented Mar 25, 2021 via email

@joejuzl
Copy link
Contributor

joejuzl commented Mar 26, 2021

fixed in: https://github.com/RasaHQ/rasa/releases/tag/2.4.3

@joejuzl joejuzl closed this as completed Mar 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:rasa-oss 🎡 Anything related to the open source Rasa framework area:rasa-oss/server Issues focused running rasa as server (e.g. via `rasa run`) area:rasa-oss/training-data Issues focused around Rasa training data (stories, NLU, domain, etc.) effort:atom-squad/1 Label which is used by the Rasa Atom squad to do internal estimation of task sizes. feature:ux-cli+training-data Feature: Improve user experience with Rasa CLI and training data for developers type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
None yet
6 participants