import os from langchain import LLMChain from langchain.chains import SequentialChain from langchain.chat_models import ChatOpenAI from langchain.prompts import ChatPromptTemplate def preprocess_resume(llm, resume) -> SequentialChain: """We mold the resume to the format of the vacancy to increase the chances of good search results.""" template_get_skills_intersection = """ ``` {resume} ``` Can you summarize the above resume in the template below and fill in eveything that is delimited by '<' '>'? Return only the filled in template nothing else. position: < the job name or role > location: < where does the person live > description: < the description or the person's job or role and description of it's experience. > profile: < can you describe the sector the person is working in > competences: < can you describe some hard skills of the person> """ prompt_get_skills_intersection = ChatPromptTemplate.from_template( template=template_get_skills_intersection ) skills_match_chain = LLMChain( llm=llm, prompt=prompt_get_skills_intersection, output_key="resume_preprocess", ) chain = SequentialChain( chains=[skills_match_chain], input_variables=["resume"], output_variables=[ skills_match_chain.output_key, ], verbose=False, ) return chain({"resume": resume})