This commit is contained in:
Ashwin Bharambe 2025-10-16 17:12:09 -07:00
parent ea9664874d
commit af7472cdb0
26 changed files with 293 additions and 185 deletions

View file

@ -45,7 +45,6 @@ from llama_stack.core.utils.dynamic import instantiate_class_type
from llama_stack.core.utils.exec import formulate_run_args, run_command
from llama_stack.core.utils.image_types import LlamaStackImageType
from llama_stack.providers.datatypes import Api
from llama_stack.providers.utils.sqlstore.sqlstore import SqliteSqlStoreConfig
DISTRIBS_PATH = Path(__file__).parent.parent.parent / "distributions"

View file

@ -52,6 +52,5 @@ distribution_spec:
- provider_type: inline::reference
image_type: venv
additional_pip_packages:
- aiosqlite
- asyncpg
- sqlalchemy[asyncio]

View file

@ -198,15 +198,25 @@ providers:
config:
kvstore:
namespace: batches
metadata_store:
storage:
backends:
default_kv_store:
type: kv_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ci-tests}/registry.db
inference_store:
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ci-tests}/kvstore.db
default_sql_store:
type: sql_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ci-tests}/inference_store.db
conversations_store:
type: sql_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ci-tests}/conversations.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ci-tests}/sql_store.db
metadata:
namespace: registry
backend: default_kv_store
inference:
table_name: inference_store
backend: default_sql_store
max_write_queue_size: 10000
num_writers: 4
conversations:
table_name: openai_conversations
backend: default_sql_store
models: []
shields:
- shield_id: llama-guard

View file

@ -28,6 +28,4 @@ distribution_spec:
- provider_type: remote::tavily-search
- provider_type: inline::rag-runtime
image_type: venv
additional_pip_packages:
- aiosqlite
- sqlalchemy[asyncio]
additional_pip_packages: []

View file

@ -81,15 +81,25 @@ providers:
max_results: 3
- provider_id: rag-runtime
provider_type: inline::rag-runtime
metadata_store:
storage:
backends:
default_kv_store:
type: kv_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/registry.db
inference_store:
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/kvstore.db
default_sql_store:
type: sql_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/inference_store.db
conversations_store:
type: sql_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/conversations.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/sql_store.db
metadata:
namespace: registry
backend: default_kv_store
inference:
table_name: inference_store
backend: default_sql_store
max_write_queue_size: 10000
num_writers: 4
conversations:
table_name: openai_conversations
backend: default_sql_store
models:
- metadata: {}
model_id: ${env.INFERENCE_MODEL}

View file

@ -77,15 +77,25 @@ providers:
max_results: 3
- provider_id: rag-runtime
provider_type: inline::rag-runtime
metadata_store:
storage:
backends:
default_kv_store:
type: kv_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/registry.db
inference_store:
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/kvstore.db
default_sql_store:
type: sql_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/inference_store.db
conversations_store:
type: sql_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/conversations.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/sql_store.db
metadata:
namespace: registry
backend: default_kv_store
inference:
table_name: inference_store
backend: default_sql_store
max_write_queue_size: 10000
num_writers: 4
conversations:
table_name: openai_conversations
backend: default_sql_store
models:
- metadata: {}
model_id: ${env.INFERENCE_MODEL}

View file

@ -27,6 +27,4 @@ distribution_spec:
- provider_type: inline::rag-runtime
- provider_type: remote::model-context-protocol
image_type: venv
additional_pip_packages:
- aiosqlite
- sqlalchemy[asyncio]
additional_pip_packages: []

View file

@ -94,15 +94,25 @@ providers:
provider_type: inline::rag-runtime
- provider_id: model-context-protocol
provider_type: remote::model-context-protocol
metadata_store:
storage:
backends:
default_kv_store:
type: kv_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/registry.db
inference_store:
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/kvstore.db
default_sql_store:
type: sql_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/inference_store.db
conversations_store:
type: sql_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/conversations.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/sql_store.db
metadata:
namespace: registry
backend: default_kv_store
inference:
table_name: inference_store
backend: default_sql_store
max_write_queue_size: 10000
num_writers: 4
conversations:
table_name: openai_conversations
backend: default_sql_store
models:
- metadata: {}
model_id: ${env.INFERENCE_MODEL}

View file

