router table registration works

This commit is contained in:
Xi Yan 2024-09-21 14:26:48 -07:00
parent 85d927adde
commit 951cc9d7b7
4 changed files with 91 additions and 27 deletions

View file

@ -6,10 +6,12 @@
from typing import Any, Dict, List, Tuple
from llama_stack.distribution.datatypes import Api
from llama_stack.distribution.datatypes import Api, ProviderRoutingEntry
async def get_router_impl(api: str, provider_routing_table: Dict[str, Any]):
async def get_router_impl(
api: str, provider_routing_table: Dict[str, List[ProviderRoutingEntry]]
):
from .routers import InferenceRouter, MemoryRouter
from .routing_table import RoutingTable
@ -18,10 +20,9 @@ async def get_router_impl(api: str, provider_routing_table: Dict[str, Any]):
"inference": InferenceRouter,
}
# initialize routing table with concrete provider impls
routing_table = RoutingTable(provider_routing_table)
routing_table.print()
impl = api2routers[api](routing_table)
# impl = Router(api, provider_routing_table)
await impl.initialize()
return impl