Skip to content

Instantly share code, notes, and snippets.

@pietz
Created December 19, 2023 13:30
Show Gist options
  • Save pietz/fd2234c11b47d63ffcbe4bb2120b691e to your computer and use it in GitHub Desktop.
Save pietz/fd2234c11b47d63ffcbe4bb2120b691e to your computer and use it in GitHub Desktop.
pydantic model for CV data extraction
class Job(BaseModel):
"""A Job or position extracted from the resume"""
position: str = Field(..., description="Name of the position")
company: str = Field(..., description="Company name")
start_date: str = Field(None, description="Start date of the job")
end_date: str = Field(None, description="End date of the job or 'Present'")
top_keywords: list[str] = Field(None, description="List of max. top 10 keywords, skills and technologies used for the job")
class Degree(BaseModel):
"""Degree or other type of education extracted from the resume"""
name: str = Field(..., description="Name of the degree and field of study")
institution: str = Field(None, description="University name")
start_date: str = Field(None, description="Start date of the studies")
end_date: str = Field(None, description="End date of the studies")
@marvin.ai_model(client=client, temperature=0.0)
class Resume(BaseModel):
"""Resume data extracted from the resume"""
name: str = Field(..., description="The name of the person")
email: str = Field(None, description="Email address of the person")
phone: str = Field(None, description="Phone number of the person")
location: str = Field(None, description="Current residence of the person")
websites: str = Field(None, description="Website like LinkedIn, GitHub, Behance, etc.")
work_experience: list[Job] = None
education: list[Degree] = None
skills: list[str] = Field(None, description="List of core skills and technologies")
languages: list[str] = Field(None, description="List of languages spoken by the person")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment