-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Success Markers CLI #9824
Merged
Merged
Success Markers CLI #9824
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
778a69b
Create stubs to start filling out Aciel's snippet
usc-m 186a1e4
Sketch out basics of CLI arguments
usc-m 6a90fc2
Start changing over args to new format
usc-m a6e29e9
Make CLI match description from design pass
usc-m 7ed690e
Add tests
usc-m e4dd4fc
Switch over timestamps to event IDs
usc-m bf4030b
Fix tests now event IDs are supported
usc-m ab8d3f2
Start work on doc comments
usc-m a70d06a
Switch over event_id fix
usc-m 1d45b90
Address PR comments
usc-m 3aa624d
Fix incorrect file extension
usc-m 441ccc5
Codeclimate
usc-m 10d8360
Update rasa/core/evaluation/marker_base.py
usc-m 65fad80
Address PR comments
usc-m f630721
Move test to marker
usc-m 60cedb4
Merge branch 'main' into 9658/success-markers-cli
usc-m d6d1321
Rename dialogue to session
usc-m e686a3c
Merge branch 'main' into 9658/success-markers-cli
aeshky 86ddf76
Fix types, fix CLI test
usc-m 036a0a1
Fix types again
usc-m File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Start changing over args to new format
- Loading branch information
commit 6a90fc2a353443fcdf00068c06077409b2d13a26
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import argparse | ||
from rasa.cli.arguments.default_arguments import add_endpoint_param | ||
|
||
|
||
def set_markers_arguments(parser: argparse.ArgumentParser): | ||
"""Specifies arguments for `rasa markers extract`""" | ||
parser.add_argument( | ||
"--by", | ||
choices=["first-n", "sample", "all"], | ||
required=True, | ||
dest="strategy", | ||
help="The strategy used to select trackers for marker extraction", | ||
) | ||
|
||
parser.add_subparsers() | ||
|
||
parser.add_argument( | ||
"output_filename", | ||
type=argparse.FileType("w"), | ||
help="The filename to write the extracted markers to", | ||
) | ||
|
||
stats = parser.add_mutually_exclusive_group() | ||
|
||
stats.add_argument( | ||
"--no-stats", | ||
default=True, | ||
action="store_false", | ||
dest="stats", | ||
help="Do not compute summary statistics", | ||
) | ||
|
||
stats.add_argument( | ||
"--stats-file", | ||
type=argparse.FileType("w"), | ||
help="Che filename to write out computed summary statistics", | ||
) | ||
|
||
first_n_arguments = parser.add_argument_group("Arguments for strategy 'by_first_n'") | ||
set_markers_first_n_arguments(first_n_arguments) | ||
|
||
sample_arguments = parser.add_argument_group("Arguments for strategy 'by_sample'") | ||
set_markers_sample_arguments(sample_arguments) | ||
|
||
add_endpoint_param(parser) | ||
|
||
|
||
def set_markers_first_n_arguments(parser: argparse.ArgumentParser): | ||
"""Specifies arguments for `rasa markers by_first_n`""" | ||
parser.add_argument( | ||
"--num-trackers", | ||
type=int, | ||
dest="count", | ||
help="The number of trackers to extract markers from", | ||
) | ||
|
||
|
||
def set_markers_sample_arguments(parser: argparse.ArgumentParser): | ||
"""Specifies arguments for `rasa markers by_sample""" | ||
parser.add_argument( | ||
"--seed", type=int, help="Seed to use if selecting trackers by 'sample'" | ||
) | ||
parser.add_argument( | ||
"--num-trackers", | ||
type=int, | ||
dest="count", | ||
help="The number of trackers to extract markers from", | ||
) | ||
|
||
|
||
def set_markers_all_arguments(parser: argparse.ArgumentParser): | ||
pass | ||
|
||
|
||
def set_evaluate_arguments(parser: argparse.ArgumentParser): | ||
# Two subparsers | ||
pass |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be done with argument i.e. with
add_mutually_exclusive_group
? Feels a bit weird doing it with subparsers...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will check again, I looked into how
rasa test
does it and it looks like it uses sub-parsers (though I agree it's a bit odd). I think I could do it withadd_mutually_exclusive_group
and choices though.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I had a look, and I'm not sure that's possible easily -
add_mutually_exclusive_group
lets us force one of the args in the group to be picked, but we have a situation where one option has 2 args that are allowed, one has one arg, and one has none. Those are all dependent on the value ofstrategy
(which we could force withchoices
), but I'm not sure we can do mutual exclusion another way without the use of sub-parsers here (which I agree looks quite nasty)