Skip to content

Commit

Permalink
Merge pull request #1072 from RasaHQ/ATO-1661-add-endpoints-arg-to-ra…
Browse files Browse the repository at this point in the history
…sa-sdk-cli

[ATO-1661] Add `--endpoints` flag to rasa-sdk cli
  • Loading branch information
Tawakalt committed Feb 5, 2024
2 parents 073db29 + e9d7183 commit 33b8fa4
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
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

0 comments on commit 33b8fa4

Please sign in to comment.