Spaces:
Running
Running
Enhanced the support for the excel file and added endpoint to have optimized vector store and Rag for the Excel.
b953016 Download src/models/UserContact.py from TalatMasud/chatbot-backend: direct link, hf CLI and curl.
- Browser
- Download file 834 Bytes
-
https://huggingface.co/spaces/TalatMasud/chatbot-backend/resolve/main/src/models/UserContact.py
- Command line
-
hf download hf://spaces/TalatMasud/chatbot-backend/src/models/UserContact.py
-
curl -L -o UserContact.py https://huggingface.co/spaces/TalatMasud/chatbot-backend/resolve/main/src/models/UserContact.py
834 Bytes
| from pydantic import BaseModel, EmailStr, validator | |
| import re | |
| class UserContactRequest(BaseModel): | |
| """Request model for user contact information""" | |
| full_name: str | |
| email: EmailStr | |
| phone_number: str | |
| def validate_phone(cls, v): | |
| # Remove any non-digit characters | |
| phone = re.sub(r'\D', '', v) | |
| if not 8 <= len(phone) <= 15: # Standard phone number length globally | |
| raise ValueError('Invalid phone number length') | |
| return phone | |
| def validate_name(cls, v): | |
| if not v.strip(): | |
| raise ValueError('Name cannot be empty') | |
| return v.strip() | |
| class UserContactResponse(BaseModel): | |
| """Response model for user contact endpoint""" | |
| conversation_id: str | |
| is_existing: bool | |
| message: str |