JobGPT / cover_letter_generator.py
Aditya Patkar
Saving generation conversations to log file
0cae9a4
raw
history blame
796 Bytes
'''
This module generates cover letter from resume
'''
from loaders import get_chain_for_pdf
def generate_query(title:str, company:str, more_info = None):
'''
Generate a query from a title and company
'''
query = f"Write a professional and well-formatted cover letter based on the given resume for the job description provided of the position {title} at {company}.\n"
if more_info:
query += f"More info: {more_info}\n"
return query
def get_cover_letter(title:str, company:str, more_info = None, resume_path = "documents"):
'''
Generate a cover letter from a title and company
'''
query = generate_query(title, company, more_info)
chain = get_chain_for_pdf(resume_path)
response = chain({"query": query})
return response['result']