mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 09:53:45 +00:00
chore: removed impl_getter from router function
Refactored the router to accept the implementation directly instead of using the impl_getter pattern. The caller already knows which API it's building a router for.for Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
parent
8a21d8debe
commit
95e9455335
4 changed files with 12 additions and 25 deletions
|
|
@ -14,6 +14,7 @@ from typing import Any
|
|||
from fastapi import FastAPI
|
||||
|
||||
from llama_stack.core.resolver import api_protocol_map
|
||||
from llama_stack.core.server.fastapi_router_registry import build_router, has_router
|
||||
from llama_stack_api import Api
|
||||
|
||||
from .state import _protocol_methods_cache
|
||||
|
|
@ -77,19 +78,11 @@ def create_llama_stack_app() -> FastAPI:
|
|||
)
|
||||
|
||||
# Include routers for APIs that have them (automatic discovery)
|
||||
from llama_stack.core.server.fastapi_router_registry import build_router, has_router
|
||||
|
||||
def dummy_impl_getter(api: Api) -> Any:
|
||||
"""Dummy implementation getter for OpenAPI generation."""
|
||||
return None
|
||||
|
||||
# Get all APIs that might have routers
|
||||
from llama_stack.core.resolver import api_protocol_map
|
||||
|
||||
protocols = api_protocol_map()
|
||||
for api in protocols.keys():
|
||||
if has_router(api):
|
||||
router = build_router(api, dummy_impl_getter)
|
||||
# For OpenAPI generation, we don't need a real implementation
|
||||
router = build_router(api, None)
|
||||
if router:
|
||||
app.include_router(router)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue