chatbot-backend / src /models /UserContact.py
TalatMasood's picture
Enhanced the support for the excel file and added endpoint to have optimized vector store and Rag for the Excel.
b953016
raw
history blame
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
@validator('phone_number')
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
@validator('full_name')
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