Arjun Singh commited on
Commit
1e17a38
·
1 Parent(s): 6b6ab10

Fix prompt template

Browse files
Files changed (1) hide show
  1. app.py +20 -16
app.py CHANGED
@@ -5,6 +5,7 @@ from langchain.embeddings import HuggingFaceEmbeddings
5
  from langchain.vectorstores import Chroma
6
  from langchain.chains import LLMChain
7
  from langchain_groq import ChatGroq
 
8
  from typing import List, Dict
9
  import os
10
  import tempfile
@@ -28,28 +29,31 @@ def process_candidate_submission(resume_file, job_description: str) -> str:
28
 
29
  resume_doc = loader.load()[0]
30
 
31
- # Create prompt for cold email generation
32
- prompt_template = """
33
- Given the following resume and job description, create a professional cold email:
34
-
35
- Resume:
36
- {resume_text}
37
-
38
- Job Description:
39
- {job_description}
40
-
41
- Generate a concise, compelling cold email that highlights the candidate's relevant skills and experience.
42
- """
 
 
 
43
 
44
  chain = LLMChain(
45
  llm=llm,
46
  prompt=prompt_template
47
  )
48
 
49
- response = chain.run(
50
- resume_text=resume_doc.page_content,
51
- job_description=job_description
52
- )
53
 
54
  return response
55
 
 
5
  from langchain.vectorstores import Chroma
6
  from langchain.chains import LLMChain
7
  from langchain_groq import ChatGroq
8
+ from langchain.prompts import PromptTemplate
9
  from typing import List, Dict
10
  import os
11
  import tempfile
 
29
 
30
  resume_doc = loader.load()[0]
31
 
32
+ # Create proper prompt template
33
+ prompt_template = PromptTemplate(
34
+ input_variables=["resume_text", "job_description"],
35
+ template="""
36
+ Given the following resume and job description, create a professional cold email:
37
+
38
+ Resume:
39
+ {resume_text}
40
+
41
+ Job Description:
42
+ {job_description}
43
+
44
+ Generate a concise, compelling cold email that highlights the candidate's relevant skills and experience.
45
+ """
46
+ )
47
 
48
  chain = LLMChain(
49
  llm=llm,
50
  prompt=prompt_template
51
  )
52
 
53
+ response = chain.run({
54
+ "resume_text": resume_doc.page_content,
55
+ "job_description": job_description
56
+ })
57
 
58
  return response
59