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

E2e story printing #7388

Merged
merged 35 commits into from
Dec 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
321e937
remove unused imports
wochinge Nov 26, 2020
a8d8e04
test and fix writing YAML stories
wochinge Nov 26, 2020
4d1ba87
move `MarkdownStoryWriter` tests to separate file
wochinge Dec 1, 2020
dae731d
use `tmp_path`
wochinge Dec 1, 2020
810bc3e
consider end-to-end stories correctly
wochinge Dec 1, 2020
4eb2a43
fix story reading for retrieval intents
wochinge Dec 1, 2020
32537d7
fix missing renames for `prepare_from_domain`
wochinge Dec 1, 2020
ecb3355
fixup for last merge in from `master`
wochinge Dec 2, 2020
1493ad7
dump story not as test story
wochinge Dec 2, 2020
12912fb
fix docstring errors
wochinge Dec 2, 2020
cbce93d
remove unused method (not used in Rasa X either)
wochinge Dec 2, 2020
1109185
raise if printing end-to-end things in Markdown
wochinge Dec 2, 2020
60b2dca
add todos
wochinge Dec 2, 2020
330286f
Merge branch 'e2e' into e2e-story-printing
wochinge Dec 2, 2020
d7f2a89
fix error with entity formatting
wochinge Dec 2, 2020
1bfaafd
move to `rasa.shared`
wochinge Dec 2, 2020
76424f5
remove CoreDataImporter
wochinge Dec 2, 2020
4f967b3
change fingerprinting to use yaml writer
wochinge Dec 2, 2020
040dad5
fix tests failing due to new default story file
wochinge Dec 2, 2020
8fe7306
adapt remaining parts to `as_story_string` failing if end-to-end event
wochinge Dec 2, 2020
cdc5ff6
remove `as_story_string` from story validator
wochinge Dec 2, 2020
a382eb6
only train NLU model if data or end to end
wochinge Dec 2, 2020
bec8926
fix import
wochinge Dec 3, 2020
d415218
read and write in test
wochinge Dec 3, 2020
c6a245c
fix displaying of end-to-end actions in rasa interactive
wochinge Dec 3, 2020
c8971c9
skip warning for end-to-end user messages in training data
wochinge Dec 3, 2020
311684b
add docs link
wochinge Dec 3, 2020
d01f4ab
remove trailing whitespace
wochinge Dec 3, 2020
6d239d8
return `NotImplemented` if other class
wochinge Dec 4, 2020
7a34057
remove `md_` as it's not related to md
wochinge Dec 4, 2020
dcbdac1
add docstrings to entire module
wochinge Dec 4, 2020
59c7cc0
add more docstrings
wochinge Dec 7, 2020
97e1860
increase timeout due to failing windows tests
wochinge Dec 7, 2020
8ba989c
improve string representation of `UserUttered`
wochinge Dec 7, 2020
a1e2bee
fix hashing of `UserUttered`
wochinge Dec 7, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions rasa/core/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,17 +304,18 @@ def __init__(self, event: UserUttered, eval_store: EvaluationStore) -> None:

def inline_comment(self) -> Text:
"""A comment attached to this event. Used during dumping."""
from rasa.shared.core.events import md_format_message
from rasa.shared.core.events import format_message

predicted_message = md_format_message(
predicted_message = format_message(
self.text, self.predicted_intent, self.predicted_entities
)
return f"predicted: {self.predicted_intent}: {predicted_message}"

def as_story_string(self, e2e: bool = True) -> Text:
from rasa.shared.core.events import md_format_message
"""Returns text representation of event."""
from rasa.shared.core.events import format_message

correct_message = md_format_message(
correct_message = format_message(
self.text, self.intent.get("name"), self.entities
)
return (
Expand Down
2 changes: 1 addition & 1 deletion rasa/core/training/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ def add_user_cell(data, cell):

for idx, event in enumerate(applied_events):
if isinstance(event, ActionExecuted):
bot_column.append(colored(event.action_name, "autocyan"))
bot_column.append(colored(str(event), "autocyan"))
if event.confidence is not None:
bot_column[-1] += colored(f" {event.confidence:03.2f}", "autowhite")

Expand Down
8 changes: 4 additions & 4 deletions rasa/core/training/story_conflict.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,9 @@ def _find_conflicting_states(
state_action_mapping = defaultdict(list)
for element in _sliced_states_iterator(trackers, domain, max_history):
hashed_state = element.sliced_states_hash
if element.event.as_story_string() not in state_action_mapping[hashed_state]:
state_action_mapping[hashed_state] += [element.event.as_story_string()]
current_hash = hash(element.event)
Ghostvv marked this conversation as resolved.
Show resolved Hide resolved
if current_hash not in state_action_mapping[hashed_state]:
state_action_mapping[hashed_state] += [current_hash]

# Keep only conflicting `state_action_mapping`s
return {
Expand Down Expand Up @@ -238,8 +239,7 @@ def _build_conflicts_from_states(
conflicts[hashed_state] = StoryConflict(element.sliced_states)

conflicts[hashed_state].add_conflicting_action(
action=element.event.as_story_string(),
story_name=element.tracker.sender_id,
action=str(element.event), story_name=element.tracker.sender_id,
)

# Return list of conflicts that arise from unpredictable actions
Expand Down
1 change: 1 addition & 0 deletions rasa/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,5 @@ def __init__(self, timestamp: float) -> None:
super(PublishingError, self).__init__()

def __str__(self) -> Text:
"""Returns string representation of exception."""
return str(self.timestamp)
Loading