mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-22 16:23:08 +00:00
Fix discriminator ambiguity with context-aware backend parsing
- Both SqliteKVStoreConfig and SqliteSqlStoreConfig use type='sqlite' - Pydantic cannot distinguish them in a union - Solution: Custom validator parses backends based on which stores reference them - Metadata store requires KVStore, inference/conversations require SqlStore - Separate kvstore/sqlstore backends in configs for clarity
This commit is contained in:
parent
088a6ac652
commit
5672e70832
4 changed files with 157 additions and 37 deletions
|
@ -28,8 +28,8 @@ from llama_stack.log import get_logger
|
|||
from llama_stack.providers.utils.sqlstore.api import ColumnDefinition, ColumnType
|
||||
from llama_stack.providers.utils.sqlstore.authorized_sqlstore import AuthorizedSqlStore
|
||||
from llama_stack.providers.utils.sqlstore.sqlstore import (
|
||||
PostgresSqlStoreConfig,
|
||||
SqliteSqlStoreConfig,
|
||||
SqlStoreConfig,
|
||||
sqlstore_impl,
|
||||
)
|
||||
|
||||
|
@ -47,7 +47,7 @@ class ConversationServiceConfig(BaseModel):
|
|||
policy: list[AccessRule] = []
|
||||
|
||||
@property
|
||||
def conversations_store(self) -> SqlStoreConfig:
|
||||
def conversations_store(self) -> SqliteSqlStoreConfig | PostgresSqlStoreConfig:
|
||||
"""Resolve conversations store from persistence config."""
|
||||
return resolve_conversations_store_config(self.run_config.persistence)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue