mirror of
https://github.com/meta-llama/llama-stack.git
synced 2026-01-01 19:10:00 +00:00
feat: Add new compact MetricInResponse type
This commit is contained in:
parent
0fdb15bcc7
commit
8b63aba7a4
5 changed files with 21 additions and 26 deletions
|
|
@ -75,9 +75,9 @@ class LogSeverity(Enum):
|
|||
|
||||
|
||||
class EventCommon(BaseModel):
|
||||
trace_id: str
|
||||
span_id: str
|
||||
timestamp: datetime
|
||||
trace_id: Optional[str] = None
|
||||
span_id: Optional[str] = None
|
||||
timestamp: Optional[datetime] = None
|
||||
attributes: Optional[Dict[str, Primitive]] = Field(default_factory=dict)
|
||||
|
||||
|
||||
|
|
@ -93,7 +93,14 @@ class MetricEvent(EventCommon):
|
|||
type: Literal[EventType.METRIC.value] = EventType.METRIC.value
|
||||
metric: str # this would be an enum
|
||||
value: Union[int, float]
|
||||
unit: str
|
||||
unit: Optional[str] = None
|
||||
|
||||
|
||||
@json_schema_type
|
||||
class MetricInResponse(BaseModel):
|
||||
metric: str
|
||||
value: Union[int, float]
|
||||
unit: Optional[str] = None
|
||||
|
||||
|
||||
# This is a short term solution to allow inference API to return metrics
|
||||
|
|
@ -117,7 +124,7 @@ class MetricEvent(EventCommon):
|
|||
|
||||
|
||||
class MetricResponseMixin(BaseModel):
|
||||
metrics: Optional[List[MetricEvent]] = None
|
||||
metrics: Optional[List[MetricInResponse]] = None
|
||||
|
||||
|
||||
@json_schema_type
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue