From b611e8bbd246f70f07e608c643cc03f15613fcb9 Mon Sep 17 00:00:00 2001 From: Xi Yan Date: Tue, 17 Sep 2024 22:56:06 -0700 Subject: [PATCH] add back wizard for build --- llama_stack/cli/stack/build.py | 15 +++++++++------ llama_stack/distribution/datatypes.py | 8 +++++++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/llama_stack/cli/stack/build.py b/llama_stack/cli/stack/build.py index f6f79b621..4105f61cc 100644 --- a/llama_stack/cli/stack/build.py +++ b/llama_stack/cli/stack/build.py @@ -27,7 +27,7 @@ class StackBuild(Subcommand): def _add_arguments(self): self.parser.add_argument( - "config", + "--config", type=str, help="Path to a config file to use for the build. You may find example configs in llama_stack/distribution/example_configs", ) @@ -44,9 +44,10 @@ class StackBuild(Subcommand): import json import os + from llama_stack.distribution.build import ApiInput, build_image, ImageType + from llama_stack.distribution.utils.config_dirs import DISTRIBS_BASE_DIR from llama_stack.distribution.utils.serialize import EnumEncoder - from llama_stack.distribution.build import ApiInput, build_image, ImageType from termcolor import cprint # save build.yaml spec for building same distribution again @@ -74,13 +75,15 @@ class StackBuild(Subcommand): ) def _run_stack_build_command(self, args: argparse.Namespace) -> None: - from llama_stack.distribution.utils.prompt_for_config import prompt_for_config from llama_stack.distribution.utils.dynamic import instantiate_class_type + from llama_stack.distribution.utils.prompt_for_config import prompt_for_config if not args.config: - self.parser.error( - "No config file specified. Please use `llama stack build /path/to/*-build.yaml`. Example config files can be found in llama_stack/distribution/example_configs" - ) + # self.parser.error( + # "No config file specified. Please use `llama stack build /path/to/*-build.yaml`. Example config files can be found in llama_stack/distribution/example_configs" + # ) + build_config = prompt_for_config(BuildConfig, None) + self._run_stack_build_command_from_build_config(build_config) return with open(args.config, "r") as f: diff --git a/llama_stack/distribution/datatypes.py b/llama_stack/distribution/datatypes.py index e57617016..8328acd82 100644 --- a/llama_stack/distribution/datatypes.py +++ b/llama_stack/distribution/datatypes.py @@ -184,7 +184,13 @@ class DistributionSpec(BaseModel): ) docker_image: Optional[str] = None providers: Dict[str, Union[str, List[str]]] = Field( - default_factory=dict, + default={ + "inference": "meta-reference", + "memory": "meta-reference", + "safety": "meta-reference", + "agents": "meta-reference", + "telemetry": "meta-reference", + }, description=""" Provider Types for each of the APIs provided by this distribution. If you select multiple providers, you should provide an appropriate 'routing_map'