mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-22 23:22:25 +00:00
More deprecations
Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
This commit is contained in:
parent
49497d2d96
commit
ef214cbfc0
4 changed files with 34 additions and 36 deletions
|
|
@ -10,7 +10,7 @@ import re
|
|||
from pathlib import Path
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
import pkg_resources
|
||||
import importlib.resources
|
||||
import yaml
|
||||
|
||||
from termcolor import colored
|
||||
|
|
@ -190,14 +190,13 @@ async def construct_stack(
|
|||
|
||||
|
||||
def get_stack_run_config_from_template(template: str) -> StackRunConfig:
|
||||
template_path = pkg_resources.resource_filename(
|
||||
"llama_stack", f"templates/{template}/run.yaml"
|
||||
template_path = (
|
||||
importlib.resources.files("llama_stack") / f"templates/{template}/run.yaml"
|
||||
)
|
||||
|
||||
if not Path(template_path).exists():
|
||||
raise ValueError(f"Template '{template}' not found at {template_path}")
|
||||
|
||||
with open(template_path) as f:
|
||||
run_config = yaml.safe_load(f)
|
||||
with importlib.resources.as_file(template_path) as path:
|
||||
if not path.exists():
|
||||
raise ValueError(f"Template '{template}' not found at {template_path}")
|
||||
run_config = yaml.safe_load(path.open())
|
||||
|
||||
return StackRunConfig(**replace_env_vars(run_config))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue