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 all 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 the assistant as a yml file.",
)
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"
21 changes: 21 additions & 0 deletions tests/test_arguments.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import rasa_sdk.endpoint as ep
import pytest

from rasa_sdk.constants import DEFAULT_ENDPOINTS_PATH


@pytest.mark.parametrize(
"args, expected",
[
([], DEFAULT_ENDPOINTS_PATH),
(["--endpoints", "a.yml"], "a.yml"),
],
)
def test_arg_parser_endpoints(args, expected):
parser = ep.create_argument_parser()
cmdline_args = parser.parse_args(args)
assert cmdline_args.endpoints == expected

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