raj999 commited on
Commit
7440517
·
1 Parent(s): 94bce9a
Files changed (2) hide show
  1. app.py +3 -3
  2. llm/pipeline.py +3 -3
app.py CHANGED
@@ -86,7 +86,7 @@ def clear_api_key() -> str:
86
 
87
 
88
  def _render_latex_from_tailored(tailored: TailoredResume, template_choice: str) -> str:
89
- context = tailored.tailored_resume.dict()
90
  return render_template(template_choice, context)
91
 
92
 
@@ -188,11 +188,11 @@ def generate_tailored_resume(
188
  rendered_latex,
189
  missing_text,
190
  questions_text,
191
- json.dumps(tailored.keyword_alignment.dict(), indent=2),
192
  "\n".join(logs),
193
  tex_file_path,
194
  pdf_file_path,
195
- resume.json(indent=2),
196
  )
197
  except Exception as exc:
198
  log(f"Error: {exc}")
 
86
 
87
 
88
  def _render_latex_from_tailored(tailored: TailoredResume, template_choice: str) -> str:
89
+ context = tailored.tailored_resume.model_dump()
90
  return render_template(template_choice, context)
91
 
92
 
 
188
  rendered_latex,
189
  missing_text,
190
  questions_text,
191
+ json.dumps(tailored.keyword_alignment.model_dump(), indent=2),
192
  "\n".join(logs),
193
  tex_file_path,
194
  pdf_file_path,
195
+ resume.model_dump_json(indent=2),
196
  )
197
  except Exception as exc:
198
  log(f"Error: {exc}")
llm/pipeline.py CHANGED
@@ -15,7 +15,7 @@ def extract_resume_json(
15
  client = build_client(provider, api_key=api_key, model=model)
16
  prompt = EXTRACTION_PROMPT.format(resume_text=raw_text)
17
  data = client.chat_json(prompt)
18
- resume = Resume.parse_obj(data)
19
  resume.raw_text = raw_text
20
  return resume
21
 
@@ -30,7 +30,7 @@ def tailor_resume(
30
  template_source: str,
31
  ) -> TailoredResume:
32
  client = build_client(provider, api_key=api_key, model=model)
33
- payload = json.loads(resume.json())
34
  prompt = TAILORING_PROMPT.format(
35
  resume_json=json.dumps(payload),
36
  job_description=job_description,
@@ -38,7 +38,7 @@ def tailor_resume(
38
  template_source=template_source,
39
  )
40
  data = client.chat_json(prompt)
41
- return TailoredResume.parse_obj(data)
42
 
43
 
44
  def run_pipeline(
 
15
  client = build_client(provider, api_key=api_key, model=model)
16
  prompt = EXTRACTION_PROMPT.format(resume_text=raw_text)
17
  data = client.chat_json(prompt)
18
+ resume = Resume.model_validate(data)
19
  resume.raw_text = raw_text
20
  return resume
21
 
 
30
  template_source: str,
31
  ) -> TailoredResume:
32
  client = build_client(provider, api_key=api_key, model=model)
33
+ payload = resume.model_dump()
34
  prompt = TAILORING_PROMPT.format(
35
  resume_json=json.dumps(payload),
36
  job_description=job_description,
 
38
  template_source=template_source,
39
  )
40
  data = client.chat_json(prompt)
41
+ return TailoredResume.model_validate(data)
42
 
43
 
44
  def run_pipeline(