@ -84,15 +84,25 @@ providers:
provider_type: inline::rag-runtime
- provider_id: model-context-protocol
provider_type: remote::model-context-protocol
metadata_store:
storage:
backends:
default_kv_store:
type: kv_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/registry.db
inference_store:
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/kvstore.db
default_sql_store:
type: sql_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/inference_store.db
conversations_store:
type: sql_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/conversations.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/sql_store.db
metadata:
namespace: registry
backend: default_kv_store
inference:
table_name: inference_store
backend: default_sql_store
max_write_queue_size: 10000
num_writers: 4
conversations:
table_name: openai_conversations
backend: default_sql_store
models:
- metadata: {}
model_id: ${env.INFERENCE_MODEL}

View file

@ -24,6 +24,4 @@ distribution_spec:
files:
- provider_type: inline::localfs
image_type: venv
additional_pip_packages:
- aiosqlite
- sqlalchemy[asyncio]
additional_pip_packages: []

View file

@ -84,15 +84,25 @@ providers:
storage_dir: ${env.FILES_STORAGE_DIR:=~/.llama/distributions/nvidia/files}
metadata_store:
table_name: files_metadata
metadata_store:
storage:
backends:
default_kv_store:
type: kv_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/nvidia}/registry.db
inference_store:
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/nvidia}/kvstore.db
default_sql_store:
type: sql_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/nvidia}/inference_store.db
conversations_store:
type: sql_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/nvidia}/conversations.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/nvidia}/sql_store.db
metadata:
namespace: registry
backend: default_kv_store
inference:
table_name: inference_store
backend: default_sql_store
max_write_queue_size: 10000
num_writers: 4
conversations:
table_name: openai_conversations
backend: default_sql_store
models:
- metadata: {}
model_id: ${env.INFERENCE_MODEL}

View file

@ -74,15 +74,25 @@ providers:
storage_dir: ${env.FILES_STORAGE_DIR:=~/.llama/distributions/nvidia/files}
metadata_store:
table_name: files_metadata
metadata_store:
storage:
backends:
default_kv_store:
type: kv_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/nvidia}/registry.db
inference_store:
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/nvidia}/kvstore.db
default_sql_store:
type: sql_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/nvidia}/inference_store.db
conversations_store:
type: sql_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/nvidia}/conversations.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/nvidia}/sql_store.db
metadata:
namespace: registry
backend: default_kv_store
inference:
table_name: inference_store
backend: default_sql_store
max_write_queue_size: 10000
num_writers: 4
conversations:
table_name: openai_conversations
backend: default_sql_store
models: []
shields: []
vector_dbs: []

View file

@ -31,6 +31,4 @@ distribution_spec:
- provider_type: inline::rag-runtime
- provider_type: remote::model-context-protocol
image_type: venv
additional_pip_packages:
- aiosqlite
- sqlalchemy[asyncio]
additional_pip_packages: []

View file

@ -112,15 +112,25 @@ providers:
provider_type: inline::rag-runtime
- provider_id: model-context-protocol
provider_type: remote::model-context-protocol
metadata_store:
storage:
backends:
default_kv_store:
type: kv_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/open-benchmark}/registry.db
inference_store:
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/open-benchmark}/kvstore.db
default_sql_store:
type: sql_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/open-benchmark}/inference_store.db
conversations_store:
type: sql_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/open-benchmark}/conversations.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/open-benchmark}/sql_store.db
metadata:
namespace: registry
backend: default_kv_store
inference:
table_name: inference_store
backend: default_sql_store
max_write_queue_size: 10000
num_writers: 4
conversations:
table_name: openai_conversations
backend: default_sql_store
models:
- metadata: {}
model_id: gpt-4o

View file

@ -17,7 +17,4 @@ distribution_spec:
- provider_type: inline::rag-runtime
- provider_type: remote::model-context-protocol
image_type: venv
additional_pip_packages:
- asyncpg
- psycopg2-binary
- sqlalchemy[asyncio]
additional_pip_packages: []

View file

