File size: 1,401 Bytes
5d267ad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
32
from pydantic import BaseModel, Field, HttpUrl, AnyHttpUrl
from typing import List, Optional
from uuid import UUID, uuid4

class UserProfile(BaseModel):
    id: UUID = Field(default_factory=uuid4)
    name: str = Field(..., min_length=2, max_length=100)
    technical_skills: List[str] = Field(default_factory=list)
    projects: List[str] = Field(default_factory=list)
    ai_expertise: List[str] = Field(default_factory=list)
    mentoring_preferences: str = Field(..., min_length=10, max_length=500)
    collaboration_interests: List[str] = Field(default_factory=list)
    portfolio_url: Optional[str] = None

    class Config:
        json_schema_extra = {
            "example": {
                "name": "John Doe",
                "technical_skills": ["Python", "FastAPI", "Machine Learning"],
                "projects": ["AI Chatbot", "Web Scraping Tool"],
                "ai_expertise": ["NLP", "Computer Vision"],
                "mentoring_preferences": "Available for weekly 1-hour sessions, focusing on AI and backend development",
                "collaboration_interests": ["Open Source", "AI Projects"],
                "portfolio_url": "https://github.com/johndoe"
            }
        }
        
    def model_dump(self, *args, **kwargs):
        data = super().model_dump(*args, **kwargs)
        # Convert UUID to string
        data['id'] = str(data['id'])
        return data