Pydantic Schemas - Request and response models for the REST API.
Defines the data structures for API requests and responses, providing validation and automatic documentation.
Classes
Request schema for predictions.
Attributes
features
List[List[Union[float, int]]]
2D array of input features. Shape: (n_samples, n_features)
Response schema for predictions.
Attributes
predictions
List[Any]
Model predictions for each input sample
model_id
str
Identifier of the model used
model_class
Optional[str]
= None
Class name of the model
Response schema for probability predictions.
Attributes
probabilities
List[List[float]]
Class probabilities. Shape: (n_samples, n_classes)
classes
Optional[List[Any]]
= None
Class labels corresponding to probability columns
model_id
str
Identifier of the model used
Request schema for loading a model.
Attributes
model_id
str
Unique identifier for the model
path
str
Path to the saved model file
metadata
Optional[Dict[str, Any]]
= None
Additional metadata to associate with the model
Response schema for model information.
Attributes
model_id
str
Model identifier
model_class
Optional[str]
= None
Model class name
model_module
Optional[str]
= None
Model module path
params
Dict[str, Any]
= {}
Model parameters
path
Optional[str]
= None
Path to model file
loaded_at
Optional[str]
= None
Timestamp when loaded
prediction_count
int
= 0
Number of predictions made
metadata
Dict[str, Any]
= {}
Custom metadata
Response schema for listing models.
Attributes
models
List[str]
List of loaded model identifiers
count
int
Number of loaded models
Response schema for health check.
Attributes
status
str
= 'healthy'
Server health status
version
str
TuiML version
models_loaded
int
Number of models in memory
Response schema for server statistics.
Attributes
loaded_models
int
Number of loaded models
max_models
int
Maximum models capacity
total_predictions
int
Total predictions served
models
List[Dict[str, Any]]
Per-model statistics
Response schema for errors.
Attributes
error
str
Error message
detail
Optional[str]
= None
Detailed error information
model_id
Optional[str]
= None
Related model ID if applicable
Request schema for batch predictions across multiple models.
Attributes
requests
List[Dict[str, Any]]
List of prediction requests with model_id and features