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.exec import formulate_run_args, run_command
from llama_stack.core.utils.image_types import LlamaStackImageType from llama_stack.core.utils.image_types import LlamaStackImageType
from llama_stack.providers.datatypes import Api from llama_stack.providers.datatypes import Api
from llama_stack.providers.utils.sqlstore.sqlstore import SqliteSqlStoreConfig
DISTRIBS_PATH = Path(__file__).parent.parent.parent / "distributions" DISTRIBS_PATH = Path(__file__).parent.parent.parent / "distributions"

View file

@ -465,7 +465,7 @@ can be instantiated multiple times (with different configs) if necessary.
) )
storage: StorageConfig = Field( storage: StorageConfig = Field(
description=""" description="""
Storage backend configurations. Each backend is named, and can be referenced by various components Storage backend configurations. Each backend is named, and can be referenced by various components
throughout the Stack (both by its core as well as providers). throughout the Stack (both by its core as well as providers).
""", """,
) )

View file

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

View file

@ -198,15 +198,25 @@ providers:
config: config:
kvstore: kvstore:
namespace: batches namespace: batches
metadata_store: storage:
type: kv_sqlite backends:
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ci-tests}/registry.db default_kv_store:
inference_store: type: kv_sqlite
type: sql_sqlite db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ci-tests}/kvstore.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ci-tests}/inference_store.db default_sql_store:
conversations_store: type: sql_sqlite
type: sql_sqlite db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ci-tests}/sql_store.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ci-tests}/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: [] models: []
shields: shields:
- shield_id: llama-guard - shield_id: llama-guard

View file

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

View file

@ -81,15 +81,25 @@ providers:
max_results: 3 max_results: 3
- provider_id: rag-runtime - provider_id: rag-runtime
provider_type: inline::rag-runtime provider_type: inline::rag-runtime
metadata_store: storage:
type: kv_sqlite backends:
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/registry.db default_kv_store:
inference_store: type: kv_sqlite
type: sql_sqlite db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/kvstore.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/inference_store.db default_sql_store:
conversations_store: type: sql_sqlite
type: sql_sqlite db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/sql_store.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/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: models:
- metadata: {} - metadata: {}
model_id: ${env.INFERENCE_MODEL} model_id: ${env.INFERENCE_MODEL}

View file

@ -77,15 +77,25 @@ providers:
max_results: 3 max_results: 3
- provider_id: rag-runtime - provider_id: rag-runtime
provider_type: inline::rag-runtime provider_type: inline::rag-runtime
metadata_store: storage:
type: kv_sqlite backends:
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/registry.db default_kv_store:
inference_store: type: kv_sqlite
type: sql_sqlite db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/kvstore.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/inference_store.db default_sql_store:
conversations_store: type: sql_sqlite
type: sql_sqlite db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/sql_store.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/dell}/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: models:
- metadata: {} - metadata: {}
model_id: ${env.INFERENCE_MODEL} model_id: ${env.INFERENCE_MODEL}

View file

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

View file

@ -94,15 +94,25 @@ providers:
provider_type: inline::rag-runtime provider_type: inline::rag-runtime
- provider_id: model-context-protocol - provider_id: model-context-protocol
provider_type: remote::model-context-protocol provider_type: remote::model-context-protocol
metadata_store: storage:
type: kv_sqlite backends:
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/registry.db default_kv_store:
inference_store: type: kv_sqlite
type: sql_sqlite db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/kvstore.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/inference_store.db default_sql_store:
conversations_store: type: sql_sqlite
type: sql_sqlite db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/sql_store.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/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: models:
- metadata: {} - metadata: {}
model_id: ${env.INFERENCE_MODEL} model_id: ${env.INFERENCE_MODEL}

View file

@ -84,15 +84,25 @@ providers:
provider_type: inline::rag-runtime provider_type: inline::rag-runtime
- provider_id: model-context-protocol - provider_id: model-context-protocol
provider_type: remote::model-context-protocol provider_type: remote::model-context-protocol
metadata_store: storage:
type: kv_sqlite backends:
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/registry.db default_kv_store:
inference_store: type: kv_sqlite
type: sql_sqlite db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/kvstore.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/inference_store.db default_sql_store:
conversations_store: type: sql_sqlite
type: sql_sqlite db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/sql_store.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/meta-reference-gpu}/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: models:
- metadata: {} - metadata: {}
model_id: ${env.INFERENCE_MODEL} model_id: ${env.INFERENCE_MODEL}

View file

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

View file

@ -84,15 +84,25 @@ providers:
storage_dir: ${env.FILES_STORAGE_DIR:=~/.llama/distributions/nvidia/files} storage_dir: ${env.FILES_STORAGE_DIR:=~/.llama/distributions/nvidia/files}
metadata_store: metadata_store:
table_name: files_metadata table_name: files_metadata
metadata_store: storage:
type: kv_sqlite backends:
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/nvidia}/registry.db default_kv_store:
inference_store: type: kv_sqlite
type: sql_sqlite db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/nvidia}/kvstore.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/nvidia}/inference_store.db default_sql_store:
conversations_store: type: sql_sqlite
type: sql_sqlite db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/nvidia}/sql_store.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/nvidia}/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: models:
- metadata: {} - metadata: {}
model_id: ${env.INFERENCE_MODEL} model_id: ${env.INFERENCE_MODEL}

