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

Issue 3975 #5243

Merged
merged 12 commits into from
Feb 18, 2020
2 changes: 2 additions & 0 deletions changelog/3975.improvement.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Added command line argument ``--conversation-id`` to ``rasa interactive``.
If the argument is not given, ``conversation_id`` defaults to a random uuid.
59 changes: 33 additions & 26 deletions rasa/cli/arguments/interactive.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import argparse
import uuid

from rasa.cli.arguments.default_arguments import (
add_domain_param,
Expand All @@ -18,41 +19,54 @@
)


def set_interactive_arguments(parser: argparse.ArgumentParser):
def set_interactive_arguments(parser: argparse.ArgumentParser) -> None:
erohmensing marked this conversation as resolved.
Show resolved Hide resolved
parser.add_argument(
"--e2e",
action="store_true",
help="Save story files in e2e format. In this format user messages will be included in the stories.",
)

add_model_param(parser, default=None)
add_data_param(parser)

add_skip_visualization_param(parser)

add_endpoint_param(
parser,
help_text="Configuration file for the model server and the connectors as a yml file.",
)
_add_common_params(parser)
train_arguments = _add_training_arguments(parser)

train_arguments = parser.add_argument_group("Train Arguments")
add_config_param(train_arguments)
add_domain_param(train_arguments)
add_out_param(
train_arguments, help_text="Directory where your models should be stored."
)
add_augmentation_param(train_arguments)
add_debug_plots_param(train_arguments)
add_dump_stories_param(train_arguments)
add_force_param(train_arguments)
add_persist_nlu_data_param(train_arguments)


def set_interactive_core_arguments(parser: argparse.ArgumentParser):
def set_interactive_core_arguments(parser: argparse.ArgumentParser) -> None:
add_model_param(parser, model_name="Rasa Core", default=None)
add_stories_param(parser)

add_skip_visualization_param(parser)
_add_common_params(parser)
_add_training_arguments(parser)


def _add_common_params(parser: argparse.ArgumentParser) -> None:
parser.add_argument(
"--skip-visualization",
default=False,
action="store_true",
help="Disable plotting the visualization during interactive learning.",
)

parser.add_argument(
"--conversation-id",
default=uuid.uuid4().hex,
help="Specify the id of the conversation the messages are in. Defaults to a "
"UUID that will be randomly generated.",
)

add_endpoint_param(
parser,
help_text="Configuration file for the model server and the connectors as a yml file.",
)


# noinspection PyProtectedMember
def _add_training_arguments(parser: argparse.ArgumentParser) -> argparse._ArgumentGroup:
train_arguments = parser.add_argument_group("Train Arguments")
add_config_param(train_arguments)
add_domain_param(train_arguments)
Expand All @@ -63,11 +77,4 @@ def set_interactive_core_arguments(parser: argparse.ArgumentParser):
add_debug_plots_param(train_arguments)
add_dump_stories_param(train_arguments)


def add_skip_visualization_param(parser: argparse.ArgumentParser):
parser.add_argument(
"--skip-visualization",
default=False,
action="store_true",
help="Disable plotting the visualization during interactive learning.",
)
return train_arguments
7 changes: 1 addition & 6 deletions rasa/cli/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
from rasa.cli.arguments import interactive as arguments
from rasa import model

# noinspection PyProtectedMember
from rasa.constants import DEFAULT_MODELS_PATH, DEFAULT_ENDPOINTS_PATH
from rasa.importers.importer import TrainingDataImporter

logger = logging.getLogger(__name__)


# noinspection PyProtectedMember
def add_subparser(
subparsers: argparse._SubParsersAction, parents: List[argparse.ArgumentParser]
):
Expand All @@ -28,11 +28,6 @@ def add_subparser(
"Rasa model by chatting.",
)
interactive_parser.set_defaults(func=interactive, core_only=False)
interactive_parser.add_argument(
"--e2e",
action="store_true",
help="Save story files in e2e format. In this format user messages will be included in the stories.",
)

interactive_subparsers = interactive_parser.add_subparsers()
interactive_core_parser = interactive_subparsers.add_parser(
Expand Down
1 change: 1 addition & 0 deletions rasa/core/train.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ def do_interactive_learning(
interactive.run_interactive_learning(
file_importer=file_importer,
skip_visualization=args.skip_visualization,
conversation_id=args.conversation_id,
server_args=args.__dict__,
)

Expand Down
Loading