mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-08 04:54:38 +00:00
skeleton unified routing table, api routers
This commit is contained in:
parent
2dc14cba2c
commit
85d927adde
11 changed files with 210 additions and 231 deletions
27
llama_stack/distribution/routers/__init__.py
Normal file
27
llama_stack/distribution/routers/__init__.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# 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, Dict, List, Tuple
|
||||
|
||||
from llama_stack.distribution.datatypes import Api
|
||||
|
||||
|
||||
async def get_router_impl(api: str, provider_routing_table: Dict[str, Any]):
|
||||
from .routers import InferenceRouter, MemoryRouter
|
||||
from .routing_table import RoutingTable
|
||||
|
||||
api2routers = {
|
||||
"memory": MemoryRouter,
|
||||
"inference": InferenceRouter,
|
||||
}
|
||||
|
||||
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
|
Loading…
Add table
Add a link
Reference in a new issue