This commit is contained in:
feder-cr 2024-08-10 18:54:57 +01:00
parent c0716dbf39
commit e4eaa9261d

4
gpt.py
View File

@ -127,7 +127,6 @@ class GPTAnswerer:
@staticmethod @staticmethod
def find_best_match(text: str, options: list[str]) -> str: def find_best_match(text: str, options: list[str]) -> str:
# Find the best match for the given text from a list of options using Levenshtein distance.
distances = [ distances = [
(option, distance(text.lower(), option.lower())) for option in options (option, distance(text.lower(), option.lower())) for option in options
] ]
@ -136,7 +135,6 @@ class GPTAnswerer:
@staticmethod @staticmethod
def _remove_placeholders(text: str) -> str: def _remove_placeholders(text: str) -> str:
# Remove placeholder text from a string.
text = text.replace("PLACEHOLDER", "") text = text.replace("PLACEHOLDER", "")
return text.strip() return text.strip()
@ -181,14 +179,12 @@ class GPTAnswerer:
| fusion_job_description_resume_chain | fusion_job_description_resume_chain
| (lambda formatted_resume: html_template + formatted_resume) | (lambda formatted_resume: html_template + formatted_resume)
) )
try: try:
output = composed_chain.invoke({ output = composed_chain.invoke({
"resume": self.resume, "resume": self.resume,
"job_description": self.job.summarize_job_description "job_description": self.job.summarize_job_description
}) })
return output return output
except Exception as e: except Exception as e:
#print(f"Error during elaboration: {e}") #print(f"Error during elaboration: {e}")
pass pass