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:
Sébastien Han 2025-11-21 12:02:09 +01:00
parent 8a21d8debe
commit 95e9455335
No known key found for this signature in database
4 changed files with 12 additions and 25 deletions

View file

@ -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)