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

[ATO-1661] Add --endpoints flag to rasa-sdk cli #1072

Merged
merged 4 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
1 change: 1 addition & 0 deletions changelog/1072.improvement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add an `--endpoint` flag to the rasa_sdk CLI to enable tracing configuration.
7 changes: 6 additions & 1 deletion rasa_sdk/cli/arguments.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import argparse

from rasa_sdk.constants import DEFAULT_SERVER_PORT
from rasa_sdk.constants import DEFAULT_SERVER_PORT, DEFAULT_ENDPOINTS_PATH


def action_arg(action):
Expand Down Expand Up @@ -54,3 +54,8 @@ def add_endpoint_arguments(parser):
help="Enable auto-reloading of modules containing Action subclasses.",
action="store_true",
)
parser.add_argument(
"--endpoints",
default=DEFAULT_ENDPOINTS_PATH,
help="Configuration file for tracing as a yml file.",
Copy link
Member

Choose a reason for hiding this comment

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

Minor comment: I expect the assistant endpoints file would be used which contains more details than just tracing config. I'd rephrase this to reflect that, unless you recommend separating the tracing config in a diff config file, in which case we should rename the arg?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated!

)
1 change: 1 addition & 0 deletions rasa_sdk/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
PYTHON_LOGGING_SCHEMA_DOCS = (
"https://docs.python.org/3/library/logging.config.html#dictionary-schema-details"
)
DEFAULT_ENDPOINTS_PATH = "endpoints.yml"
12 changes: 12 additions & 0 deletions tests/test_arguments.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import rasa_sdk.endpoint as ep


def test_arg_parser_endpoints():
Copy link
Member

Choose a reason for hiding this comment

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

Final comment: can we parametrize this test so that it checks for default in one test, and for the specified param in another case?

parser = ep.create_argument_parser()
args = ["--endpoints", "endpoint.yml"]
cmdline_args = parser.parse_args(args)
assert cmdline_args.endpoints == "endpoint.yml"

help_text = parser.format_help()
assert "--endpoints ENDPOINTS" in help_text
assert " Configuration file for tracing as a yml file." in help_text
Loading