File size: 763 Bytes
6c6956f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
'''
    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 of {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 = "resume.pdf"):
    '''
    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']