From 3c43a2f529b9e7b0dcbd9c522a76ab0fe6a00657 Mon Sep 17 00:00:00 2001 From: ehhuang Date: Thu, 3 Jul 2025 10:07:23 -0700 Subject: [PATCH] fix: store configs (#2593) # What does this PR do? https://github.com/meta-llama/llama-stack/pull/2490 broke postgres_demo, as the config expected a str but the value was converted to int. This PR: 1. Updates the type of port in sqlstore to be int 2. template generation uses `dict` instead of `StackRunConfig` so as to avoid failing pydantic typechecks. 3. Adds `replace_env_vars` to StackRunConfig instantiation in `configure.py` (not sure why this wasn't needed before). ## Test Plan `llama stack build --template postgres_demo --image-type conda --run` --- .../providers/agents/inline_meta-reference.md | 1 - .../providers/datasetio/inline_localfs.md | 1 - .../providers/datasetio/remote_huggingface.md | 1 - .../providers/eval/inline_meta-reference.md | 1 - .../providers/vector_io/inline_faiss.md | 1 - .../vector_io/inline_meta-reference.md | 1 - .../providers/vector_io/inline_milvus.md | 1 - llama_stack/distribution/configure.py | 5 +- llama_stack/distribution/store/registry.py | 4 +- llama_stack/providers/utils/kvstore/config.py | 40 +++++++---- .../providers/utils/sqlstore/sqlstore.py | 56 ++++++++++------ llama_stack/templates/bedrock/run.yaml | 5 -- llama_stack/templates/cerebras/run.yaml | 5 -- llama_stack/templates/ci-tests/run.yaml | 4 -- .../templates/dell/run-with-safety.yaml | 4 -- llama_stack/templates/dell/run.yaml | 4 -- .../templates/fireworks/run-with-safety.yaml | 5 -- llama_stack/templates/fireworks/run.yaml | 5 -- llama_stack/templates/groq/run.yaml | 5 -- .../hf-endpoint/run-with-safety.yaml | 5 -- llama_stack/templates/hf-endpoint/run.yaml | 5 -- .../hf-serverless/run-with-safety.yaml | 5 -- llama_stack/templates/hf-serverless/run.yaml | 5 -- llama_stack/templates/llama_api/run.yaml | 4 -- .../meta-reference-gpu/run-with-safety.yaml | 5 -- .../templates/meta-reference-gpu/run.yaml | 5 -- .../templates/nvidia/run-with-safety.yaml | 3 - llama_stack/templates/nvidia/run.yaml | 2 - .../templates/ollama/run-with-safety.yaml | 5 -- llama_stack/templates/ollama/run.yaml | 5 -- llama_stack/templates/open-benchmark/run.yaml | 4 -- .../passthrough/run-with-safety.yaml | 5 -- llama_stack/templates/passthrough/run.yaml | 5 -- .../templates/postgres-demo/postgres_demo.py | 2 +- llama_stack/templates/postgres-demo/run.yaml | 2 +- .../remote-vllm/run-with-safety.yaml | 5 -- llama_stack/templates/remote-vllm/run.yaml | 5 -- llama_stack/templates/sambanova/run.yaml | 2 - llama_stack/templates/starter/run.yaml | 6 -- llama_stack/templates/starter/starter.py | 3 +- llama_stack/templates/template.py | 66 +++++++++++-------- .../templates/tgi/run-with-safety.yaml | 5 -- llama_stack/templates/tgi/run.yaml | 5 -- .../templates/together/run-with-safety.yaml | 5 -- llama_stack/templates/together/run.yaml | 5 -- llama_stack/templates/vllm-gpu/run.yaml | 5 -- llama_stack/templates/watsonx/run.yaml | 5 -- 47 files changed, 110 insertions(+), 223 deletions(-) diff --git a/docs/source/providers/agents/inline_meta-reference.md b/docs/source/providers/agents/inline_meta-reference.md index cfc0c6881..5f64f79e1 100644 --- a/docs/source/providers/agents/inline_meta-reference.md +++ b/docs/source/providers/agents/inline_meta-reference.md @@ -16,7 +16,6 @@ Meta's reference implementation of an agent system that can use tools, access ve ```yaml persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/dummy}/agents_store.db responses_store: type: sqlite diff --git a/docs/source/providers/datasetio/inline_localfs.md b/docs/source/providers/datasetio/inline_localfs.md index fbe4c40e3..87a0c795c 100644 --- a/docs/source/providers/datasetio/inline_localfs.md +++ b/docs/source/providers/datasetio/inline_localfs.md @@ -15,7 +15,6 @@ Local filesystem-based dataset I/O provider for reading and writing datasets to ```yaml kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/dummy}/localfs_datasetio.db ``` diff --git a/docs/source/providers/datasetio/remote_huggingface.md b/docs/source/providers/datasetio/remote_huggingface.md index e2052602e..3711f7396 100644 --- a/docs/source/providers/datasetio/remote_huggingface.md +++ b/docs/source/providers/datasetio/remote_huggingface.md @@ -15,7 +15,6 @@ HuggingFace datasets provider for accessing and managing datasets from the Huggi ```yaml kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/dummy}/huggingface_datasetio.db ``` diff --git a/docs/source/providers/eval/inline_meta-reference.md b/docs/source/providers/eval/inline_meta-reference.md index 704741b5a..606883c72 100644 --- a/docs/source/providers/eval/inline_meta-reference.md +++ b/docs/source/providers/eval/inline_meta-reference.md @@ -15,7 +15,6 @@ Meta's reference implementation of evaluation tasks with support for multiple la ```yaml kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/dummy}/meta_reference_eval.db ``` diff --git a/docs/source/providers/vector_io/inline_faiss.md b/docs/source/providers/vector_io/inline_faiss.md index 2dcf4625b..bcff66f3f 100644 --- a/docs/source/providers/vector_io/inline_faiss.md +++ b/docs/source/providers/vector_io/inline_faiss.md @@ -44,7 +44,6 @@ more details about Faiss in general. ```yaml kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/dummy}/faiss_store.db ``` diff --git a/docs/source/providers/vector_io/inline_meta-reference.md b/docs/source/providers/vector_io/inline_meta-reference.md index c9ca12ff2..0aac445bd 100644 --- a/docs/source/providers/vector_io/inline_meta-reference.md +++ b/docs/source/providers/vector_io/inline_meta-reference.md @@ -15,7 +15,6 @@ Meta's reference implementation of a vector database. ```yaml kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/dummy}/faiss_store.db ``` diff --git a/docs/source/providers/vector_io/inline_milvus.md b/docs/source/providers/vector_io/inline_milvus.md index 8e99d7f95..65c67f3ee 100644 --- a/docs/source/providers/vector_io/inline_milvus.md +++ b/docs/source/providers/vector_io/inline_milvus.md @@ -19,7 +19,6 @@ Please refer to the remote provider documentation. db_path: ${env.MILVUS_DB_PATH:=~/.llama/dummy}/milvus.db kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/dummy}/milvus_registry.db ``` diff --git a/llama_stack/distribution/configure.py b/llama_stack/distribution/configure.py index e58ea0338..35b216b30 100644 --- a/llama_stack/distribution/configure.py +++ b/llama_stack/distribution/configure.py @@ -17,6 +17,7 @@ from llama_stack.distribution.distribution import ( builtin_automatically_routed_apis, get_provider_registry, ) +from llama_stack.distribution.stack import replace_env_vars from llama_stack.distribution.utils.config_dirs import EXTERNAL_PROVIDERS_DIR from llama_stack.distribution.utils.dynamic import instantiate_class_type from llama_stack.distribution.utils.prompt_for_config import prompt_for_config @@ -163,7 +164,7 @@ def upgrade_from_routing_table( def parse_and_maybe_upgrade_config(config_dict: dict[str, Any]) -> StackRunConfig: version = config_dict.get("version", None) if version == LLAMA_STACK_RUN_CONFIG_VERSION: - return StackRunConfig(**config_dict) + return StackRunConfig(**replace_env_vars(config_dict)) if "routing_table" in config_dict: logger.info("Upgrading config...") @@ -174,4 +175,4 @@ def parse_and_maybe_upgrade_config(config_dict: dict[str, Any]) -> StackRunConfi if not config_dict.get("external_providers_dir", None): config_dict["external_providers_dir"] = EXTERNAL_PROVIDERS_DIR - return StackRunConfig(**config_dict) + return StackRunConfig(**replace_env_vars(config_dict)) diff --git a/llama_stack/distribution/store/registry.py b/llama_stack/distribution/store/registry.py index 0e84854c2..cd7cd9f00 100644 --- a/llama_stack/distribution/store/registry.py +++ b/llama_stack/distribution/store/registry.py @@ -10,11 +10,11 @@ from typing import Protocol import pydantic -from llama_stack.distribution.datatypes import KVStoreConfig, RoutableObjectWithProvider +from llama_stack.distribution.datatypes import RoutableObjectWithProvider from llama_stack.distribution.utils.config_dirs import DISTRIBS_BASE_DIR from llama_stack.log import get_logger from llama_stack.providers.utils.kvstore import KVStore, kvstore_impl -from llama_stack.providers.utils.kvstore.config import SqliteKVStoreConfig +from llama_stack.providers.utils.kvstore.config import KVStoreConfig, SqliteKVStoreConfig logger = get_logger(__name__, category="core") diff --git a/llama_stack/providers/utils/kvstore/config.py b/llama_stack/providers/utils/kvstore/config.py index a45ff4ce8..0219bbebe 100644 --- a/llama_stack/providers/utils/kvstore/config.py +++ b/llama_stack/providers/utils/kvstore/config.py @@ -36,15 +36,14 @@ class RedisKVStoreConfig(CommonConfig): def url(self) -> str: return f"redis://{self.host}:{self.port}" - @property - def pip_packages(self) -> list[str]: + @classmethod + def pip_packages(cls) -> list[str]: return ["redis"] @classmethod def sample_run_config(cls): return { "type": "redis", - "namespace": None, "host": "${env.REDIS_HOST:=localhost}", "port": "${env.REDIS_PORT:=6379}", } @@ -57,15 +56,14 @@ class SqliteKVStoreConfig(CommonConfig): description="File path for the sqlite database", ) - @property - def pip_packages(self) -> list[str]: + @classmethod + def pip_packages(cls) -> list[str]: return ["aiosqlite"] @classmethod def sample_run_config(cls, __distro_dir__: str, db_name: str = "kvstore.db"): return { "type": "sqlite", - "namespace": None, "db_path": "${env.SQLITE_STORE_DIR:=" + __distro_dir__ + "}/" + db_name, } @@ -73,7 +71,7 @@ class SqliteKVStoreConfig(CommonConfig): class PostgresKVStoreConfig(CommonConfig): type: Literal[KVStoreType.postgres.value] = KVStoreType.postgres.value host: str = "localhost" - port: str = "5432" + port: int = 5432 db: str = "llamastack" user: str password: str | None = None @@ -83,7 +81,6 @@ class PostgresKVStoreConfig(CommonConfig): def sample_run_config(cls, table_name: str = "llamastack_kvstore", **kwargs): return { "type": "postgres", - "namespace": None, "host": "${env.POSTGRES_HOST:=localhost}", "port": "${env.POSTGRES_PORT:=5432}", "db": "${env.POSTGRES_DB:=llamastack}", @@ -108,8 +105,8 @@ class PostgresKVStoreConfig(CommonConfig): raise ValueError("Table name must be less than 63 characters") return v - @property - def pip_packages(self) -> list[str]: + @classmethod + def pip_packages(cls) -> list[str]: return ["psycopg2-binary"] @@ -122,15 +119,14 @@ class MongoDBKVStoreConfig(CommonConfig): password: str | None = None collection_name: str = "llamastack_kvstore" - @property - def pip_packages(self) -> list[str]: + @classmethod + def pip_packages(cls) -> list[str]: return ["pymongo"] @classmethod def sample_run_config(cls, collection_name: str = "llamastack_kvstore"): return { "type": "mongodb", - "namespace": None, "host": "${env.MONGODB_HOST:=localhost}", "port": "${env.MONGODB_PORT:=5432}", "db": "${env.MONGODB_DB}", @@ -144,3 +140,21 @@ KVStoreConfig = Annotated[ RedisKVStoreConfig | SqliteKVStoreConfig | PostgresKVStoreConfig | MongoDBKVStoreConfig, Field(discriminator="type", default=KVStoreType.sqlite.value), ] + + +def get_pip_packages(store_config: dict | KVStoreConfig) -> list[str]: + """Get pip packages for KV store config, handling both dict and object cases.""" + if isinstance(store_config, dict): + store_type = store_config.get("type") + if store_type == "sqlite": + return SqliteKVStoreConfig.pip_packages() + elif store_type == "postgres": + return PostgresKVStoreConfig.pip_packages() + elif store_type == "redis": + return RedisKVStoreConfig.pip_packages() + elif store_type == "mongodb": + return MongoDBKVStoreConfig.pip_packages() + else: + raise ValueError(f"Unknown KV store type: {store_type}") + else: + return store_config.pip_packages() diff --git a/llama_stack/providers/utils/sqlstore/sqlstore.py b/llama_stack/providers/utils/sqlstore/sqlstore.py index d558a2a26..227c5abcd 100644 --- a/llama_stack/providers/utils/sqlstore/sqlstore.py +++ b/llama_stack/providers/utils/sqlstore/sqlstore.py @@ -30,8 +30,8 @@ class SqlAlchemySqlStoreConfig(BaseModel): def engine_str(self) -> str: ... # TODO: move this when we have a better way to specify dependencies with internal APIs - @property - def pip_packages(self) -> list[str]: + @classmethod + def pip_packages(cls) -> list[str]: return ["sqlalchemy[asyncio]"] @@ -48,20 +48,20 @@ class SqliteSqlStoreConfig(SqlAlchemySqlStoreConfig): @classmethod def sample_run_config(cls, __distro_dir__: str, db_name: str = "sqlstore.db"): - return cls( - type="sqlite", - db_path="${env.SQLITE_STORE_DIR:=" + __distro_dir__ + "}/" + db_name, - ) + return { + "type": "sqlite", + "db_path": "${env.SQLITE_STORE_DIR:=" + __distro_dir__ + "}/" + db_name, + } - @property - def pip_packages(self) -> list[str]: - return super().pip_packages + ["aiosqlite"] + @classmethod + def pip_packages(cls) -> list[str]: + return super().pip_packages() + ["aiosqlite"] class PostgresSqlStoreConfig(SqlAlchemySqlStoreConfig): type: Literal["postgres"] = SqlStoreType.postgres.value host: str = "localhost" - port: str = "5432" + port: int = 5432 db: str = "llamastack" user: str password: str | None = None @@ -70,20 +70,20 @@ class PostgresSqlStoreConfig(SqlAlchemySqlStoreConfig): def engine_str(self) -> str: return f"postgresql+asyncpg://{self.user}:{self.password}@{self.host}:{self.port}/{self.db}" - @property - def pip_packages(self) -> list[str]: - return super().pip_packages + ["asyncpg"] + @classmethod + def pip_packages(cls) -> list[str]: + return super().pip_packages() + ["asyncpg"] @classmethod def sample_run_config(cls, **kwargs): - return cls( - type="postgres", - host="${env.POSTGRES_HOST:=localhost}", - port="${env.POSTGRES_PORT:=5432}", - db="${env.POSTGRES_DB:=llamastack}", - user="${env.POSTGRES_USER:=llamastack}", - password="${env.POSTGRES_PASSWORD:=llamastack}", - ) + return { + "type": "postgres", + "host": "${env.POSTGRES_HOST:=localhost}", + "port": "${env.POSTGRES_PORT:=5432}", + "db": "${env.POSTGRES_DB:=llamastack}", + "user": "${env.POSTGRES_USER:=llamastack}", + "password": "${env.POSTGRES_PASSWORD:=llamastack}", + } SqlStoreConfig = Annotated[ @@ -92,6 +92,20 @@ SqlStoreConfig = Annotated[ ] +def get_pip_packages(store_config: dict | SqlStoreConfig) -> list[str]: + """Get pip packages for SQL store config, handling both dict and object cases.""" + if isinstance(store_config, dict): + store_type = store_config.get("type") + if store_type == "sqlite": + return SqliteSqlStoreConfig.pip_packages() + elif store_type == "postgres": + return PostgresSqlStoreConfig.pip_packages() + else: + raise ValueError(f"Unknown SQL store type: {store_type}") + else: + return store_config.pip_packages() + + def sqlstore_impl(config: SqlStoreConfig) -> SqlStore: if config.type in [SqlStoreType.sqlite.value, SqlStoreType.postgres.value]: from .sqlalchemy_sqlstore import SqlAlchemySqlStoreImpl diff --git a/llama_stack/templates/bedrock/run.yaml b/llama_stack/templates/bedrock/run.yaml index f12c5bec5..068278c66 100644 --- a/llama_stack/templates/bedrock/run.yaml +++ b/llama_stack/templates/bedrock/run.yaml @@ -21,7 +21,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/bedrock}/faiss_store.db safety: - provider_id: bedrock @@ -33,7 +32,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/bedrock}/agents_store.db responses_store: type: sqlite @@ -51,7 +49,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/bedrock}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -59,14 +56,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/bedrock}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/bedrock}/localfs_datasetio.db scoring: - provider_id: basic diff --git a/llama_stack/templates/cerebras/run.yaml b/llama_stack/templates/cerebras/run.yaml index c3877ddce..305e9a20f 100644 --- a/llama_stack/templates/cerebras/run.yaml +++ b/llama_stack/templates/cerebras/run.yaml @@ -31,7 +31,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/cerebras}/faiss_store.db agents: - provider_id: meta-reference @@ -39,7 +38,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/cerebras}/agents_store.db responses_store: type: sqlite @@ -50,7 +48,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/cerebras}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -58,14 +55,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/cerebras}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/cerebras}/localfs_datasetio.db scoring: - provider_id: basic diff --git a/llama_stack/templates/ci-tests/run.yaml b/llama_stack/templates/ci-tests/run.yaml index a38d09324..5a68af3e6 100644 --- a/llama_stack/templates/ci-tests/run.yaml +++ b/llama_stack/templates/ci-tests/run.yaml @@ -36,7 +36,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ci-tests}/agents_store.db responses_store: type: sqlite @@ -54,7 +53,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ci-tests}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -62,14 +60,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ci-tests}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ci-tests}/localfs_datasetio.db scoring: - provider_id: basic diff --git a/llama_stack/templates/dell/run-with-safety.yaml b/llama_stack/templates/dell/run-with-safety.yaml index 48639c772..1e1ef1ea9 100644 --- a/llama_stack/templates/dell/run-with-safety.yaml +++ b/llama_stack/templates/dell/run-with-safety.yaml @@ -39,7 +39,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/agents_store.db responses_store: type: sqlite @@ -57,7 +56,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -65,14 +63,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/localfs_datasetio.db scoring: - provider_id: basic diff --git a/llama_stack/templates/dell/run.yaml b/llama_stack/templates/dell/run.yaml index 13d43530b..6f5c56dd3 100644 --- a/llama_stack/templates/dell/run.yaml +++ b/llama_stack/templates/dell/run.yaml @@ -35,7 +35,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/agents_store.db responses_store: type: sqlite @@ -53,7 +52,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -61,14 +59,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/localfs_datasetio.db scoring: - provider_id: basic diff --git a/llama_stack/templates/fireworks/run-with-safety.yaml b/llama_stack/templates/fireworks/run-with-safety.yaml index ecb53a18d..1233e2271 100644 --- a/llama_stack/templates/fireworks/run-with-safety.yaml +++ b/llama_stack/templates/fireworks/run-with-safety.yaml @@ -27,7 +27,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/fireworks}/faiss_store.db safety: - provider_id: llama-guard @@ -45,7 +44,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/fireworks}/agents_store.db responses_store: type: sqlite @@ -63,7 +61,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/fireworks}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -71,14 +68,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/fireworks}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/fireworks}/localfs_datasetio.db scoring: - provider_id: basic diff --git a/llama_stack/templates/fireworks/run.yaml b/llama_stack/templates/fireworks/run.yaml index 298d28d52..7f0bc49f5 100644 --- a/llama_stack/templates/fireworks/run.yaml +++ b/llama_stack/templates/fireworks/run.yaml @@ -27,7 +27,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/fireworks}/faiss_store.db safety: - provider_id: llama-guard @@ -40,7 +39,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/fireworks}/agents_store.db responses_store: type: sqlite @@ -58,7 +56,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/fireworks}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -66,14 +63,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/fireworks}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/fireworks}/localfs_datasetio.db scoring: - provider_id: basic diff --git a/llama_stack/templates/groq/run.yaml b/llama_stack/templates/groq/run.yaml index 13bb65ed2..351ca74f7 100644 --- a/llama_stack/templates/groq/run.yaml +++ b/llama_stack/templates/groq/run.yaml @@ -26,7 +26,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/groq}/faiss_store.db safety: - provider_id: llama-guard @@ -39,7 +38,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/groq}/agents_store.db responses_store: type: sqlite @@ -57,7 +55,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/groq}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -65,14 +62,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/groq}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/groq}/localfs_datasetio.db scoring: - provider_id: basic diff --git a/llama_stack/templates/hf-endpoint/run-with-safety.yaml b/llama_stack/templates/hf-endpoint/run-with-safety.yaml index b2bc6a8e9..63063ad91 100644 --- a/llama_stack/templates/hf-endpoint/run-with-safety.yaml +++ b/llama_stack/templates/hf-endpoint/run-with-safety.yaml @@ -31,7 +31,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/hf-endpoint}/faiss_store.db safety: - provider_id: llama-guard @@ -44,7 +43,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/hf-endpoint}/agents_store.db responses_store: type: sqlite @@ -62,7 +60,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/hf-endpoint}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -70,14 +67,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/hf-endpoint}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/hf-endpoint}/localfs_datasetio.db scoring: - provider_id: basic diff --git a/llama_stack/templates/hf-endpoint/run.yaml b/llama_stack/templates/hf-endpoint/run.yaml index d62921ccc..4caf0db04 100644 --- a/llama_stack/templates/hf-endpoint/run.yaml +++ b/llama_stack/templates/hf-endpoint/run.yaml @@ -26,7 +26,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/hf-endpoint}/faiss_store.db safety: - provider_id: llama-guard @@ -39,7 +38,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/hf-endpoint}/agents_store.db responses_store: type: sqlite @@ -57,7 +55,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/hf-endpoint}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -65,14 +62,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/hf-endpoint}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/hf-endpoint}/localfs_datasetio.db scoring: - provider_id: basic diff --git a/llama_stack/templates/hf-serverless/run-with-safety.yaml b/llama_stack/templates/hf-serverless/run-with-safety.yaml index d7ff4f446..a4bba1f76 100644 --- a/llama_stack/templates/hf-serverless/run-with-safety.yaml +++ b/llama_stack/templates/hf-serverless/run-with-safety.yaml @@ -31,7 +31,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/hf-serverless}/faiss_store.db safety: - provider_id: llama-guard @@ -44,7 +43,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/hf-serverless}/agents_store.db responses_store: type: sqlite @@ -62,7 +60,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/hf-serverless}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -70,14 +67,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/hf-serverless}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/hf-serverless}/localfs_datasetio.db scoring: - provider_id: basic diff --git a/llama_stack/templates/hf-serverless/run.yaml b/llama_stack/templates/hf-serverless/run.yaml index 19484cba6..23e4c1f28 100644 --- a/llama_stack/templates/hf-serverless/run.yaml +++ b/llama_stack/templates/hf-serverless/run.yaml @@ -26,7 +26,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/hf-serverless}/faiss_store.db safety: - provider_id: llama-guard @@ -39,7 +38,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/hf-serverless}/agents_store.db responses_store: type: sqlite @@ -57,7 +55,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/hf-serverless}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -65,14 +62,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/hf-serverless}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/hf-serverless}/localfs_datasetio.db scoring: - provider_id: basic diff --git a/llama_stack/templates/llama_api/run.yaml b/llama_stack/templates/llama_api/run.yaml index 3bfb284a3..77bbcfbc8 100644 --- a/llama_stack/templates/llama_api/run.yaml +++ b/llama_stack/templates/llama_api/run.yaml @@ -48,7 +48,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/llama_api}/agents_store.db responses_store: type: sqlite @@ -66,7 +65,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/llama_api}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -74,14 +72,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/llama_api}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/llama_api}/localfs_datasetio.db scoring: - provider_id: basic diff --git a/llama_stack/templates/meta-reference-gpu/run-with-safety.yaml b/llama_stack/templates/meta-reference-gpu/run-with-safety.yaml index 46b3a33a6..2f5ee4062 100644 --- a/llama_stack/templates/meta-reference-gpu/run-with-safety.yaml +++ b/llama_stack/templates/meta-reference-gpu/run-with-safety.yaml @@ -41,7 +41,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/faiss_store.db safety: - provider_id: llama-guard @@ -54,7 +53,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/agents_store.db responses_store: type: sqlite @@ -72,7 +70,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -80,14 +77,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/localfs_datasetio.db scoring: - provider_id: basic diff --git a/llama_stack/templates/meta-reference-gpu/run.yaml b/llama_stack/templates/meta-reference-gpu/run.yaml index 033ec245a..cc119bf4d 100644 --- a/llama_stack/templates/meta-reference-gpu/run.yaml +++ b/llama_stack/templates/meta-reference-gpu/run.yaml @@ -31,7 +31,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/faiss_store.db safety: - provider_id: llama-guard @@ -44,7 +43,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/agents_store.db responses_store: type: sqlite @@ -62,7 +60,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -70,14 +67,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/localfs_datasetio.db scoring: - provider_id: basic diff --git a/llama_stack/templates/nvidia/run-with-safety.yaml b/llama_stack/templates/nvidia/run-with-safety.yaml index 73783be98..7dcfd196d 100644 --- a/llama_stack/templates/nvidia/run-with-safety.yaml +++ b/llama_stack/templates/nvidia/run-with-safety.yaml @@ -30,7 +30,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/nvidia}/faiss_store.db safety: - provider_id: nvidia @@ -44,7 +43,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/nvidia}/agents_store.db responses_store: type: sqlite @@ -75,7 +73,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/nvidia}/localfs_datasetio.db - provider_id: nvidia provider_type: remote::nvidia diff --git a/llama_stack/templates/nvidia/run.yaml b/llama_stack/templates/nvidia/run.yaml index af9d5904a..f69270fb5 100644 --- a/llama_stack/templates/nvidia/run.yaml +++ b/llama_stack/templates/nvidia/run.yaml @@ -25,7 +25,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/nvidia}/faiss_store.db safety: - provider_id: nvidia @@ -39,7 +38,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/nvidia}/agents_store.db responses_store: type: sqlite diff --git a/llama_stack/templates/ollama/run-with-safety.yaml b/llama_stack/templates/ollama/run-with-safety.yaml index bad51de09..98db5fc98 100644 --- a/llama_stack/templates/ollama/run-with-safety.yaml +++ b/llama_stack/templates/ollama/run-with-safety.yaml @@ -25,7 +25,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ollama}/faiss_store.db safety: - provider_id: llama-guard @@ -40,7 +39,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ollama}/agents_store.db responses_store: type: sqlite @@ -58,7 +56,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ollama}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -66,14 +63,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ollama}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ollama}/localfs_datasetio.db scoring: - provider_id: basic diff --git a/llama_stack/templates/ollama/run.yaml b/llama_stack/templates/ollama/run.yaml index e1dea730e..38fb2bace 100644 --- a/llama_stack/templates/ollama/run.yaml +++ b/llama_stack/templates/ollama/run.yaml @@ -25,7 +25,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ollama}/faiss_store.db safety: - provider_id: llama-guard @@ -38,7 +37,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ollama}/agents_store.db responses_store: type: sqlite @@ -56,7 +54,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ollama}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -64,14 +61,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ollama}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ollama}/localfs_datasetio.db scoring: - provider_id: basic diff --git a/llama_stack/templates/open-benchmark/run.yaml b/llama_stack/templates/open-benchmark/run.yaml index 57ae6b9be..7b1ef8f10 100644 --- a/llama_stack/templates/open-benchmark/run.yaml +++ b/llama_stack/templates/open-benchmark/run.yaml @@ -62,7 +62,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/open-benchmark}/agents_store.db responses_store: type: sqlite @@ -80,7 +79,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/open-benchmark}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -88,14 +86,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/open-benchmark}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/open-benchmark}/localfs_datasetio.db scoring: - provider_id: basic diff --git a/llama_stack/templates/passthrough/run-with-safety.yaml b/llama_stack/templates/passthrough/run-with-safety.yaml index 7a30f665c..5cd8a2930 100644 --- a/llama_stack/templates/passthrough/run-with-safety.yaml +++ b/llama_stack/templates/passthrough/run-with-safety.yaml @@ -26,7 +26,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/passthrough}/faiss_store.db safety: - provider_id: llama-guard @@ -44,7 +43,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/passthrough}/agents_store.db responses_store: type: sqlite @@ -62,7 +60,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/passthrough}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -70,14 +67,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/passthrough}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/passthrough}/localfs_datasetio.db scoring: - provider_id: basic diff --git a/llama_stack/templates/passthrough/run.yaml b/llama_stack/templates/passthrough/run.yaml index dc751ea20..5b6078953 100644 --- a/llama_stack/templates/passthrough/run.yaml +++ b/llama_stack/templates/passthrough/run.yaml @@ -26,7 +26,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/passthrough}/faiss_store.db safety: - provider_id: llama-guard @@ -39,7 +38,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/passthrough}/agents_store.db responses_store: type: sqlite @@ -57,7 +55,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/passthrough}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -65,14 +62,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/passthrough}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/passthrough}/localfs_datasetio.db scoring: - provider_id: basic diff --git a/llama_stack/templates/postgres-demo/postgres_demo.py b/llama_stack/templates/postgres-demo/postgres_demo.py index 67ad35db7..ed69c22db 100644 --- a/llama_stack/templates/postgres-demo/postgres_demo.py +++ b/llama_stack/templates/postgres-demo/postgres_demo.py @@ -114,7 +114,7 @@ def get_distribution_template() -> DistributionTemplate: provider_id="meta-reference", provider_type="inline::meta-reference", config=dict( - service_name="${env.OTEL_SERVICE_NAME:=}", + service_name="${env.OTEL_SERVICE_NAME:=\u200b}", sinks="${env.TELEMETRY_SINKS:=console,otel_trace}", otel_trace_endpoint="${env.OTEL_TRACE_ENDPOINT:=http://localhost:4318/v1/traces}", ), diff --git a/llama_stack/templates/postgres-demo/run.yaml b/llama_stack/templates/postgres-demo/run.yaml index dd20cc6ac..2b6b1a64f 100644 --- a/llama_stack/templates/postgres-demo/run.yaml +++ b/llama_stack/templates/postgres-demo/run.yaml @@ -51,7 +51,7 @@ providers: - provider_id: meta-reference provider_type: inline::meta-reference config: - service_name: ${env.OTEL_SERVICE_NAME:=} + service_name: "${env.OTEL_SERVICE_NAME:=\u200B}" sinks: ${env.TELEMETRY_SINKS:=console,otel_trace} otel_trace_endpoint: ${env.OTEL_TRACE_ENDPOINT:=http://localhost:4318/v1/traces} tool_runtime: diff --git a/llama_stack/templates/remote-vllm/run-with-safety.yaml b/llama_stack/templates/remote-vllm/run-with-safety.yaml index 78fb22d38..a8d30904d 100644 --- a/llama_stack/templates/remote-vllm/run-with-safety.yaml +++ b/llama_stack/templates/remote-vllm/run-with-safety.yaml @@ -35,7 +35,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/remote-vllm}/faiss_store.db safety: - provider_id: llama-guard @@ -48,7 +47,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/remote-vllm}/agents_store.db responses_store: type: sqlite @@ -59,7 +57,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/remote-vllm}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -67,14 +64,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/remote-vllm}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/remote-vllm}/localfs_datasetio.db scoring: - provider_id: basic diff --git a/llama_stack/templates/remote-vllm/run.yaml b/llama_stack/templates/remote-vllm/run.yaml index 1cc4596f3..58c4f867d 100644 --- a/llama_stack/templates/remote-vllm/run.yaml +++ b/llama_stack/templates/remote-vllm/run.yaml @@ -28,7 +28,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/remote-vllm}/faiss_store.db safety: - provider_id: llama-guard @@ -41,7 +40,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/remote-vllm}/agents_store.db responses_store: type: sqlite @@ -52,7 +50,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/remote-vllm}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -60,14 +57,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/remote-vllm}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/remote-vllm}/localfs_datasetio.db scoring: - provider_id: basic diff --git a/llama_stack/templates/sambanova/run.yaml b/llama_stack/templates/sambanova/run.yaml index 6163a58b3..ab6c70ae0 100644 --- a/llama_stack/templates/sambanova/run.yaml +++ b/llama_stack/templates/sambanova/run.yaml @@ -23,7 +23,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/sambanova}/faiss_store.db - provider_id: ${env.ENABLE_CHROMADB:+chromadb} provider_type: remote::chromadb @@ -49,7 +48,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/sambanova}/agents_store.db responses_store: type: sqlite diff --git a/llama_stack/templates/starter/run.yaml b/llama_stack/templates/starter/run.yaml index 190030690..de8d35683 100644 --- a/llama_stack/templates/starter/run.yaml +++ b/llama_stack/templates/starter/run.yaml @@ -66,7 +66,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter}/faiss_store.db - provider_id: ${env.ENABLE_SQLITE_VEC:+sqlite-vec} provider_type: inline::sqlite-vec @@ -78,7 +77,6 @@ providers: db_path: ${env.MILVUS_DB_PATH:=~/.llama/distributions/starter}/milvus.db kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter}/milvus_registry.db - provider_id: ${env.ENABLE_CHROMADB:+chromadb} provider_type: remote::chromadb @@ -111,7 +109,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter}/agents_store.db responses_store: type: sqlite @@ -129,7 +126,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -137,14 +133,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter}/localfs_datasetio.db scoring: - provider_id: basic diff --git a/llama_stack/templates/starter/starter.py b/llama_stack/templates/starter/starter.py index 7914d4298..2a982bb62 100644 --- a/llama_stack/templates/starter/starter.py +++ b/llama_stack/templates/starter/starter.py @@ -234,7 +234,6 @@ def get_distribution_template() -> DistributionTemplate: default_models = get_model_registry(available_models) - postgres_store = PostgresSqlStoreConfig.sample_run_config() return DistributionTemplate( name=name, distro_type="self_hosted", @@ -243,7 +242,7 @@ def get_distribution_template() -> DistributionTemplate: template_path=None, providers=providers, available_models_by_provider=available_models, - additional_pip_packages=postgres_store.pip_packages, + additional_pip_packages=PostgresSqlStoreConfig.pip_packages(), run_configs={ "run.yaml": RunConfigSettings( provider_overrides={ diff --git a/llama_stack/templates/template.py b/llama_stack/templates/template.py index 7badff140..dceb13c8b 100644 --- a/llama_stack/templates/template.py +++ b/llama_stack/templates/template.py @@ -15,6 +15,7 @@ from pydantic import BaseModel, Field from llama_stack.apis.datasets import DatasetPurpose from llama_stack.apis.models import ModelType from llama_stack.distribution.datatypes import ( + LLAMA_STACK_RUN_CONFIG_VERSION, Api, BenchmarkInput, BuildConfig, @@ -23,14 +24,15 @@ from llama_stack.distribution.datatypes import ( ModelInput, Provider, ShieldInput, - StackRunConfig, ToolGroupInput, ) from llama_stack.distribution.distribution import get_provider_registry from llama_stack.distribution.utils.dynamic import instantiate_class_type from llama_stack.providers.utils.inference.model_registry import ProviderModelEntry -from llama_stack.providers.utils.kvstore.config import KVStoreConfig, SqliteKVStoreConfig -from llama_stack.providers.utils.sqlstore.sqlstore import SqliteSqlStoreConfig, SqlStoreConfig +from llama_stack.providers.utils.kvstore.config import SqliteKVStoreConfig +from llama_stack.providers.utils.kvstore.config import get_pip_packages as get_kv_pip_packages +from llama_stack.providers.utils.sqlstore.sqlstore import SqliteSqlStoreConfig +from llama_stack.providers.utils.sqlstore.sqlstore import get_pip_packages as get_sql_pip_packages def get_model_registry( @@ -87,21 +89,24 @@ class RunConfigSettings(BaseModel): default_tool_groups: list[ToolGroupInput] | None = None default_datasets: list[DatasetInput] | None = None default_benchmarks: list[BenchmarkInput] | None = None - metadata_store: KVStoreConfig | None = None - inference_store: SqlStoreConfig | None = None + metadata_store: dict | None = None + inference_store: dict | None = None def run_config( self, name: str, providers: dict[str, list[str]], container_image: str | None = None, - ) -> StackRunConfig: + ) -> dict: provider_registry = get_provider_registry() provider_configs = {} for api_str, provider_types in providers.items(): if api_providers := self.provider_overrides.get(api_str): - provider_configs[api_str] = api_providers + # Convert Provider objects to dicts for YAML serialization + provider_configs[api_str] = [ + p.model_dump(exclude_none=True) if isinstance(p, Provider) else p for p in api_providers + ] continue provider_configs[api_str] = [] @@ -128,33 +133,40 @@ class RunConfigSettings(BaseModel): provider_id=provider_id, provider_type=provider_type, config=config, - ) + ).model_dump(exclude_none=True) ) # Get unique set of APIs from providers apis = sorted(providers.keys()) - return StackRunConfig( - image_name=name, - container_image=container_image, - apis=apis, - providers=provider_configs, - metadata_store=self.metadata_store + # Return a dict that matches StackRunConfig structure + return { + "version": LLAMA_STACK_RUN_CONFIG_VERSION, + "image_name": name, + "container_image": container_image, + "apis": apis, + "providers": provider_configs, + "metadata_store": self.metadata_store or SqliteKVStoreConfig.sample_run_config( __distro_dir__=f"~/.llama/distributions/{name}", db_name="registry.db", ), - inference_store=self.inference_store + "inference_store": self.inference_store or SqliteSqlStoreConfig.sample_run_config( __distro_dir__=f"~/.llama/distributions/{name}", db_name="inference_store.db", ), - models=self.default_models or [], - shields=self.default_shields or [], - tool_groups=self.default_tool_groups or [], - datasets=self.default_datasets or [], - benchmarks=self.default_benchmarks or [], - ) + "models": [m.model_dump(exclude_none=True) for m in (self.default_models or [])], + "shields": [s.model_dump(exclude_none=True) for s in (self.default_shields or [])], + "vector_dbs": [], + "datasets": [d.model_dump(exclude_none=True) for d in (self.default_datasets or [])], + "scoring_fns": [], + "benchmarks": [b.model_dump(exclude_none=True) for b in (self.default_benchmarks or [])], + "tool_groups": [t.model_dump(exclude_none=True) for t in (self.default_tool_groups or [])], + "server": { + "port": 8321, + }, + } class DistributionTemplate(BaseModel): @@ -190,10 +202,12 @@ class DistributionTemplate(BaseModel): # TODO: This is a hack to get the dependencies for internal APIs into build # We should have a better way to do this by formalizing the concept of "internal" APIs # and providers, with a way to specify dependencies for them. - if run_config_.inference_store: - additional_pip_packages.extend(run_config_.inference_store.pip_packages) - if run_config_.metadata_store: - additional_pip_packages.extend(run_config_.metadata_store.pip_packages) + + if run_config_.get("inference_store"): + additional_pip_packages.extend(get_sql_pip_packages(run_config_["inference_store"])) + + if run_config_.get("metadata_store"): + additional_pip_packages.extend(get_kv_pip_packages(run_config_["metadata_store"])) if self.additional_pip_packages: additional_pip_packages.extend(self.additional_pip_packages) @@ -286,7 +300,7 @@ class DistributionTemplate(BaseModel): run_config = settings.run_config(self.name, self.providers, self.container_image) with open(yaml_output_dir / yaml_pth, "w") as f: yaml.safe_dump( - run_config.model_dump(exclude_none=True), + {k: v for k, v in run_config.items() if v is not None}, f, sort_keys=False, ) diff --git a/llama_stack/templates/tgi/run-with-safety.yaml b/llama_stack/templates/tgi/run-with-safety.yaml index c4f9ae7ef..c19b916d5 100644 --- a/llama_stack/templates/tgi/run-with-safety.yaml +++ b/llama_stack/templates/tgi/run-with-safety.yaml @@ -26,7 +26,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/tgi}/faiss_store.db safety: - provider_id: llama-guard @@ -39,7 +38,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/tgi}/agents_store.db responses_store: type: sqlite @@ -57,7 +55,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/tgi}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -65,14 +62,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/tgi}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/tgi}/localfs_datasetio.db scoring: - provider_id: basic diff --git a/llama_stack/templates/tgi/run.yaml b/llama_stack/templates/tgi/run.yaml index 70e5872b3..f0197d74c 100644 --- a/llama_stack/templates/tgi/run.yaml +++ b/llama_stack/templates/tgi/run.yaml @@ -25,7 +25,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/tgi}/faiss_store.db safety: - provider_id: llama-guard @@ -38,7 +37,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/tgi}/agents_store.db responses_store: type: sqlite @@ -56,7 +54,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/tgi}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -64,14 +61,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/tgi}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/tgi}/localfs_datasetio.db scoring: - provider_id: basic diff --git a/llama_stack/templates/together/run-with-safety.yaml b/llama_stack/templates/together/run-with-safety.yaml index 14f423855..b32c9ee8d 100644 --- a/llama_stack/templates/together/run-with-safety.yaml +++ b/llama_stack/templates/together/run-with-safety.yaml @@ -26,7 +26,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/together}/faiss_store.db safety: - provider_id: llama-guard @@ -44,7 +43,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/together}/agents_store.db responses_store: type: sqlite @@ -62,7 +60,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/together}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -70,14 +67,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/together}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/together}/localfs_datasetio.db scoring: - provider_id: basic diff --git a/llama_stack/templates/together/run.yaml b/llama_stack/templates/together/run.yaml index 38f1922c0..22c99f6cf 100644 --- a/llama_stack/templates/together/run.yaml +++ b/llama_stack/templates/together/run.yaml @@ -26,7 +26,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/together}/faiss_store.db safety: - provider_id: llama-guard @@ -39,7 +38,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/together}/agents_store.db responses_store: type: sqlite @@ -57,7 +55,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/together}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -65,14 +62,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/together}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/together}/localfs_datasetio.db scoring: - provider_id: basic diff --git a/llama_stack/templates/vllm-gpu/run.yaml b/llama_stack/templates/vllm-gpu/run.yaml index 6854ad05c..6d122e180 100644 --- a/llama_stack/templates/vllm-gpu/run.yaml +++ b/llama_stack/templates/vllm-gpu/run.yaml @@ -30,7 +30,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/vllm-gpu}/faiss_store.db safety: - provider_id: llama-guard @@ -43,7 +42,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/vllm-gpu}/agents_store.db responses_store: type: sqlite @@ -61,7 +59,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/vllm-gpu}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -69,14 +66,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/vllm-gpu}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/vllm-gpu}/localfs_datasetio.db scoring: - provider_id: basic diff --git a/llama_stack/templates/watsonx/run.yaml b/llama_stack/templates/watsonx/run.yaml index 8b8fc09c4..d80ee6329 100644 --- a/llama_stack/templates/watsonx/run.yaml +++ b/llama_stack/templates/watsonx/run.yaml @@ -27,7 +27,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/watsonx}/faiss_store.db safety: - provider_id: llama-guard @@ -40,7 +39,6 @@ providers: config: persistence_store: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/watsonx}/agents_store.db responses_store: type: sqlite @@ -58,7 +56,6 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/watsonx}/meta_reference_eval.db datasetio: - provider_id: huggingface @@ -66,14 +63,12 @@ providers: config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/watsonx}/huggingface_datasetio.db - provider_id: localfs provider_type: inline::localfs config: kvstore: type: sqlite - namespace: null db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/watsonx}/localfs_datasetio.db scoring: - provider_id: basic