Skip to content
This repository has been archived by the owner on Aug 22, 2019. It is now read-only.

lots of small fixes for cli interaction #1330

Merged
merged 3 commits into from
Nov 15, 2018
Merged

lots of small fixes for cli interaction #1330

merged 3 commits into from
Nov 15, 2018

Conversation

tmbo
Copy link
Member

@tmbo tmbo commented Nov 13, 2018

Proposed changes:

  • fixes #1322
  • allow to properly pass stories in the same way to all scripts
  • use the same parsing behaviour of the policy config file for all scripts
  • moved the default policy to the module, so that we can use it when rasa core gets packaged

Status (please check what you already did):

  • made PR ready for code review
  • added some tests for the functionality
  • updated the documentation
  • updated the changelog

@tmbo tmbo changed the base branch from master to 0.12.x November 13, 2018 16:46
@tmbo
Copy link
Member Author

tmbo commented Nov 13, 2018

This is an important PR that we should merge for a 0.12.1 release to fix broken cmdline interaction (e.g. visualisation script)

@tmbo tmbo requested a review from ricwo November 13, 2018 16:47
Copy link
Contributor

@ricwo ricwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really good 👍 Left a few comments, but it's pretty much ready to go

---------------------

By default, we try to provide you with a good set of configuration values
and policies that suite most people. But you are encouraged to modify
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that suit most people


return max(max_histories, default=0)

def _are_all_featurizes_using_a_max_history(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

featurizers

max_max_history)
elif policy.featurizer is not None:
all_max_history_featurizers = False
max_history = self._max_history()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a lot more readable now!

rasa_core/agent.py Show resolved Hide resolved
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that won't last long 😛

if not cmdline_args.out:
raise ValueError("you must provide a path where the model "
"will be saved using -o / --out")

if (isinstance(cmdline_args.config, list) and
len(cmdline_args.config) > 1):
raise ValueError("You can only pass one config file at a time")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could do away with these checks by leaving nargs for config unspecified, in which case it is passed as a single string, not a list. The script won't even run if you'd specify more

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that is a good point, at the moment we really do not need multiple configs for this script

parser.add_argument(
'-c', '--config',
type=str,
nargs="*",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can nargs be anything other than one (or the default)?

type=str,
required=True,
help="domain specification yaml file")
return parser
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we make these functions return None to indicate that parser is mutable? We don't use the return value in any of these functions' calls

@@ -11,10 +11,8 @@

def load(config_file):
# type: (Optional[Text], Dict[Text, Any], int) -> List[Policy]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the type annotations don't seem right

@@ -605,7 +599,7 @@ def run_comparison_evaluation(models, stories, output):
num_correct)


def plot_curve(output, no_stories, ax=None, **kwargs):
def plot_curve(output, no_stories, ax=None):
"""Plot the results from run_comparison_evaluation."""
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add type annotations and include the arguments in the description?

@tmbo
Copy link
Member Author

tmbo commented Nov 14, 2018

Alright, done - ready for another review. I took your comment (adding description to parameters) as a reason to bring all the comments in the same google style docstr format.

@tmbo tmbo requested a review from ricwo November 14, 2018 12:06
Copy link
Contributor

@ricwo ricwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great 💯 👍

:param app_password: Bot Framework application secret
Args:
app_id: Bot Framework's API id
app_password: Bot Framework application secret
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎢

@ricwo ricwo merged commit 6d6a4d8 into 0.12.x Nov 15, 2018
@tmbo tmbo deleted the cli-fixes branch March 8, 2019 12:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
2 participants