CV-Extractor / mirascope_extractor.py
danial2020's picture
Upload 6 files
3f4a167 verified
raw
history blame contribute delete
821 Bytes
from mirascope.openai import OpenAIExtractor
from mirascope.gemini import GeminiExtractor
from mirascope.groq import GroqExtractor
from retry import retry
from pydantic import FilePath, BaseModel
from typing import List, Type
class TaskDetails(BaseModel):
name: str
email: str
phone_number: str
skills: List[str]
education: str
past_company_experience: str
about_section: str
class TaskExtractor(OpenAIExtractor[TaskDetails]):
extract_schema: Type[TaskDetails] = TaskDetails
prompt_template = """
Extract the Resume details from the following Resume:
{resume}
"""
resume: str
@retry(tries=3, delay=2, backoff=2)
def extractor(text):
task_details = TaskExtractor(resume=text).extract()
assert isinstance(task_details, TaskDetails)
return task_details