diff --git a/llama_toolchain/cli/stack/configure.py b/llama_toolchain/cli/stack/configure.py index c85b542e1..2edeae7bc 100644 --- a/llama_toolchain/cli/stack/configure.py +++ b/llama_toolchain/cli/stack/configure.py @@ -38,42 +38,15 @@ class StackConfigure(Subcommand): allowed_ids = [d.distribution_type for d in available_distribution_specs()] self.parser.add_argument( - "--distribution", + "config", type=str, - help='Distribution ("adhoc" or one of: {})'.format(allowed_ids), - ) - self.parser.add_argument( - "--name", - type=str, - help="Name of the build", - ) - self.parser.add_argument( - "--image-type", - type=str, - default="conda", - choices=[v.value for v in ImageType], - ) - self.parser.add_argument( - "--config", - type=str, - help="Path to a config file to use for the build", + help="Path to the package config file (e.g. ~/.llama/builds///.yaml)", ) def _run_stack_configure_cmd(self, args: argparse.Namespace) -> None: from llama_toolchain.core.package import ImageType - if args.config: - with open(args.config, "r") as f: - build_config = BuildConfig(**yaml.safe_load(f)) - image_type = ImageType(build_config.image_type) - distribution = build_config.distribution - name = build_config.name - else: - image_type = ImageType(args.image_type) - name = args.name - distribution = args.distribution - - config_file = BUILDS_BASE_DIR / distribution / image_type.value / f"{name}.yaml" + config_file = Path(args.config) if not config_file.exists(): self.parser.error( f"Could not find {config_file}. Please run `llama stack build` first" diff --git a/llama_toolchain/core/build_conda_env.sh b/llama_toolchain/core/build_conda_env.sh index 2e52e48e2..664f8ad02 100755 --- a/llama_toolchain/core/build_conda_env.sh +++ b/llama_toolchain/core/build_conda_env.sh @@ -19,7 +19,7 @@ fi set -euo pipefail -if [ "$#" -ne 3 ]; then +if [ "$#" -ne 4 ]; then echo "Usage: $0 " >&2 echo "Example: $0 mybuild 'numpy pandas scipy'" >&2 exit 1 @@ -28,7 +28,8 @@ fi distribution_type="$1" build_name="$2" env_name="llamastack-$build_name" -pip_dependencies="$3" +config_file="$3" +pip_dependencies="$4" # Define color codes RED='\033[0;31m' @@ -117,4 +118,4 @@ ensure_conda_env_python310 "$env_name" "$pip_dependencies" printf "${GREEN}Successfully setup conda environment. Configuring build...${NC}\n" -$CONDA_PREFIX/bin/python3 -m llama_toolchain.cli.llama stack configure --distribution $distribution_type --name "$build_name" --image-type conda +$CONDA_PREFIX/bin/python3 -m llama_toolchain.cli.llama stack configure $config_file diff --git a/llama_toolchain/core/build_container.sh b/llama_toolchain/core/build_container.sh index 620bd719f..3d2fc466f 100755 --- a/llama_toolchain/core/build_container.sh +++ b/llama_toolchain/core/build_container.sh @@ -4,7 +4,7 @@ LLAMA_MODELS_DIR=${LLAMA_MODELS_DIR:-} LLAMA_TOOLCHAIN_DIR=${LLAMA_TOOLCHAIN_DIR:-} TEST_PYPI_VERSION=${TEST_PYPI_VERSION:-} -if [ "$#" -ne 4 ]; then +if [ "$#" -ne 5 ]; then echo "Usage: $0 echo "Example: $0 distribution_type my-fastapi-app python:3.9-slim 'fastapi uvicorn' exit 1 @@ -14,7 +14,8 @@ distribution_type=$1 build_name="$2" image_name="llamastack-$build_name" docker_base=$3 -pip_dependencies=$4 +config_file=$4 +pip_dependencies=$5 # Define color codes RED='\033[0;31m' @@ -110,4 +111,4 @@ set +x printf "${GREEN}Succesfully setup Podman image. Configuring build...${NC}" echo "You can run it with: podman run -p 8000:8000 $image_name" -$CONDA_PREFIX/bin/python3 -m llama_toolchain.cli.llama stack configure --distribution $distribution_type --name "$build_name" --package-type container +$CONDA_PREFIX/bin/python3 -m llama_toolchain.cli.llama stack configure $config_file diff --git a/llama_toolchain/core/package.py b/llama_toolchain/core/package.py index 0af75c3a6..6e9eb048d 100644 --- a/llama_toolchain/core/package.py +++ b/llama_toolchain/core/package.py @@ -119,6 +119,7 @@ def build_package( distribution_type, package_name, package_deps.docker_image, + str(package_file), " ".join(package_deps.pip_packages), ] else: @@ -129,6 +130,7 @@ def build_package( script, distribution_type, package_name, + str(package_file), " ".join(package_deps.pip_packages), ]