diff --git a/src/together/lib/cli/__init__.py b/src/together/lib/cli/__init__.py index abbb8e2e..aabdf6d6 100644 --- a/src/together/lib/cli/__init__.py +++ b/src/together/lib/cli/__init__.py @@ -648,6 +648,11 @@ async def run_command() -> None: help_epilogue=BETA_ENDPOINTS_LS_HELP_EXAMPLES, sort_key=2, ) +beta_endpoints_app.command( + (f"{_CLI}.beta.endpoints.list:list"), + name="list", + show=False, +) beta_endpoints_app.command( (f"{_CLI}.beta.endpoints.retrieve:retrieve"), name="get", diff --git a/src/together/lib/cli/api/fine_tuning/create.py b/src/together/lib/cli/api/fine_tuning/create.py index b9d5b2d3..96a5dc3e 100644 --- a/src/together/lib/cli/api/fine_tuning/create.py +++ b/src/together/lib/cli/api/fine_tuning/create.py @@ -13,6 +13,7 @@ int_or_max_converter, ) from together.lib.cli.utils.config import CLIConfigParameter +from together.lib.cli.utils._prompt import confirm as prompt_confirm from together.lib.cli.utils._console import console from together.lib.cli.components.loader import show_loading_status from together.lib.resources.fine_tuning import validate_early_stopping @@ -392,8 +393,7 @@ async def create( if not confirm: console.print(get_confirmation_message(price_line=price_line, warning=warning)) - resp = input("Do you want to proceed? [Y/n]").strip().lower() - if resp and resp != "y" and resp != "yes": + if not config.non_interactive and not await prompt_confirm("Do you want to proceed?"): return console.print(f"Submitting a fine-tuning job with the following parameters:") diff --git a/tests/cli/test_beta_endpoints.py b/tests/cli/test_beta_endpoints.py index e158fa02..932b1586 100644 --- a/tests/cli/test_beta_endpoints.py +++ b/tests/cli/test_beta_endpoints.py @@ -235,8 +235,17 @@ def test_deploy_onto_existing_endpoint(self, respx_mock: MockRouter, cli_runner: class TestBetaEndpointsList: + def test_list_alias_is_hidden_from_help(self, cli_runner: CliRunner) -> None: + result = cli_runner.invoke(["beta", "endpoints", "--help"]) + + output = " ".join(result.output.split()) + assert result.exit_code == 0 + assert "ls: List project, organization, or public endpoints" in output + assert "list: List project, organization, or public endpoints" not in output + + @pytest.mark.parametrize("command", ["list", "ls"]) @pytest.mark.respx(base_url=base_url) - def test_list_sends_cursor_pagination(self, respx_mock: MockRouter, cli_runner: CliRunner) -> None: + def test_list_sends_cursor_pagination(self, command: str, respx_mock: MockRouter, cli_runner: CliRunner) -> None: route = respx_mock.get("/projects/proj/endpoints").mock( return_value=httpx.Response( 200, @@ -245,7 +254,7 @@ def test_list_sends_cursor_pagination(self, respx_mock: MockRouter, cli_runner: ) result = cli_runner.invoke( - ["beta", "endpoints", "ls", "--project", "proj", "--limit", "10", "--after", "tok", "--json"] + ["beta", "endpoints", command, "--project", "proj", "--limit", "10", "--after", "tok", "--json"] ) assert result.exit_code == 0, result.output diff --git a/tests/cli/test_fine_tuning.py b/tests/cli/test_fine_tuning.py index 5a17a6fc..6ed020ae 100644 --- a/tests/cli/test_fine_tuning.py +++ b/tests/cli/test_fine_tuning.py @@ -122,14 +122,14 @@ def test_create_handles_unavailable_price_estimation(self, respx_mock: MockRoute "file-train", "--model", "meta-llama/Llama-3.2-11B-Vision-Instruct-Turbo", + "--non-interactive", ], - input="y\n", ) output = " ".join(result.output.split()) assert result.exit_code == 0 assert "not available for multimodal datasets" in output - assert "Do you want to proceed?" in result.output + assert "Do you want to proceed?" not in result.output assert "ft-created" in result.output assert estimate.calls assert create.calls