diff --git a/src/llama_stack_client/lib/cli/configure.py b/src/llama_stack_client/lib/cli/configure.py index 00423acf..7c1d0683 100644 --- a/src/llama_stack_client/lib/cli/configure.py +++ b/src/llama_stack_client/lib/cli/configure.py @@ -9,14 +9,10 @@ import yaml -from llama_stack_client.lib.cli.constants import LLAMA_STACK_CLIENT_CONFIG_DIR +from llama_stack_client.lib.cli.constants import get_config_file_path from llama_stack_client.lib.cli.subcommand import Subcommand -def get_config_file_path(): - return LLAMA_STACK_CLIENT_CONFIG_DIR / "config.yaml" - - def get_config(): config_file = get_config_file_path() if config_file.exists(): diff --git a/src/llama_stack_client/lib/cli/constants.py b/src/llama_stack_client/lib/cli/constants.py index 6892c1ef..22595747 100644 --- a/src/llama_stack_client/lib/cli/constants.py +++ b/src/llama_stack_client/lib/cli/constants.py @@ -8,3 +8,7 @@ from pathlib import Path LLAMA_STACK_CLIENT_CONFIG_DIR = Path(os.path.expanduser("~/.llama/client")) + + +def get_config_file_path(): + return LLAMA_STACK_CLIENT_CONFIG_DIR / "config.yaml" diff --git a/src/llama_stack_client/lib/cli/llama_stack_client.py b/src/llama_stack_client/lib/cli/llama_stack_client.py index c97109bf..85840bf7 100644 --- a/src/llama_stack_client/lib/cli/llama_stack_client.py +++ b/src/llama_stack_client/lib/cli/llama_stack_client.py @@ -6,11 +6,13 @@ import argparse +from llama_stack_client.lib.cli.constants import get_config_file_path + from .configure import ConfigureParser -from .providers import ProvidersParser from .memory_banks import MemoryBanksParser from .models import ModelsParser +from .providers import ProvidersParser from .shields import ShieldsParser @@ -38,6 +40,12 @@ def parse_args(self) -> argparse.Namespace: return self.parser.parse_args() def run(self, args: argparse.Namespace) -> None: + if not get_config_file_path().exists(): + print( + "Config file not found. Please run 'llama-stack-client configure' to create one." + ) + return + args.func(args)