diff --git a/docs/source/markdown/ramalama-rm.1.md b/docs/source/markdown/ramalama-rm.1.md new file mode 100644 index 00000000..c26c3406 --- /dev/null +++ b/docs/source/markdown/ramalama-rm.1.md @@ -0,0 +1,16 @@ +% ramalama-rm 1 + +## NAME +ramalama - Remove specified AI Model from system. + +## SYNOPSIS +**ramalama rm** [*options*] *model* + +## DESCRIPTION +Remove specified AI Model from system + +## SEE ALSO +**[ramalama(1)](ramalama.1.md) + +## HISTORY +Aug 2024, Originally compiled by Dan Walsh diff --git a/docs/source/markdown/ramalama.1.md b/docs/source/markdown/ramalama.1.md index b72c6294..12a38ddb 100644 --- a/docs/source/markdown/ramalama.1.md +++ b/docs/source/markdown/ramalama.1.md @@ -19,6 +19,7 @@ Ramalama : The goal of ramalama is to make AI even more boring. | [ramalama-pull(1)](ramalama-pull.1.md) | Pull AI Model from registry to local storage | | [ramalama-push(1)](ramalama-push.1.md) | Push specified AI Model (OCI-only at present) | | [ramalama-run(1)](ramalama-run.1.md) | Run a chatbot on AI Model. | +| [ramalama-rm(1)](ramalama-rm.1.md) | Remove an AI Model. | | [ramalama-serve(1)](ramalama-serve.1.md)| Serve local AI Model as an API Service. | ## CONFIGURATION FILES diff --git a/ramalama/cli.py b/ramalama/cli.py index 0ebcaa0d..3c692ecd 100644 --- a/ramalama/cli.py +++ b/ramalama/cli.py @@ -23,6 +23,7 @@ def usage(): print(" list List models") print(" pull MODEL Pull a model") print(" push MODEL TARGET Push a model to target") + print(" rm MODEL Remove a model") print(" run MODEL Run a model") print(" serve MODEL Serve a model") sys.exit(1) @@ -216,6 +217,15 @@ def push_cli(store, args, port): f"Unsupported repository type for model: {model}") +def rm_cli(store, args, port): + if len(args) < 1: + usage() + + model = args.pop(0).replace("://", "/") + model = f"{store}/models/{model}" + exec_cmd(["rm", model]) + + def run_cli(store, args, port): if len(args) < 1: usage() @@ -259,4 +269,5 @@ def in_container(): funcDict["pull"] = pull_cli funcDict["push"] = push_cli funcDict["run"] = run_cli +funcDict["rm"] = rm_cli funcDict["serve"] = serve_cli diff --git a/test/ci.sh b/test/ci.sh index 12d96e20..92499560 100755 --- a/test/ci.sh +++ b/test/ci.sh @@ -56,6 +56,12 @@ main() { ./${binfile} list | grep tiny-vicuna-1b ./${binfile} list | grep NAME ./${binfile} list | grep oci://quay.io/mmortari/gguf-py-example/v1/example.gguf + ./${binfile} rm ollama://ben1t0/tiny-llm:latest + if ./${binfile} list | grep ben1t0/tiny-llm; then + exit 1 + else + exit 0 + fi # ramalama list | grep granite-code # ramalama rm granite-code }