llama-stack-mirror/llama_stack/distribution
Sébastien Han 43c1f39bd6
refactor(env)!: enhanced environment variable substitution (#2490)
# What does this PR do?

This commit significantly improves the environment variable substitution
functionality in Llama Stack configuration files:
* The version field in configuration files has been changed from string
to integer type for better type consistency across build and run
configurations.

* The environment variable substitution system for ${env.FOO:} was fixed
and properly returns an error

* The environment variable substitution system for ${env.FOO+} returns
None instead of an empty strings, it better matches type annotations in
config fields

* The system includes automatic type conversion for boolean, integer,
and float values.

* The error messages have been enhanced to provide clearer guidance when
environment variables are missing, including suggestions for using
default values or conditional syntax.

* Comprehensive documentation has been added to the configuration guide
explaining all supported syntax patterns, best practices, and runtime
override capabilities.

* Multiple provider configurations have been updated to use the new
conditional syntax for optional API keys, making the system more
flexible for different deployment scenarios. The telemetry configuration
has been improved to properly handle optional endpoints with appropriate
validation, ensuring that required endpoints are specified when their
corresponding sinks are enabled.

* There were many instances of ${env.NVIDIA_API_KEY:} that should have
caused the code to fail. However, due to a bug, the distro server was
still being started, and early validation wasn’t triggered. As a result,
failures were likely being handled downstream by the providers. I’ve
maintained similar behavior by using ${env.NVIDIA_API_KEY:+}, though I
believe this is incorrect for many configurations. I’ll leave it to each
provider to correct it as needed.

* Environment variable substitution now uses the same syntax as Bash
parameter expansion.

Signed-off-by: Sébastien Han <seb@redhat.com>
2025-06-26 08:20:08 +05:30
..
access_control fix: finish conversion to StrEnum (#2514) 2025-06-26 08:01:26 +05:30
routers chore: remove nested imports (#2515) 2025-06-26 08:01:05 +05:30
routing_tables feat: fine grained access control policy (#2264) 2025-06-03 14:51:12 -07:00
server feat: drop python 3.10 support (#2469) 2025-06-19 12:07:14 +05:30
store fix(tools): do not index tools, only index toolgroups (#2261) 2025-05-25 13:27:52 -07:00
ui chore: remove nested imports (#2515) 2025-06-26 08:01:05 +05:30
utils refactor: remove container from list of run image types (#2178) 2025-06-02 09:57:55 +02:00
__init__.py API Updates (#73) 2024-09-17 19:51:35 -07:00
build.py chore: bump python supported version to 3.12 (#2475) 2025-06-24 09:22:04 +05:30
build_conda_env.sh chore: fix build script bug (#2507) 2025-06-24 12:05:22 -07:00
build_container.sh chore: bump python supported version to 3.12 (#2475) 2025-06-24 09:22:04 +05:30
build_venv.sh chore: remove straggler references to llama-models (#1345) 2025-03-01 14:26:03 -08:00
client.py chore: make cprint write to stderr (#2250) 2025-05-24 23:39:57 -07:00
common.sh feat(pre-commit): enhance pre-commit hooks with additional checks (#2014) 2025-04-30 11:35:49 -07:00
configure.py feat: refactor external providers dir (#2049) 2025-05-15 20:17:03 +02:00
datatypes.py refactor(env)!: enhanced environment variable substitution (#2490) 2025-06-26 08:20:08 +05:30
distribution.py ci: fix external provider test (#2438) 2025-06-12 16:14:32 +02:00
inspect.py chore: use starlette built-in Route class (#2267) 2025-05-28 09:53:33 -07:00
library_client.py refactor: unify stream and non-stream impls for responses (#2388) 2025-06-05 17:48:09 +02:00
providers.py feat: drop python 3.10 support (#2469) 2025-06-19 12:07:14 +05:30
request_headers.py feat: fine grained access control policy (#2264) 2025-06-03 14:51:12 -07:00
resolver.py feat: support auth attributes in inference/responses stores (#2389) 2025-06-20 10:24:45 -07:00
stack.py refactor(env)!: enhanced environment variable substitution (#2490) 2025-06-26 08:20:08 +05:30
start_stack.sh refactor: remove container from list of run image types (#2178) 2025-06-02 09:57:55 +02:00