make kvstore configurable for dist and rename registry

This commit is contained in:
Dinesh Yeduguru 2024-11-04 10:43:24 -08:00
parent 4a26c0d54f
commit 46c4c35769
8 changed files with 23 additions and 11 deletions

View file

@ -15,7 +15,7 @@ from llama_stack.distribution.datatypes import RoutableObjectWithProvider
from llama_stack.providers.utils.kvstore import KVStore
class Registry(Protocol):
class DistributionRegistry(Protocol):
async def get(self, identifier: str) -> [RoutableObjectWithProvider]: ...
async def register(self, obj: RoutableObjectWithProvider) -> None: ...
@ -23,7 +23,7 @@ class Registry(Protocol):
KEY_FORMAT = "distributions:registry:{}"
class DiskRegistry(Registry):
class DiskDistributionRegistry(DistributionRegistry):
def __init__(self, kvstore: KVStore):
self.kvstore = kvstore
@ -33,7 +33,6 @@ class DiskRegistry(Registry):
if not json_str:
return []
# Parse JSON string into list of objects
objects_data = json.loads(json_str)
return [

View file

@ -19,7 +19,7 @@ async def test_registry():
# delete the file if it exists
if os.path.exists(config.db_path):
os.remove(config.db_path)
registry = DiskRegistry(await kvstore_impl(config))
registry = DiskDistributionRegistry(await kvstore_impl(config))
bank = VectorMemoryBankDef(
identifier="test_bank",
embedding_model="all-MiniLM-L6-v2",