llama stack start -> llama stack run

This commit is contained in:
Ashwin Bharambe 2024-09-03 11:23:26 -07:00
parent fab6bd1728
commit fb3c4566ce
5 changed files with 13 additions and 13 deletions

View file

@ -242,7 +242,7 @@ An agentic app has several components including model inference, tool execution
The Llama Stack is a collection of REST APIs. An API is _implemented_ by Provider. An assembly of Providers together provides the implementation for the Stack -- this package is called a Distribution. The Llama Stack is a collection of REST APIs. An API is _implemented_ by Provider. An assembly of Providers together provides the implementation for the Stack -- this package is called a Distribution.
As an example, by running a simple command `llama stack start <YAML>`, you can bring up a server serving the following endpoints, among others: As an example, by running a simple command `llama stack run`, you can bring up a server serving the following endpoints, among others:
``` ```
POST /inference/chat_completion POST /inference/chat_completion
POST /inference/completion POST /inference/completion
@ -377,12 +377,12 @@ Now lets start Llama Stack server.
You need the YAML configuration file which was written out at the end by the `llama stack build` step. You need the YAML configuration file which was written out at the end by the `llama stack build` step.
``` ```
llama stack start local --name llama-8b --port 5000 llama stack run local --name llama-8b --port 5000
``` ```
You should see the Stack server start and print the APIs that it is supporting, You should see the Stack server start and print the APIs that it is supporting,
``` ```
$ llama stack start local --name llama-8b --port 5000 $ llama stack run local --name llama-8b --port 5000
> initializing model parallel with size 1 > initializing model parallel with size 1
> initializing ddp with size 1 > initializing ddp with size 1

View file

@ -16,17 +16,17 @@ from llama_toolchain.core.datatypes import * # noqa: F403
from llama_toolchain.common.config_dirs import BUILDS_BASE_DIR from llama_toolchain.common.config_dirs import BUILDS_BASE_DIR
class StackStart(Subcommand): class StackRun(Subcommand):
def __init__(self, subparsers: argparse._SubParsersAction): def __init__(self, subparsers: argparse._SubParsersAction):
super().__init__() super().__init__()
self.parser = subparsers.add_parser( self.parser = subparsers.add_parser(
"start", "run",
prog="llama stack start", prog="llama stack run",
description="""start the server for a Llama Stack Distribution. You should have already built (or downloaded) and configured the distribution.""", description="""start the server for a Llama Stack Distribution. You should have already built (or downloaded) and configured the distribution.""",
formatter_class=argparse.RawTextHelpFormatter, formatter_class=argparse.RawTextHelpFormatter,
) )
self._add_arguments() self._add_arguments()
self.parser.set_defaults(func=self._run_stack_start_cmd) self.parser.set_defaults(func=self._run_stack_run_cmd)
def _add_arguments(self): def _add_arguments(self):
from llama_toolchain.core.package import BuildType from llama_toolchain.core.package import BuildType
@ -39,7 +39,7 @@ class StackStart(Subcommand):
self.parser.add_argument( self.parser.add_argument(
"--name", "--name",
type=str, type=str,
help="Name of the API build you want to start", help="Name of the build you want to start",
required=True, required=True,
) )
self.parser.add_argument( self.parser.add_argument(
@ -61,7 +61,7 @@ class StackStart(Subcommand):
default=False, default=False,
) )
def _run_stack_start_cmd(self, args: argparse.Namespace) -> None: def _run_stack_run_cmd(self, args: argparse.Namespace) -> None:
from llama_toolchain.common.exec import run_with_pty from llama_toolchain.common.exec import run_with_pty
from llama_toolchain.core.package import BuildType from llama_toolchain.core.package import BuildType

View file

@ -11,7 +11,7 @@ from llama_toolchain.cli.subcommand import Subcommand
from .build import StackBuild from .build import StackBuild
from .configure import StackConfigure from .configure import StackConfigure
from .list import StackList from .list import StackList
from .start import StackStart from .run import StackRun
class StackParser(Subcommand): class StackParser(Subcommand):
@ -29,4 +29,4 @@ class StackParser(Subcommand):
StackBuild.create(subparsers) StackBuild.create(subparsers)
StackConfigure.create(subparsers) StackConfigure.create(subparsers)
StackList.create(subparsers) StackList.create(subparsers)
StackStart.create(subparsers) StackRun.create(subparsers)

View file

@ -125,4 +125,4 @@ else
target="$distribution_id" target="$distribution_id"
fi fi
$CONDA_PREFIX/bin/python3 -m llama_toolchain.cli.llama $subcommand configure $target --build-name "$build_name" --build-type conda_env $CONDA_PREFIX/bin/python3 -m llama_toolchain.cli.llama $subcommand configure $target --name "$build_name" --type conda_env

View file

@ -117,4 +117,4 @@ else
target="$distribution_id" target="$distribution_id"
fi fi
$CONDA_PREFIX/bin/python3 -m llama_toolchain.cli.llama $subcommand configure $target --build-name "$build_name" --build-type container $CONDA_PREFIX/bin/python3 -m llama_toolchain.cli.llama $subcommand configure $target --name "$build_name" --type container