Skip to content

Commit e93942c

Browse files
committed
Fixed models errors
1 parent f639143 commit e93942c

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

locallab/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
LocalLab - A lightweight AI inference server for running LLMs locally
33
"""
44

5-
__version__ = "0.4.22"
5+
__version__ = "0.4.37"
66

77
# Only import what's necessary initially, lazy-load the rest
88
from .logger import get_logger

locallab/routes/models.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,11 @@
1515
# Get logger
1616
logger = get_logger("locallab.routes.models")
1717

18-
# Create router
19-
router = APIRouter(tags=["Models"])
18+
# Create router with prefix
19+
router = APIRouter(
20+
prefix="/models",
21+
tags=["Models"]
22+
)
2023

2124
class ModelInfo(BaseModel):
2225
"""Model information response"""
@@ -42,7 +45,7 @@ class LoadModelRequest(BaseModel):
4245
"""Request model for loading a model"""
4346
model_id: str
4447

45-
@router.post("/models/load")
48+
@router.post("/load")
4649
async def load_model(request: LoadModelRequest) -> Dict[str, str]:
4750
"""Load a specific model"""
4851
try:
@@ -54,7 +57,7 @@ async def load_model(request: LoadModelRequest) -> Dict[str, str]:
5457
logger.error(f"Failed to load model {request.model_id}: {str(e)}")
5558
raise HTTPException(status_code=500, detail=str(e))
5659

57-
@router.get("", response_model=ModelsListResponse)
60+
@router.get("/list", response_model=ModelsListResponse)
5861
async def list_models() -> ModelsListResponse:
5962
"""List all available models"""
6063
models_list = []
@@ -72,14 +75,12 @@ async def list_models() -> ModelsListResponse:
7275
current_model=model_manager.current_model
7376
)
7477

75-
7678
@router.get("/available", response_model=ModelsListResponse)
7779
async def available_models() -> ModelsListResponse:
7880
"""List all available models (alternative endpoint)"""
7981
# This endpoint exists to provide compatibility with different API patterns
8082
return await list_models()
8183

82-
8384
@router.get("/current", response_model=ModelResponse)
8485
async def get_current_model() -> ModelResponse:
8586
"""Get information about the currently loaded model"""
@@ -96,7 +97,6 @@ async def get_current_model() -> ModelResponse:
9697
loading_progress=1.0
9798
)
9899

99-
100100
@router.post("/load/{model_id}", response_model=Dict[str, str])
101101
async def load_model(model_id: str, background_tasks: BackgroundTasks) -> Dict[str, str]:
102102
"""Load a specific model"""
@@ -115,7 +115,6 @@ async def load_model(model_id: str, background_tasks: BackgroundTasks) -> Dict[s
115115
logger.error(f"Failed to load model {model_id}: {str(e)}")
116116
raise HTTPException(status_code=500, detail=str(e))
117117

118-
119118
@router.post("/load", response_model=Dict[str, str])
120119
async def load_model_from_body(request: LoadModelRequest, background_tasks: BackgroundTasks) -> Dict[str, str]:
121120
"""Load a specific model using model_id from request body"""
@@ -135,7 +134,6 @@ async def load_model_from_body(request: LoadModelRequest, background_tasks: Back
135134
logger.error(f"Failed to load model {model_id}: {str(e)}")
136135
raise HTTPException(status_code=500, detail=str(e))
137136

138-
139137
@router.post("/unload", response_model=Dict[str, str])
140138
async def unload_model() -> Dict[str, str]:
141139
"""Unload the current model to free up resources"""
@@ -150,7 +148,6 @@ async def unload_model() -> Dict[str, str]:
150148
logger.error(f"Failed to unload model: {str(e)}")
151149
raise HTTPException(status_code=500, detail=str(e))
152150

153-
154151
@router.get("/status/{model_id}", response_model=ModelResponse)
155152
async def get_model_status(model_id: str) -> ModelResponse:
156153
"""Get the loading status of a specific model"""

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(
77
name="locallab",
8-
version="0.4.36",
8+
version="0.4.37",
99
packages=find_packages(include=["locallab", "locallab.*"]),
1010
install_requires=[
1111
"fastapi>=0.95.0,<1.0.0",

0 commit comments

Comments
 (0)