Spaces:
Runtime error
Runtime error
Vincent Claes
commited on
Commit
•
245ba2a
1
Parent(s):
5a84835
return a tuple when generating an intro in gradio
Browse files- recruiting_assistant.py +3 -19
recruiting_assistant.py
CHANGED
@@ -4,7 +4,7 @@ from langchain.chat_models import ChatOpenAI
|
|
4 |
from langchain.prompts import ChatPromptTemplate
|
5 |
from langchain.chains import LLMChain, SequentialChain
|
6 |
|
7 |
-
from validation import validate_dict_value, validate_string_value
|
8 |
|
9 |
# os.environ["OPENA"]
|
10 |
|
@@ -104,22 +104,6 @@ def create_intro(vacancy=vacancy, resume=resume):
|
|
104 |
prompt_resume_check_skills = ChatPromptTemplate.from_template(template=template_resume_check_skills)
|
105 |
resume_skills = LLMChain(llm=llm, prompt=prompt_resume_check_skills, output_key="resume_skills")
|
106 |
|
107 |
-
template_resume_check_information = """
|
108 |
-
I have a resume below the delimiter <RESUME> and it ends with </RESUME>. Can you fill in the JSON below and respond with just that JSON object and no other text around it?
|
109 |
-
|
110 |
-
JSON:
|
111 |
-
|
112 |
-
{
|
113 |
-
"Naam": "<fill in the name of the candidate here>"
|
114 |
-
"Beschikbaarheid": "<fill in the availability here>",
|
115 |
-
"Tarief": "<fill in the day price here>",
|
116 |
-
"Woonplaats": "<fill in here the location where the candidate lives>",
|
117 |
-
"Talen": "<fill in the languages the candidate speaks>",
|
118 |
-
"Presentatie": "<describe the person, what's their role, their experience and skills in miminum 3 sentences and maximum 5 sentences. Keep the jargon in english.>"
|
119 |
-
}
|
120 |
-
|
121 |
-
"""
|
122 |
-
|
123 |
template_resume_past_experiences = """
|
124 |
Can you generate me a list of the past work experiences that the candidate has based on the resume below enclosed by three backticks.
|
125 |
Mention the experiences in one sentence of medium length. Return the experiences as a JSON list.
|
@@ -171,7 +155,7 @@ def create_intro(vacancy=vacancy, resume=resume):
|
|
171 |
Candidate: < name of the candidate >
|
172 |
Education: < name the education of the candidate >
|
173 |
Responsibilities: < did the candidate worked as an individual contributor or did het take on leadership postitions? >
|
174 |
-
Experience: < name the 2 most relevant experiences from the candidate for this vacancy. Get them from the "relevant_experiences" key of the JSON object {past_experiences}. If there
|
175 |
Skills: print here a comma seperated list of the "skills_present" key of the JSON object {resume_skills}
|
176 |
"""
|
177 |
|
@@ -187,7 +171,7 @@ def create_intro(vacancy=vacancy, resume=resume):
|
|
187 |
|
188 |
result = match_resume_vacancy_skills_chain({"vacancy": vacancy, "resume": resume})
|
189 |
print(result)
|
190 |
-
return result["introduction_email"], json.dumps(
|
191 |
|
192 |
|
193 |
|
|
|
4 |
from langchain.prompts import ChatPromptTemplate
|
5 |
from langchain.chains import LLMChain, SequentialChain
|
6 |
|
7 |
+
# from validation import validate_dict_value, validate_string_value
|
8 |
|
9 |
# os.environ["OPENA"]
|
10 |
|
|
|
104 |
prompt_resume_check_skills = ChatPromptTemplate.from_template(template=template_resume_check_skills)
|
105 |
resume_skills = LLMChain(llm=llm, prompt=prompt_resume_check_skills, output_key="resume_skills")
|
106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
template_resume_past_experiences = """
|
108 |
Can you generate me a list of the past work experiences that the candidate has based on the resume below enclosed by three backticks.
|
109 |
Mention the experiences in one sentence of medium length. Return the experiences as a JSON list.
|
|
|
155 |
Candidate: < name of the candidate >
|
156 |
Education: < name the education of the candidate >
|
157 |
Responsibilities: < did the candidate worked as an individual contributor or did het take on leadership postitions? >
|
158 |
+
Experience: < name the 2 most relevant experiences from the candidate for this vacancy. Get them from the "relevant_experiences" key of the JSON object {past_experiences}. If there us no relevant experience, leave this empty. Do not make up an answer or get them from the irrelevant experiences. >
|
159 |
Skills: print here a comma seperated list of the "skills_present" key of the JSON object {resume_skills}
|
160 |
"""
|
161 |
|
|
|
171 |
|
172 |
result = match_resume_vacancy_skills_chain({"vacancy": vacancy, "resume": resume})
|
173 |
print(result)
|
174 |
+
return result["introduction_email"], json.dumps({"resume skills":result['resume_skills'], "check_past_experiences": result['check_past_experiences']}, indent=4)
|
175 |
|
176 |
|
177 |
|