@ -105,22 +105,18 @@ def get_distribution_template() -> DistributionTemplate:
provider_overrides={
"inference": inference_providers + [embedding_provider],
"vector_io": vector_io_providers,
"agents": [
Provider(
provider_id="meta-reference",
provider_type="inline::meta-reference",
config=dict(
persistence_store=postgres_config,
responses_store=postgres_config,
),
)
],
},
default_models=default_models + [embedding_model],
default_tool_groups=default_tool_groups,
default_shields=[ShieldInput(shield_id="meta-llama/Llama-Guard-3-8B")],
metadata_store=PostgresKVStoreConfig.sample_run_config(),
inference_store=postgres_config,
storage_backends={
"default_kv_store": PostgresKVStoreConfig.sample_run_config(
table_name="llamastack_kvstore",
),
"default_sql_store": PostgresSqlStoreConfig.sample_run_config(),
},
),
},
run_config_env_vars={

View file

@ -33,20 +33,11 @@ providers:
- provider_id: meta-reference
provider_type: inline::meta-reference
config:
persistence_store:
type: sql_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}
responses_store:
type: sql_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}
persistence:
agent_state:
namespace: agents
responses:
table_name: responses
tool_runtime:
- provider_id: brave-search
provider_type: remote::brave-search
@ -62,7 +53,9 @@ providers:
provider_type: inline::rag-runtime
- provider_id: model-context-protocol
provider_type: remote::model-context-protocol
metadata_store:
storage:
backends:
default_kv_store:
type: kv_postgres
host: ${env.POSTGRES_HOST:=localhost}
port: ${env.POSTGRES_PORT:=5432}
@ -70,16 +63,24 @@ metadata_store:
user: ${env.POSTGRES_USER:=llamastack}
password: ${env.POSTGRES_PASSWORD:=llamastack}
table_name: ${env.POSTGRES_TABLE_NAME:=llamastack_kvstore}
inference_store:
default_sql_store:
type: sql_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}
conversations_store:
type: sql_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/postgres-demo}/conversations.db
metadata:
namespace: registry
backend: default_kv_store
inference:
table_name: inference_store
backend: default_sql_store
max_write_queue_size: 10000
num_writers: 4
conversations:
table_name: openai_conversations
backend: default_sql_store
models:
- metadata: {}
model_id: ${env.INFERENCE_MODEL}

View file

@ -53,6 +53,5 @@ distribution_spec:
- provider_type: inline::reference
image_type: venv
additional_pip_packages:
- aiosqlite
- asyncpg
- sqlalchemy[asyncio]

View file

@ -201,15 +201,25 @@ providers:
config:
kvstore:
namespace: batches
metadata_store:
storage:
backends:
default_kv_store:
type: kv_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter-gpu}/registry.db
inference_store:
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter-gpu}/kvstore.db
default_sql_store:
type: sql_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter-gpu}/inference_store.db
conversations_store:
type: sql_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter-gpu}/conversations.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter-gpu}/sql_store.db
metadata:
namespace: registry
backend: default_kv_store
inference:
table_name: inference_store
backend: default_sql_store
max_write_queue_size: 10000
num_writers: 4
conversations:
table_name: openai_conversations
backend: default_sql_store
models: []
shields:
- shield_id: llama-guard

View file

@ -53,6 +53,5 @@ distribution_spec:
- provider_type: inline::reference
image_type: venv
additional_pip_packages:
- aiosqlite
- asyncpg
- sqlalchemy[asyncio]

View file

@ -198,15 +198,25 @@ providers:
config:
kvstore:
namespace: batches
metadata_store:
storage:
backends:
default_kv_store:
type: kv_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter}/registry.db
inference_store:
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter}/kvstore.db
default_sql_store:
type: sql_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter}/inference_store.db
conversations_store:
type: sql_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter}/conversations.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter}/sql_store.db
metadata:
namespace: registry
backend: default_kv_store
inference:
table_name: inference_store
backend: default_sql_store
max_write_queue_size: 10000
num_writers: 4
conversations:
table_name: openai_conversations
backend: default_sql_store
models: []
shields:
- shield_id: llama-guard

View file

