ci: tests

Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
Sébastien Han 2025-06-12 16:39:08 +02:00
parent 5fdd4952a9
commit 67b6f79715
No known key found for this signature in database
25 changed files with 245 additions and 224 deletions

View file

@ -8,23 +8,21 @@
import yaml
from llama_stack.apis.datatypes import Api, ExternalApiSpec
from llama_stack.distribution.datatypes import BuildConfig, StackRunConfig
from llama_stack.log import get_logger
logger = get_logger(name=__name__, category="core")
def load_external_apis(config=None) -> dict[Api, ExternalApiSpec]:
def load_external_apis(config: StackRunConfig | BuildConfig) -> dict[Api, ExternalApiSpec]:
"""Load external API specifications from the configured directory.
Args:
config: StackRunConfig containing the external APIs directory path
config: StackRunConfig or BuildConfig containing the external APIs directory path
Returns:
A dictionary mapping API names to their specifications
"""
if not config:
return {}
if not hasattr(config, "external_apis_dir"):
return {}
@ -51,9 +49,9 @@ def load_external_apis(config=None) -> dict[Api, ExternalApiSpec]:
external_apis[api] = spec
except yaml.YAMLError as yaml_err:
logger.error(f"Failed to parse YAML file {yaml_path}: {yaml_err}")
raise yaml_err
except Exception as e:
logger.error(f"Failed to load external API spec from {yaml_path}: {e}")
raise e
raise
except Exception:
logger.exception(f"Failed to load external API spec from {yaml_path}")
raise
return external_apis