from utils.prompts import ( basic_details_extraction_prompt, general_skils_extraction_prompt, specific_skills_comparison_prompt, ) from utils.gpt import gpt_response prompt_mapping = { "basic": basic_details_extraction_prompt, "general": general_skils_extraction_prompt, "specific": specific_skills_comparison_prompt, } def paired_critique( cv_contents: str, job_post_contents: str, response_type: str, API_KEY: str ) -> str: """Process CV contents, using Cohere""" # First, get the prompt from the prompt dict prompt = prompt_mapping.get(response_type) # Now, populate with the contents of the CV and job posting prompt = prompt.replace("", cv_contents).replace( "", job_post_contents ) response = gpt_response( prompt=prompt, api_key=API_KEY, ) return response if __name__ == "__main__": with open("sample_data/meta_job.txt", "r") as file: post_contents = file.read() with open("sample_data/example_cv.txt", "r") as file: cv_contents = file.read() COHERE_API_KEY = "" output = paired_critique(post_contents, cv_contents, "specific", COHERE_API_KEY) print(output)