-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpydantic_models.py
39 lines (33 loc) · 1.28 KB
/
pydantic_models.py
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
from datetime import datetime
from typing import Dict, Optional, Set
from pydantic import BaseModel, Field
class PredictionRequest(BaseModel):
source_request: Dict = Field(
...,
title="Source request",
description="Source request received by AtmosphereX from external system.",
)
prediction_timestamp: datetime = Field(
...,
title="Prediction time",
description="Time when the prediction was requested.",
)
allowed_action_names: Optional[Set[str]] = Field(
None,
title="Set of allowed actions",
description="Set of actions that the inference pipeline can return."
"If the list is empty or absent, any actions can be returned,"
"otherwise any actions not in this list will be discarded by AtmosphereX"
"which will return a default value. The set contains the action names only.",
)
class PredictionResponse(BaseModel):
model_config = {"ignore_extra": False}
action_name: str = Field(
..., title="Action name", description="Prediction action name"
)
logs: Dict = Field(
{},
title="Prediction logs",
description="Logs created by the inference endpoints which will be stored "
"in the database with the corresponding prediction.",
)