File size: 1,857 Bytes
80dbe44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from typing import Optional
from pydantic import BaseModel, Field

class TransportationRequest(BaseModel):
    """Schema cho yêu cầu dự đoán phương thức vận chuyển."""
    
    # Thông tin bắt buộc
    project_code: str = Field(..., description="Mã dự án", example="100-CI-T01")
    country: str = Field(..., description="Quốc gia đích", example="Vietnam")
    pack_price: float = Field(..., description="Giá mỗi gói (USD)", example=50.0)
    vendor: str = Field(..., description="Nhà cung cấp", example="ABBOTT LABORATORIES")
    
    # Thông tin tùy chọn (sẽ ước tính nếu không có)
    weight_kg: Optional[float] = Field(None, description="Khối lượng (kg)", example=25.0)
    freight_cost_usd: Optional[float] = Field(None, description="Chi phí vận chuyển (USD)", example=500.0)
    delivery_date: Optional[str] = Field(None, description="Ngày giao hàng (YYYY-MM-DD)", example="2025-08-20")
    line_item_quantity: Optional[float] = Field(100.0, description="Số lượng để ước tính weight", example=100.0)

class TransportationResponse(BaseModel):
    """Schema cho kết quả dự đoán phương thức vận chuyển."""
    
    predicted_shipment_mode: str = Field(..., description="Phương thức vận chuyển đề xuất")
    confidence_score: float = Field(..., description="Độ tin cậy (0-1)")
    alternative_modes: list = Field(..., description="Các phương thức khác")
    
    # Thông tin bổ sung
    estimated_weight_kg: Optional[float] = Field(None, description="Khối lượng ước tính")
    estimated_freight_cost_usd: Optional[float] = Field(None, description="Chi phí ước tính")
    encoded_features: Optional[dict] = Field(None, description="Features encoded")
    processing_notes: Optional[list] = Field(None, description="Ghi chú")