From 92945f4f4d6483bd8b4a5840576e64489ef739c4 Mon Sep 17 00:00:00 2001 From: Charlie Doern Date: Tue, 18 Nov 2025 15:45:30 -0500 Subject: [PATCH] chore: add storage sane defaults since `StackRunConfig` requires certain parts of `StorageConfig`, it'd probably make sense to template in some defaults that will "just work" for most usecases specifically `ServerStoresConfig` defaults for inference, metadata, conversations and prompts, which we already actually funnell in defaults for ad-hoc throughout the codebase additionally set some `backends` defaults for the `StorageConfig`. This will alleviate some weirdness for `--providers` for run/list-deps and also some work I have to better align our list-deps/run datatypes Signed-off-by: Charlie Doern --- src/llama_stack/core/storage/datatypes.py | 27 +++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/llama_stack/core/storage/datatypes.py b/src/llama_stack/core/storage/datatypes.py index 4b17b9ea9..527c1b828 100644 --- a/src/llama_stack/core/storage/datatypes.py +++ b/src/llama_stack/core/storage/datatypes.py @@ -12,6 +12,8 @@ from typing import Annotated, Literal from pydantic import BaseModel, Field, field_validator +from llama_stack.core.utils.config_dirs import DISTRIBS_BASE_DIR + class StorageBackendType(StrEnum): KV_REDIS = "kv_redis" @@ -256,15 +258,24 @@ class ResponsesStoreReference(InferenceStoreReference): class ServerStoresConfig(BaseModel): metadata: KVStoreReference | None = Field( - default=None, + default=KVStoreReference( + backend="kv_default", + namespace="registry", + ), description="Metadata store configuration (uses KV backend)", ) inference: InferenceStoreReference | None = Field( - default=None, + default=InferenceStoreReference( + backend="sql_default", + table_name="inference_store", + ), description="Inference store configuration (uses SQL backend)", ) conversations: SqlStoreReference | None = Field( - default=None, + default=SqlStoreReference( + backend="sql_default", + table_name="openai_conversations", + ), description="Conversations store configuration (uses SQL backend)", ) responses: ResponsesStoreReference | None = Field( @@ -272,13 +283,21 @@ class ServerStoresConfig(BaseModel): description="Responses store configuration (uses SQL backend)", ) prompts: KVStoreReference | None = Field( - default=None, + default=KVStoreReference(backend="kv_default", namespace="prompts"), description="Prompts store configuration (uses KV backend)", ) class StorageConfig(BaseModel): backends: dict[str, StorageBackendConfig] = Field( + default={ + "kv_default": SqliteKVStoreConfig( + db_path=f"${{env.SQLITE_STORE_DIR:={DISTRIBS_BASE_DIR}}}/kvstore.db", + ), + "sql_default": SqliteSqlStoreConfig( + db_path=f"${{env.SQLITE_STORE_DIR:={DISTRIBS_BASE_DIR}}}/sql_store.db", + ), + }, description="Named backend configurations (e.g., 'default', 'cache')", ) stores: ServerStoresConfig = Field(