llama-stack/llama_stack/distribution
Ashwin Bharambe 6609d4ada4
feat: allow conditionally enabling providers in run.yaml (#1321)
# What does this PR do?

We want to bundle a bunch of (typically remote) providers in a distro
template and be able to configure them "on the fly" via environment
variables. So far, we have been able to do this with simple env var
replacements. However, sometimes you want to only conditionally enable
providers (because the relevant remote services may not be alive, or
relevant.) This was not possible until now.

To aid this, we add a simple (bash-like) env var replacement
enhancement: `${env.FOO+bar}` evaluates to `bar` if the variable is SET
and evaluates to empty string if it is not. On top of that, we update
our main resolver to ignore any provider whose ID is null.

This allows using the distro like this:

```bash
llama stack run dev --env CHROMADB_URL=http://localhost:6001 --env ENABLE_CHROMADB=1
```

when only Chroma is UP. This disables the other `pgvector` provider in
the run configuration.


## Test Plan

Hard code `chromadb` as the vector io provider inside
`test_vector_io.py` and run:

```bash
LLAMA_STACK_BASE_URL=http://localhost:8321 pytest -s -v tests/client-sdk/vector_io/ --embedding-model all-MiniLM-L6-v2
```
2025-03-01 11:19:14 -08:00
..
routers fix: don't update tool_config inplace (#1338) 2025-03-01 10:40:00 -08:00
server refactor(server): replace print statements with logger (#1250) 2025-02-25 21:31:37 -08:00
store fix: bump up registry key version to clear off stale entries in dbs 2025-02-26 13:58:18 -08:00
ui chore(lint): update Ruff ignores for project conventions and maintainability (#1184) 2025-02-28 09:36:49 -08:00
utils fix: check conda env name using basepath in exec.py (#1301) 2025-02-27 23:07:23 -08:00
__init__.py API Updates (#73) 2024-09-17 19:51:35 -07:00
build.py build(container): misc improvements (#1291) 2025-02-28 10:01:52 -08:00
build_conda_env.sh chore: update cmd check (#1293) 2025-02-28 10:08:05 -08:00
build_container.sh fix: only install llama-stack package, deps are now correctly incorporated 2025-02-28 16:12:11 -08:00
build_venv.sh fix: build_venv expects an extra argument (#1233) 2025-02-25 11:08:50 -08:00
client.py chore: move all Llama Stack types from llama-models to llama-stack (#1098) 2025-02-14 09:10:59 -08:00
common.sh fix: Fixing some small issues with the build scripts (#1132) 2025-02-19 22:20:49 -08:00
configure.py build: format codebase imports using ruff linter (#1028) 2025-02-13 10:06:21 -08:00
configure_container.sh More generic image type for OCI-compliant container technologies (#802) 2025-01-17 16:37:42 -08:00
datatypes.py fix!: update eval-tasks -> benchmarks (#1032) 2025-02-13 16:40:58 -08:00
distribution.py chore(lint): update Ruff ignores for project conventions and maintainability (#1184) 2025-02-28 09:36:49 -08:00
inspect.py fix: improve signal handling and update dependencies (#1044) 2025-02-13 08:07:59 -08:00
library_client.py fix: raise error when request param failed to convert (#1339) 2025-03-01 10:39:05 -08:00
request_headers.py Add X-LlamaStack-Client-Version, rename ProviderData -> Provider-Data (#735) 2025-01-09 11:51:36 -08:00
resolver.py feat: allow conditionally enabling providers in run.yaml (#1321) 2025-03-01 11:19:14 -08:00
stack.py feat: allow conditionally enabling providers in run.yaml (#1321) 2025-03-01 11:19:14 -08:00
start_stack.sh chore: add container cmd check in start_stack.sh (#1340) 2025-03-01 10:39:32 -08:00
start_venv.sh fix: update virtualenv building so llamastack- prefix is not added, make notebook experience easier (#1225) 2025-02-23 16:57:11 -08:00