datasets api

This commit is contained in:
Xi Yan 2024-10-14 13:16:39 -07:00
parent 18fe966e96
commit f046899a1c
15 changed files with 281 additions and 80 deletions

View file

@ -3,3 +3,20 @@
#
# This source code is licensed under the terms described in the LICENSE file in
# the root directory of this source tree.
from typing import Any
from llama_stack.providers.datatypes import Api
from .datasets.dataset import DatasetRegistryImpl
async def get_registry_impl(api: Api, _deps) -> Any:
api_to_registry = {
"datasets": DatasetRegistryImpl,
}
if api.value not in api_to_registry:
raise ValueError(f"API {api.value} not found in registry map")
impl = api_to_registry[api.value]()
await impl.initialize()
return impl