Spaces:
Runtime error
Runtime error
| # models/transaction_categorization.py | |
| from pydantic import BaseModel, Field | |
| from typing import Optional, List | |
| class TransactionCategorizationRequest(BaseModel): | |
| sms_text: str | |
| sender: Optional[str] = None | |
| timestamp: Optional[int] = None | |
| class Config: | |
| schema_extra = { | |
| "example": { | |
| "sms_text": "Your a/c XX1234 is debited with Rs.450.00 on 15-06-2025 at Swiggy. Info:1234567890", | |
| "sender": "SWIGGP", | |
| "timestamp": 1623897600 | |
| } | |
| } | |
| class TransactionCategorizationResponse(BaseModel): | |
| is_transaction: bool | |
| category: str | |
| merchant: str | |
| amount: float | |
| transaction_type: str # "Income" or "Expense" | |
| confidence: float # 0.0 to 1.0 | |
| description: str | |
| spam: bool | |
| class Config: | |
| schema_extra = { | |
| "example": { | |
| "is_transaction": True, | |
| "category": "Food & Dining", | |
| "merchant": "Swiggy", | |
| "amount": 450.0, | |
| "transaction_type": "Expense", | |
| "confidence": 0.95, | |
| "description": "Food delivery payment", | |
| "spam": False | |
| } | |
| } |