Skip to content

Commit

Permalink
have aici cli use gh: controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
mmoskal committed Feb 10, 2024
1 parent 76ac24b commit 5e944b6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion controllers/jsctrl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Also, the [PyCtrl samples](../pyctrl/samples/) translate 1:1 to JsCtrl.

## Usage

To run a JsCtrl sample (using controller tagged with `jsctrl-latest`) use:
To run a JsCtrl sample use:

```bash
../aici.sh run samples/hello.js
Expand Down
2 changes: 0 additions & 2 deletions controllers/pyctrl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ Then you can run a PyCtrl sample:
../aici.sh run --ctrl pyctrl-latest samples/test.py
```

In fact, `--ctrl pyctrl-latest` is the default when you pass a `.py` file as input,
so it can be skipped.
You can also build and run in one step (without tagging):

```bash
Expand Down
16 changes: 10 additions & 6 deletions py/pyaici/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,11 @@ def main_rest(args):
controller_arg = open(fn).read()
if not controller:
if fn.endswith(".py"):
controller = "pyctrl-latest"
controller = "gh:microsoft/aici/pyctrl"
elif fn.endswith(".js"):
controller = "jsctrl-latest"
controller = "gh:microsoft/aici/jsctrl"
elif fn.endswith(".json"):
controller = "declctrl-latest"
controller = "gh:microsoft/aici/declctrl"
else:
cli_error(
"Can't determine AICI Controller type from file name: " + fn
Expand Down Expand Up @@ -236,8 +236,12 @@ def main_inner():
help="run model inference via an AICI Controller",
description="Run model inference via an AICI Controller.",
epilog="""
If FILE ends with .py, --ctrl defaults to 'pyctrl-latest'.
Similarly, it's 'jsctrl-latest' for .js and 'declctrl-latest' for .json.
Using --ctrl gh:user/repo/ctrl instructs the server to find *.wasm file containing string 'ctrl' in the latest release
of user/repo on GitHub. The /ctrl part is optional if there is only one controller in the release.
You can specify release with --ctrl gh:user/repo/ctrl/v1.2.3.
If FILE ends with .py, --ctrl defaults to 'gh:microsoft/aici/pyctrl'.
Similarly, it's 'gh:microsoft/aici/jsctrl' for .js and 'gh:microsoft/aici/declctrl' for .json.
""",
)
run_cmd.add_argument(
Expand All @@ -252,7 +256,7 @@ def main_inner():
"-c",
metavar="MODULE_ID",
type=str,
help="tag name or hex module id (sha256 of .wasm file)",
help="tag name, module id (sha256 of .wasm file), or gh:user/repo",
)
run_cmd.add_argument(
"--upload",
Expand Down

0 comments on commit 5e944b6

Please sign in to comment.