View file

@ -74,15 +74,25 @@ providers:
storage_dir: ${env.FILES_STORAGE_DIR:=~/.llama/distributions/nvidia/files} storage_dir: ${env.FILES_STORAGE_DIR:=~/.llama/distributions/nvidia/files}
metadata_store: metadata_store:
table_name: files_metadata table_name: files_metadata
metadata_store: storage:
type: kv_sqlite backends:
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/nvidia}/registry.db default_kv_store:
inference_store: type: kv_sqlite
type: sql_sqlite db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/nvidia}/kvstore.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/nvidia}/inference_store.db default_sql_store:
conversations_store: type: sql_sqlite
type: sql_sqlite db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/nvidia}/sql_store.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/nvidia}/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: [] models: []
shields: [] shields: []
vector_dbs: [] vector_dbs: []

View file

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

View file

@ -112,15 +112,25 @@ providers:
provider_type: inline::rag-runtime provider_type: inline::rag-runtime
- provider_id: model-context-protocol - provider_id: model-context-protocol
provider_type: remote::model-context-protocol provider_type: remote::model-context-protocol
metadata_store: storage:
type: kv_sqlite backends:
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/open-benchmark}/registry.db default_kv_store:
inference_store: type: kv_sqlite
type: sql_sqlite db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/open-benchmark}/kvstore.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/open-benchmark}/inference_store.db default_sql_store:
conversations_store: type: sql_sqlite
type: sql_sqlite db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/open-benchmark}/sql_store.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/open-benchmark}/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: models:
- metadata: {} - metadata: {}
model_id: gpt-4o model_id: gpt-4o

View file

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

View file

@ -105,22 +105,18 @@ def get_distribution_template() -> DistributionTemplate:
provider_overrides={ provider_overrides={
"inference": inference_providers + [embedding_provider], "inference": inference_providers + [embedding_provider],
"vector_io": vector_io_providers, "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_models=default_models + [embedding_model],
default_tool_groups=default_tool_groups, default_tool_groups=default_tool_groups,
default_shields=[ShieldInput(shield_id="meta-llama/Llama-Guard-3-8B")], default_shields=[ShieldInput(shield_id="meta-llama/Llama-Guard-3-8B")],
metadata_store=PostgresKVStoreConfig.sample_run_config(), metadata_store=PostgresKVStoreConfig.sample_run_config(),
inference_store=postgres_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={ run_config_env_vars={

View file

@ -33,20 +33,11 @@ providers:
- provider_id: meta-reference - provider_id: meta-reference
provider_type: inline::meta-reference provider_type: inline::meta-reference
config: config:
persistence_store: persistence:
type: sql_postgres agent_state:
host: ${env.POSTGRES_HOST:=localhost} namespace: agents
port: ${env.POSTGRES_PORT:=5432} responses:
db: ${env.POSTGRES_DB:=llamastack} table_name: responses
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}
tool_runtime: tool_runtime:
- provider_id: brave-search - provider_id: brave-search
provider_type: remote::brave-search provider_type: remote::brave-search
@ -62,24 +53,34 @@ providers:
provider_type: inline::rag-runtime provider_type: inline::rag-runtime
- provider_id: model-context-protocol - provider_id: model-context-protocol
provider_type: remote::model-context-protocol provider_type: remote::model-context-protocol
metadata_store: storage:
type: kv_postgres backends:
host: ${env.POSTGRES_HOST:=localhost} default_kv_store:
port: ${env.POSTGRES_PORT:=5432} type: kv_postgres
db: ${env.POSTGRES_DB:=llamastack} host: ${env.POSTGRES_HOST:=localhost}
user: ${env.POSTGRES_USER:=llamastack} port: ${env.POSTGRES_PORT:=5432}
password: ${env.POSTGRES_PASSWORD:=llamastack} db: ${env.POSTGRES_DB:=llamastack}
table_name: ${env.POSTGRES_TABLE_NAME:=llamastack_kvstore} user: ${env.POSTGRES_USER:=llamastack}
inference_store: password: ${env.POSTGRES_PASSWORD:=llamastack}
type: sql_postgres table_name: ${env.POSTGRES_TABLE_NAME:=llamastack_kvstore}
host: ${env.POSTGRES_HOST:=localhost} default_sql_store:
port: ${env.POSTGRES_PORT:=5432} type: sql_postgres
db: ${env.POSTGRES_DB:=llamastack} host: ${env.POSTGRES_HOST:=localhost}
user: ${env.POSTGRES_USER:=llamastack} port: ${env.POSTGRES_PORT:=5432}
password: ${env.POSTGRES_PASSWORD:=llamastack} db: ${env.POSTGRES_DB:=llamastack}
conversations_store: user: ${env.POSTGRES_USER:=llamastack}
type: sql_sqlite password: ${env.POSTGRES_PASSWORD:=llamastack}
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: models:
- metadata: {} - metadata: {}
model_id: ${env.INFERENCE_MODEL} model_id: ${env.INFERENCE_MODEL}

View file

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

View file

@ -201,15 +201,25 @@ providers:
config: config:
kvstore: kvstore:
namespace: batches namespace: batches
metadata_store: storage:
type: kv_sqlite backends:
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter-gpu}/registry.db default_kv_store:
inference_store: type: kv_sqlite
type: sql_sqlite db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter-gpu}/kvstore.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter-gpu}/inference_store.db default_sql_store:
conversations_store: type: sql_sqlite
type: sql_sqlite db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter-gpu}/sql_store.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter-gpu}/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: [] models: []
shields: shields:
- shield_id: llama-guard - shield_id: llama-guard

