mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-05 20:27:35 +00:00
move core -> distribution
This commit is contained in:
parent
bbf0b59ae4
commit
17172a8bf9
46 changed files with 70 additions and 57 deletions
|
@ -7,7 +7,7 @@
|
|||
import argparse
|
||||
|
||||
from llama_stack.cli.subcommand import Subcommand
|
||||
from llama_stack.core.datatypes import * # noqa: F403
|
||||
from llama_stack.distribution.datatypes import * # noqa: F403
|
||||
from pathlib import Path
|
||||
|
||||
import yaml
|
||||
|
@ -44,9 +44,9 @@ class StackBuild(Subcommand):
|
|||
import json
|
||||
import os
|
||||
|
||||
from llama_stack.common.config_dirs import DISTRIBS_BASE_DIR
|
||||
from llama_stack.common.serialize import EnumEncoder
|
||||
from llama_stack.core.package 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,8 +74,8 @@ class StackBuild(Subcommand):
|
|||
)
|
||||
|
||||
def _run_stack_build_command(self, args: argparse.Namespace) -> None:
|
||||
from llama_stack.common.prompt_for_config import prompt_for_config
|
||||
from llama_stack.core.dynamic import instantiate_class_type
|
||||
from llama_stack.distribution.utils.prompt_for_config import prompt_for_config
|
||||
from llama_stack.distribution.utils.dynamic import instantiate_class_type
|
||||
|
||||
if not args.config:
|
||||
self.parser.error(
|
||||
|
|
|
@ -14,10 +14,10 @@ import yaml
|
|||
from termcolor import cprint
|
||||
|
||||
from llama_stack.cli.subcommand import Subcommand
|
||||
from llama_stack.common.config_dirs import BUILDS_BASE_DIR
|
||||
from llama_stack.distribution.utils.config_dirs import BUILDS_BASE_DIR
|
||||
|
||||
from llama_stack.common.exec import run_with_pty
|
||||
from llama_stack.core.datatypes import * # noqa: F403
|
||||
from llama_stack.distribution.utils.exec import run_with_pty
|
||||
from llama_stack.distribution.datatypes import * # noqa: F403
|
||||
import os
|
||||
|
||||
|
||||
|
@ -49,7 +49,7 @@ class StackConfigure(Subcommand):
|
|||
)
|
||||
|
||||
def _run_stack_configure_cmd(self, args: argparse.Namespace) -> None:
|
||||
from llama_stack.core.package import ImageType
|
||||
from llama_stack.distribution.build import ImageType
|
||||
|
||||
docker_image = None
|
||||
build_config_file = Path(args.config)
|
||||
|
@ -66,7 +66,7 @@ class StackConfigure(Subcommand):
|
|||
os.makedirs(builds_dir, exist_ok=True)
|
||||
|
||||
script = pkg_resources.resource_filename(
|
||||
"llama_stack", "core/configure_container.sh"
|
||||
"llama_stack", "distribution/configure_container.sh"
|
||||
)
|
||||
script_args = [script, docker_image, str(builds_dir)]
|
||||
|
||||
|
@ -95,8 +95,8 @@ class StackConfigure(Subcommand):
|
|||
build_config: BuildConfig,
|
||||
output_dir: Optional[str] = None,
|
||||
):
|
||||
from llama_stack.common.serialize import EnumEncoder
|
||||
from llama_stack.core.configure import configure_api_providers
|
||||
from llama_stack.distribution.configure import configure_api_providers
|
||||
from llama_stack.distribution.utils.serialize import EnumEncoder
|
||||
|
||||
builds_dir = BUILDS_BASE_DIR / build_config.image_type
|
||||
if output_dir:
|
||||
|
|
|
@ -26,7 +26,7 @@ class StackListApis(Subcommand):
|
|||
|
||||
def _run_apis_list_cmd(self, args: argparse.Namespace) -> None:
|
||||
from llama_stack.cli.table import print_table
|
||||
from llama_stack.core.distribution import stack_apis
|
||||
from llama_stack.distribution.distribution import stack_apis
|
||||
|
||||
# eventually, this should query a registry at llama.meta.com/llamastack/distributions
|
||||
headers = [
|
||||
|
|
|
@ -22,7 +22,7 @@ class StackListProviders(Subcommand):
|
|||
self.parser.set_defaults(func=self._run_providers_list_cmd)
|
||||
|
||||
def _add_arguments(self):
|
||||
from llama_stack.core.distribution import stack_apis
|
||||
from llama_stack.distribution.distribution import stack_apis
|
||||
|
||||
api_values = [a.value for a in stack_apis()]
|
||||
self.parser.add_argument(
|
||||
|
@ -34,7 +34,7 @@ class StackListProviders(Subcommand):
|
|||
|
||||
def _run_providers_list_cmd(self, args: argparse.Namespace) -> None:
|
||||
from llama_stack.cli.table import print_table
|
||||
from llama_stack.core.distribution import Api, api_providers
|
||||
from llama_stack.distribution.distribution import Api, api_providers
|
||||
|
||||
all_providers = api_providers()
|
||||
providers_for_api = all_providers[Api(args.api)]
|
||||
|
|
|
@ -12,7 +12,7 @@ import pkg_resources
|
|||
import yaml
|
||||
|
||||
from llama_stack.cli.subcommand import Subcommand
|
||||
from llama_stack.core.datatypes import * # noqa: F403
|
||||
from llama_stack.distribution.datatypes import * # noqa: F403
|
||||
|
||||
|
||||
class StackRun(Subcommand):
|
||||
|
@ -47,7 +47,7 @@ class StackRun(Subcommand):
|
|||
)
|
||||
|
||||
def _run_stack_run_cmd(self, args: argparse.Namespace) -> None:
|
||||
from llama_stack.common.exec import run_with_pty
|
||||
from llama_stack.distribution.utils.exec import run_with_pty
|
||||
|
||||
if not args.config:
|
||||
self.parser.error("Must specify a config file to run")
|
||||
|
@ -68,13 +68,13 @@ class StackRun(Subcommand):
|
|||
if config.docker_image:
|
||||
script = pkg_resources.resource_filename(
|
||||
"llama_stack",
|
||||
"core/start_container.sh",
|
||||
"distribution/start_container.sh",
|
||||
)
|
||||
run_args = [script, config.docker_image]
|
||||
else:
|
||||
script = pkg_resources.resource_filename(
|
||||
"llama_stack",
|
||||
"core/start_conda_env.sh",
|
||||
"distribution/start_conda_env.sh",
|
||||
)
|
||||
run_args = [
|
||||
script,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue