34 lines
2.1 KiB
Python
34 lines
2.1 KiB
Python
import logging
|
|
|
|
# Set up logging
|
|
logger = logging.getLogger(__name__)
|
|
logger.setLevel(logging.INFO)
|
|
handler = logging.StreamHandler()
|
|
handler.setFormatter(logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s'))
|
|
logger.addHandler(handler)
|
|
|
|
class CoverLetterAgent:
|
|
def __init__(self):
|
|
pass
|
|
|
|
def generate_cover_letter(self, candidate_info: dict, job_info: dict) -> str:
|
|
try:
|
|
# Generate a cover letter based on candidate and job information
|
|
cover_letter = f"Dear {job_info['hiring_manager_name']},\n\n"
|
|
cover_letter += f"I am writing to express my interest in the {job_info['position']} position at {job_info['company']}. "
|
|
cover_letter += "With my background in {candidate_info['background']} and experience in {candidate_info['experience']}, "
|
|
cover_letter += f"I am confident in my ability to contribute effectively to your team.\n\n"
|
|
cover_letter += "During my previous role at {candidate_info['previous_company']}, I successfully {candidate_info['achievement']}. "
|
|
cover_letter += f"This experience has equipped me with the skills and knowledge necessary to excel in the {job_info['position']} role.\n\n"
|
|
cover_letter += "I am particularly drawn to {job_info['company']} because of its commitment to {job_info['values']} and innovative approach to {job_info['industry']}. "
|
|
cover_letter += "I am eager to leverage my expertise to support {job_info['company']} in achieving its goals.\n\n"
|
|
cover_letter += "Thank you for considering my application. I am excited about the opportunity to contribute to your team "
|
|
cover_letter += "and am available for an interview at your earliest convenience.\n\n"
|
|
cover_letter += "Sincerely,\n"
|
|
cover_letter += f"{candidate_info['full_name']}"
|
|
|
|
logger.info("Cover letter generated successfully")
|
|
return cover_letter
|
|
except Exception as e:
|
|
logger.error(f"Error generating cover letter: {e}")
|
|
return None |