-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmodels.py
More file actions
32 lines (25 loc) · 883 Bytes
/
models.py
File metadata and controls
32 lines (25 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from fastapi import APIRouter
from backend.services.model_service import get_all_models
from backend.config import get_settings
router = APIRouter()
settings = get_settings()
def _dnt_endpoint() -> str:
"""When OTELA_FIXTURE_PATH is set, read DNT from disk instead of HTTP —
used for iterating on the UI against synthesised post-upgrade payloads."""
if settings.otela_fixture_path:
return settings.otela_fixture_path
return settings.otela_head_addr + "/v1/dnt/table"
@router.get("/v1/models_detailed")
async def list_models_detailed():
models = get_all_models(_dnt_endpoint(), with_details=True)
return dict(
object="list",
data=models,
)
@router.get("/v1/models")
async def list_models():
models = get_all_models(_dnt_endpoint(), with_details=False)
return dict(
object="list",
data=models,
)