View file

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

View file

@ -198,15 +198,25 @@ providers:
config: config:
kvstore: kvstore:
namespace: batches namespace: batches
metadata_store: storage:
type: kv_sqlite backends:
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter}/registry.db default_kv_store:
inference_store: type: kv_sqlite
type: sql_sqlite db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter}/kvstore.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter}/inference_store.db default_sql_store:
conversations_store: type: sql_sqlite
type: sql_sqlite db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter}/sql_store.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter}/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: [] models: []
shields: shields:
- shield_id: llama-guard - shield_id: llama-guard

View file

@ -29,6 +29,12 @@ from llama_stack.core.datatypes import (
ToolGroupInput, ToolGroupInput,
) )
from llama_stack.core.distribution import get_provider_registry 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.dynamic import instantiate_class_type
from llama_stack.core.utils.image_types import LlamaStackImageType from llama_stack.core.utils.image_types import LlamaStackImageType
from llama_stack.providers.utils.inference.model_registry import ProviderModelEntry 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_tool_groups: list[ToolGroupInput] | None = None
default_datasets: list[DatasetInput] | None = None default_datasets: list[DatasetInput] | None = None
default_benchmarks: list[BenchmarkInput] | 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)) telemetry: TelemetryConfig = Field(default_factory=lambda: TelemetryConfig(enabled=True))
storage_backends: dict[str, Any] | None = None
def run_config( def run_config(
self, self,
@ -226,6 +230,33 @@ class RunConfigSettings(BaseModel):
# Get unique set of APIs from providers # Get unique set of APIs from providers
apis = sorted(providers.keys()) 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 a dict that matches StackRunConfig structure
return { return {
"version": LLAMA_STACK_RUN_CONFIG_VERSION, "version": LLAMA_STACK_RUN_CONFIG_VERSION,
@ -233,21 +264,7 @@ class RunConfigSettings(BaseModel):
"container_image": container_image, "container_image": container_image,
"apis": apis, "apis": apis,
"providers": provider_configs, "providers": provider_configs,
"metadata_store": self.metadata_store "storage": storage_config,
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",
),
"models": [m.model_dump(exclude_none=True) for m in (self.default_models 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 [])], "shields": [s.model_dump(exclude_none=True) for s in (self.default_shields or [])],
"vector_dbs": [], "vector_dbs": [],
@ -387,11 +404,13 @@ class DistributionTemplate(BaseModel):
def enum_representer(dumper, data): def enum_representer(dumper, data):
return dumper.represent_scalar("tag:yaml.org,2002:str", data.value) 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(ModelType, enum_representer)
yaml.add_representer(DatasetPurpose, 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(ModelType, enum_representer)
yaml.SafeDumper.add_representer(DatasetPurpose, 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]: for output_dir in [yaml_output_dir, doc_output_dir]:
output_dir.mkdir(parents=True, exist_ok=True) output_dir.mkdir(parents=True, exist_ok=True)

View file

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

View file

@ -86,15 +86,25 @@ providers:
storage_dir: ${env.FILES_STORAGE_DIR:=~/.llama/distributions/watsonx/files} storage_dir: ${env.FILES_STORAGE_DIR:=~/.llama/distributions/watsonx/files}
metadata_store: metadata_store:
table_name: files_metadata table_name: files_metadata
metadata_store: storage:
type: kv_sqlite backends:
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/watsonx}/registry.db default_kv_store:
inference_store: type: kv_sqlite
type: sql_sqlite db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/watsonx}/kvstore.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/watsonx}/inference_store.db default_sql_store:
conversations_store: type: sql_sqlite
type: sql_sqlite db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/watsonx}/sql_store.db
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/watsonx}/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: [] models: []
shields: [] shields: []
vector_dbs: [] vector_dbs: []

View file

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