File size: 1,623 Bytes
df4a21a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"""
Pydantic schemas for model-related endpoints.
"""

from typing import Dict, List, Literal, Optional, Any
from pydantic import BaseModel, Field


class ModelInfo(BaseModel):
    """Information about a loaded model."""
    
    repo_id: str = Field(..., description="Hugging Face repository ID")
    name: str = Field(..., description="Short name of the model")
    model_type: Literal["submodel", "fusion"] = Field(
        ...,
        description="Type of model"
    )
    config: Optional[Dict[str, Any]] = Field(
        None,
        description="Model configuration from config.json"
    )


class ModelsListResponse(BaseModel):
    """Response schema for listing models."""
    
    fusion: Optional[ModelInfo] = Field(
        None,
        description="Fusion model information"
    )
    submodels: List[ModelInfo] = Field(
        default_factory=list,
        description="List of loaded submodels"
    )
    total_count: int = Field(..., description="Total number of loaded models")


class HealthResponse(BaseModel):
    """Response schema for health check."""
    
    status: Literal["ok", "error"] = Field(..., description="Health status")


class ReadyResponse(BaseModel):
    """Response schema for readiness check."""
    
    status: Literal["ready", "not_ready"] = Field(..., description="Readiness status")
    models_loaded: bool = Field(..., description="Whether models are loaded")
    fusion_repo: Optional[str] = Field(None, description="Fusion repository ID")
    submodels: List[str] = Field(
        default_factory=list,
        description="List of loaded submodel repository IDs"
    )