mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-21 16:07:16 +00:00
**This PR changes configurations in a backward incompatible way.** Run configs today repeat full SQLite/Postgres snippets everywhere a store is needed, which means duplicated credentials, extra connection pools, and lots of drift between files. This PR introduces named storage backends so the stack and providers can share a single catalog and reference those backends by name. ## Key Changes - Add `storage.backends` to `StackRunConfig`, register each KV/SQL backend once at startup, and validate that references point to the right family. - Move server stores under `storage.stores` with lightweight references (backend + namespace/table) instead of full configs. - Update every provider/config/doc to use the new reference style; docs/codegen now surface the simplified YAML. ## Migration Before: ```yaml metadata_store: type: sqlite db_path: ~/.llama/distributions/foo/registry.db inference_store: type: postgres host: ${env.POSTGRES_HOST} port: ${env.POSTGRES_PORT} db: ${env.POSTGRES_DB} user: ${env.POSTGRES_USER} password: ${env.POSTGRES_PASSWORD} conversations_store: type: postgres host: ${env.POSTGRES_HOST} port: ${env.POSTGRES_PORT} db: ${env.POSTGRES_DB} user: ${env.POSTGRES_USER} password: ${env.POSTGRES_PASSWORD} ``` After: ```yaml storage: backends: kv_default: type: kv_sqlite db_path: ~/.llama/distributions/foo/kvstore.db sql_default: type: sql_postgres host: ${env.POSTGRES_HOST} port: ${env.POSTGRES_PORT} db: ${env.POSTGRES_DB} user: ${env.POSTGRES_USER} password: ${env.POSTGRES_PASSWORD} stores: metadata: backend: kv_default namespace: registry inference: backend: sql_default table_name: inference_store max_write_queue_size: 10000 num_writers: 4 conversations: backend: sql_default table_name: openai_conversations ``` Provider configs follow the same pattern—for example, a Chroma vector adapter switches from: ```yaml providers: vector_io: - provider_id: chromadb provider_type: remote::chromadb config: url: ${env.CHROMADB_URL} kvstore: type: sqlite db_path: ~/.llama/distributions/foo/chroma.db ``` to: ```yaml providers: vector_io: - provider_id: chromadb provider_type: remote::chromadb config: url: ${env.CHROMADB_URL} persistence: backend: kv_default namespace: vector_io::chroma_remote ``` Once the backends are declared, everything else just points at them, so rotating credentials or swapping to Postgres happens in one place and the stack reuses a single connection pool.
143 lines
4.2 KiB
YAML
143 lines
4.2 KiB
YAML
version: '2'
|
|
image_name: kubernetes-benchmark-demo
|
|
apis:
|
|
- agents
|
|
- files
|
|
- inference
|
|
- files
|
|
- safety
|
|
- telemetry
|
|
- tool_runtime
|
|
- vector_io
|
|
providers:
|
|
inference:
|
|
- provider_id: vllm-inference
|
|
provider_type: remote::vllm
|
|
config:
|
|
url: ${env.VLLM_URL:=http://localhost:8000/v1}
|
|
max_tokens: ${env.VLLM_MAX_TOKENS:=4096}
|
|
api_token: ${env.VLLM_API_TOKEN:=fake}
|
|
tls_verify: ${env.VLLM_TLS_VERIFY:=true}
|
|
- provider_id: sentence-transformers
|
|
provider_type: inline::sentence-transformers
|
|
config: {}
|
|
files:
|
|
- provider_id: meta-reference-files
|
|
provider_type: inline::localfs
|
|
config:
|
|
storage_dir: ${env.FILES_STORAGE_DIR:=~/.llama/distributions/starter/files}
|
|
metadata_store:
|
|
type: sqlite
|
|
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter}/files_metadata.db
|
|
vector_io:
|
|
- provider_id: ${env.ENABLE_CHROMADB:+chromadb}
|
|
provider_type: remote::chromadb
|
|
config:
|
|
url: ${env.CHROMADB_URL:=}
|
|
kvstore:
|
|
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}
|
|
files:
|
|
- provider_id: meta-reference-files
|
|
provider_type: inline::localfs
|
|
config:
|
|
storage_dir: ${env.FILES_STORAGE_DIR:=~/.llama/distributions/starter/files}
|
|
metadata_store:
|
|
type: sqlite
|
|
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter}/files_metadata.db
|
|
safety:
|
|
- provider_id: llama-guard
|
|
provider_type: inline::llama-guard
|
|
config:
|
|
excluded_categories: []
|
|
agents:
|
|
- provider_id: meta-reference
|
|
provider_type: inline::meta-reference
|
|
config:
|
|
persistence_store:
|
|
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}
|
|
responses_store:
|
|
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}
|
|
telemetry:
|
|
- provider_id: meta-reference
|
|
provider_type: inline::meta-reference
|
|
config:
|
|
service_name: "${env.OTEL_SERVICE_NAME:=\u200B}"
|
|
sinks: ${env.TELEMETRY_SINKS:=console}
|
|
tool_runtime:
|
|
- provider_id: brave-search
|
|
provider_type: remote::brave-search
|
|
config:
|
|
api_key: ${env.BRAVE_SEARCH_API_KEY:+}
|
|
max_results: 3
|
|
- provider_id: tavily-search
|
|
provider_type: remote::tavily-search
|
|
config:
|
|
api_key: ${env.TAVILY_SEARCH_API_KEY:+}
|
|
max_results: 3
|
|
- provider_id: rag-runtime
|
|
provider_type: inline::rag-runtime
|
|
config: {}
|
|
- provider_id: model-context-protocol
|
|
provider_type: remote::model-context-protocol
|
|
config: {}
|
|
storage:
|
|
backends:
|
|
kv_default:
|
|
type: kv_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}
|
|
table_name: ${env.POSTGRES_TABLE_NAME:=llamastack_kvstore}
|
|
sql_default:
|
|
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}
|
|
references:
|
|
metadata:
|
|
backend: kv_default
|
|
namespace: registry
|
|
inference:
|
|
backend: sql_default
|
|
table_name: inference_store
|
|
models:
|
|
- metadata:
|
|
embedding_dimension: 768
|
|
model_id: nomic-embed-text-v1.5
|
|
provider_id: sentence-transformers
|
|
model_type: embedding
|
|
- model_id: ${env.INFERENCE_MODEL}
|
|
provider_id: vllm-inference
|
|
model_type: llm
|
|
shields:
|
|
- shield_id: ${env.SAFETY_MODEL:=meta-llama/Llama-Guard-3-1B}
|
|
vector_dbs: []
|
|
datasets: []
|
|
scoring_fns: []
|
|
benchmarks: []
|
|
tool_groups:
|
|
- toolgroup_id: builtin::websearch
|
|
provider_id: tavily-search
|
|
- toolgroup_id: builtin::rag
|
|
provider_id: rag-runtime
|
|
server:
|
|
port: 8323
|