@ -29,6 +29,12 @@ from llama_stack.core.datatypes import (
ToolGroupInput,
)
from llama_stack.core.distribution import get_provider_registry
from llama_stack.core.storage.datatypes import (
InferenceStoreReference,
KVStoreReference,
SqlStoreReference,
StorageBackendType,
)
from llama_stack.core.utils.dynamic import instantiate_class_type
from llama_stack.core.utils.image_types import LlamaStackImageType
from llama_stack.providers.utils.inference.model_registry import ProviderModelEntry
@ -180,10 +186,8 @@ class RunConfigSettings(BaseModel):
default_tool_groups: list[ToolGroupInput] | None = None
default_datasets: list[DatasetInput] | None = None
default_benchmarks: list[BenchmarkInput] | None = None
metadata_store: dict | None = None
inference_store: dict | None = None
conversations_store: dict | None = None
telemetry: TelemetryConfig = Field(default_factory=lambda: TelemetryConfig(enabled=True))
storage_backends: dict[str, Any] | None = None
def run_config(
self,
@ -226,6 +230,33 @@ class RunConfigSettings(BaseModel):
# Get unique set of APIs from providers
apis = sorted(providers.keys())
storage_backends = self.storage_backends or {
"default_kv_store": SqliteKVStoreConfig.sample_run_config(
__distro_dir__=f"~/.llama/distributions/{name}",
db_name="kvstore.db",
),
"default_sql_store": SqliteSqlStoreConfig.sample_run_config(
__distro_dir__=f"~/.llama/distributions/{name}",
db_name="sql_store.db",
),
}
storage_config = dict(
backends=storage_backends,
metadata=KVStoreReference(
backend="default_kv_store",
namespace="registry",
).model_dump(exclude_none=True),
inference=InferenceStoreReference(
backend="default_sql_store",
table_name="inference_store",
).model_dump(exclude_none=True),
conversations=SqlStoreReference(
backend="default_sql_store",
table_name="openai_conversations",
).model_dump(exclude_none=True),
)
# Return a dict that matches StackRunConfig structure
return {
"version": LLAMA_STACK_RUN_CONFIG_VERSION,
@ -233,21 +264,7 @@ class RunConfigSettings(BaseModel):
"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
or SqliteSqlStoreConfig.sample_run_config(
__distro_dir__=f"~/.llama/distributions/{name}",
db_name="inference_store.db",
),
"conversations_store": self.conversations_store
or SqliteSqlStoreConfig.sample_run_config(
__distro_dir__=f"~/.llama/distributions/{name}",
db_name="conversations.db",
),
"storage": storage_config,
"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": [],
@ -387,11 +404,13 @@ class DistributionTemplate(BaseModel):
def enum_representer(dumper, data):
return dumper.represent_scalar("tag:yaml.org,2002:str", data.value)
# Register YAML representer for ModelType
# Register YAML representer for enums
yaml.add_representer(ModelType, enum_representer)
yaml.add_representer(DatasetPurpose, enum_representer)
yaml.add_representer(StorageBackendType, enum_representer)
yaml.SafeDumper.add_representer(ModelType, enum_representer)
yaml.SafeDumper.add_representer(DatasetPurpose, enum_representer)
yaml.SafeDumper.add_representer(StorageBackendType, enum_representer)
for output_dir in [yaml_output_dir, doc_output_dir]:
output_dir.mkdir(parents=True, exist_ok=True)

View file

@ -28,6 +28,4 @@ distribution_spec:
files:
- provider_type: inline::localfs
image_type: venv
additional_pip_packages:
- aiosqlite
- sqlalchemy[asyncio]
additional_pip_packages: []

View file

@ -86,15 +86,25 @@ providers:
storage_dir: ${env.FILES_STORAGE_DIR:=~/.llama/distributions/watsonx/files}
metadata_store:
table_name: files_metadata
metadata_store:
storage:
backends:
default_kv_store:
type: kv_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/watsonx}/registry.db
inference_store:
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/watsonx}/kvstore.db
default_sql_store:
type: sql_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/watsonx}/inference_store.db
conversations_store:
type: sql_sqlite
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/watsonx}/conversations.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/watsonx}/sql_store.db
metadata:
namespace: registry
backend: default_kv_store
inference:
table_name: inference_store
backend: default_sql_store
max_write_queue_size: 10000
num_writers: 4
conversations:
table_name: openai_conversations
backend: default_sql_store
models: []
shields: []
vector_dbs: []

View file

@ -9,7 +9,6 @@ import yaml
from llama_stack.core.datatypes import StackRunConfig
from llama_stack.core.storage.datatypes import (
PostgresSqlStoreConfig,
SqliteKVStoreConfig,
SqliteSqlStoreConfig,
)