fix: generate provider config when using --providers

call the sample_run_config method for providers that have it when generating a run config using `llama stack run --providers`. This will propagate API keys

resolves #4032

Signed-off-by: Charlie Doern <cdoern@redhat.com>
This commit is contained in:
Charlie Doern 2025-11-03 11:30:20 -05:00
parent 7e294d33d9
commit 23b8535022
2 changed files with 53 additions and 0 deletions

View file

@ -31,6 +31,7 @@ from llama_stack.core.storage.datatypes import (
)
from llama_stack.core.utils.config_dirs import DISTRIBS_BASE_DIR
from llama_stack.core.utils.config_resolution import Mode, resolve_config_or_distro
from llama_stack.core.utils.dynamic import instantiate_class_type
from llama_stack.log import LoggingConfig, get_logger
REPO_ROOT = Path(__file__).parent.parent.parent.parent
@ -132,8 +133,14 @@ class StackRun(Subcommand):
)
sys.exit(1)
if provider_type in providers_for_api:
config_type = instantiate_class_type(providers_for_api[provider_type].config_class)
if config_type is not None and hasattr(config_type, "sample_run_config"):
config = config_type.sample_run_config(__distro_dir__="~/.llama/distributions/providers-run")
else:
config = {}
provider = Provider(
provider_type=provider_type,
config=config,
provider_id=provider_type.split("::")[1],
)
provider_list.setdefault(api, []).append(provider)