Update app/schemas/categories.py
Browse files- app/schemas/categories.py +11 -0
app/schemas/categories.py
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
|
|
|
|
|
| 1 |
from typing import Optional
|
| 2 |
|
| 3 |
from pydantic import BaseModel, Field
|
|
@@ -14,6 +16,15 @@ class CategoryPrediction(BaseModel):
|
|
| 14 |
title: str = Field(..., description="High-level category title.")
|
| 15 |
subcategory: str = Field(..., description="Specific subcategory chosen by the model.")
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
# from pydantic import BaseModel, Field
|
| 18 |
|
| 19 |
|
|
|
|
| 1 |
+
from __future__ import annotations
|
| 2 |
+
|
| 3 |
from typing import Optional
|
| 4 |
|
| 5 |
from pydantic import BaseModel, Field
|
|
|
|
| 16 |
title: str = Field(..., description="High-level category title.")
|
| 17 |
subcategory: str = Field(..., description="Specific subcategory chosen by the model.")
|
| 18 |
|
| 19 |
+
|
| 20 |
+
class CategorizeResponse(BaseModel):
|
| 21 |
+
status: str = Field(..., description="Outcome of the request (success/fail).")
|
| 22 |
+
data: Optional[CategoryPrediction] = Field(
|
| 23 |
+
None, description="Predicted category payload when successful."
|
| 24 |
+
)
|
| 25 |
+
message: Optional[str] = Field(None, description="Error message when failed.")
|
| 26 |
+
|
| 27 |
+
|
| 28 |
# from pydantic import BaseModel, Field
|
| 29 |
|
| 30 |
|