Llama Pack - 简历筛选器 📄¶
本示例展示如何使用简历筛选器 Llama Pack。 您可以在 https://llamahub.ai 上找到所有功能包。
该简历筛选器旨在根据一组标准分析候选人的简历,并判断候选人是否适合该职位。
在本示例中,我们将评估一份样本简历(例如 Jerry 的旧简历)。
In [ ]:
Copied!
%pip install llama-index-readers-wikipedia
%pip install llama-index-readers-wikipedia
In [ ]:
Copied!
!pip install llama-index llama-hub
!pip install llama-index llama-hub
数据准备¶
我们将加载一些关于OpenAI、Sam、Mira和Emmett的维基百科示例数据。为什么选择这些?其实没什么特别原因 :)
In [ ]:
Copied!
from llama_index.readers.wikipedia import WikipediaReader
loader = WikipediaReader()
documents = loader.load_data(
pages=["OpenAI", "Sam Altman", "Mira Murati", "Emmett Shear"],
auto_suggest=False,
)
from llama_index.readers.wikipedia import WikipediaReader
loader = WikipediaReader()
documents = loader.load_data(
pages=["OpenAI", "Sam Altman", "Mira Murati", "Emmett Shear"],
auto_suggest=False,
)
In [ ]:
Copied!
# do sentence splitting on the first piece of text
from llama_index.core.node_parser import SentenceSplitter
# do sentence splitting on the first piece of text
from llama_index.core.node_parser import SentenceSplitter
In [ ]:
Copied!
sentence_splitter = SentenceSplitter(chunk_size=1024)
sentence_splitter = SentenceSplitter(chunk_size=1024)
我们从每篇文章中提取第一个文本块。
In [ ]:
Copied!
# get the first 1024 tokens for each entity
openai_node = sentence_splitter.get_nodes_from_documents([documents[0]])[0]
sama_node = sentence_splitter.get_nodes_from_documents([documents[1]])[0]
mira_node = sentence_splitter.get_nodes_from_documents([documents[2]])[0]
emmett_node = sentence_splitter.get_nodes_from_documents([documents[3]])[0]
# get the first 1024 tokens for each entity
openai_node = sentence_splitter.get_nodes_from_documents([documents[0]])[0]
sama_node = sentence_splitter.get_nodes_from_documents([documents[1]])[0]
mira_node = sentence_splitter.get_nodes_from_documents([documents[2]])[0]
emmett_node = sentence_splitter.get_nodes_from_documents([documents[3]])[0]
我们还将下载杰瑞2019年的简历。
从 LlamaHub 下载简历筛选工具包¶
这里我们从 LlamaHub 下载简历筛选工具包类。
我们将它用于两个使用场景:
- 判断候选人是否适合前端/全栈工程师职位
- 判断候选人是否适合担任 OpenAI 首席执行官
In [ ]:
Copied!
from llama_index.core.llama_pack import download_llama_pack
from llama_index.core.llama_pack import download_llama_pack
In [ ]:
Copied!
ResumeScreenerPack = download_llama_pack(
"ResumeScreenerPack", "./resume_screener_pack"
)
ResumeScreenerPack = download_llama_pack(
"ResumeScreenerPack", "./resume_screener_pack"
)
机器学习工程师岗位筛选标准¶
我们参考了Meta官网上发布的机器学习工程师职位描述。
In [ ]:
Copied!
meta_jd = """\
Meta is embarking on the most transformative change to its business and technology in company history, and our Machine Learning Engineers are at the forefront of this evolution. By leading crucial projects and initiatives that have never been done before, you have an opportunity to help us advance the way people connect around the world.
The ideal candidate will have industry experience working on a range of recommendation, classification, and optimization problems. You will bring the ability to own the whole ML life cycle, define projects and drive excellence across teams. You will work alongside the world’s leading engineers and researchers to solve some of the most exciting and massive social data and prediction problems that exist on the web.\
"""
meta_jd = """\
Meta is embarking on the most transformative change to its business and technology in company history, and our Machine Learning Engineers are at the forefront of this evolution. By leading crucial projects and initiatives that have never been done before, you have an opportunity to help us advance the way people connect around the world.
The ideal candidate will have industry experience working on a range of recommendation, classification, and optimization problems. You will bring the ability to own the whole ML life cycle, define projects and drive excellence across teams. You will work alongside the world’s leading engineers and researchers to solve some of the most exciting and massive social data and prediction problems that exist on the web.\
"""
In [ ]:
Copied!
resume_screener = ResumeScreenerPack(
job_description=meta_jd,
criteria=[
"2+ years of experience in one or more of the following areas: machine learning, recommendation systems, pattern recognition, data mining, artificial intelligence, or related technical field",
"Experience demonstrating technical leadership working with teams, owning projects, defining and setting technical direction for projects",
"Bachelor's degree in Computer Science, Computer Engineering, relevant technical field, or equivalent practical experience.",
],
)
resume_screener = ResumeScreenerPack(
job_description=meta_jd,
criteria=[
"2+ years of experience in one or more of the following areas: machine learning, recommendation systems, pattern recognition, data mining, artificial intelligence, or related technical field",
"Experience demonstrating technical leadership working with teams, owning projects, defining and setting technical direction for projects",
"Bachelor's degree in Computer Science, Computer Engineering, relevant technical field, or equivalent practical experience.",
],
)
In [ ]:
Copied!
response = resume_screener.run(resume_path="jerry_resume.pdf")
response = resume_screener.run(resume_path="jerry_resume.pdf")
In [ ]:
Copied!
for cd in response.criteria_decisions:
print("### CRITERIA DECISION")
print(cd.reasoning)
print(cd.decision)
print("#### OVERALL REASONING ##### ")
print(str(response.overall_reasoning))
print(str(response.overall_decision))
for cd in response.criteria_decisions:
print("### CRITERIA DECISION")
print(cd.reasoning)
print(cd.decision)
print("#### OVERALL REASONING ##### ")
print(str(response.overall_reasoning))
print(str(response.overall_decision))
### CRITERIA DECISION Jerry Liu has more than 2 years of experience in machine learning and artificial intelligence. He worked as a Machine Learning Engineer at Quora Inc. for a year and has been an AI Research Scientist at Uber ATG since 2018. His work involves deep learning, information theory, and 3D geometry, among other areas. True ### CRITERIA DECISION Jerry Liu has demonstrated technical leadership in his roles at Uber ATG and Quora Inc. He has led and mentored multiple projects on multi-agent simulation, prediction, and planning. He also researched and productionized GBDT’s for new users at Quora, contributing to a 5% increase in new user active usage. True ### CRITERIA DECISION Jerry Liu has a Bachelor of Science in Engineering (B.S.E.) in Computer Science from Princeton University. He graduated Summa Cum Laude and was a member of Phi Beta Kappa, Tau Beta Pi, and Sigma Xi. True #### OVERALL REASONING ##### Jerry Liu meets all the screening criteria for the Machine Learning Engineer position at Meta. He has the required experience in machine learning and artificial intelligence, has demonstrated technical leadership, and has a relevant degree. True
前端/TypeScript 岗位候选人筛选¶
In [ ]:
Copied!
resume_screener = ResumeScreenerPack(
job_description="We're looking to hire a front-end engineer",
criteria=[
"The individual needs to be experienced in front-end / React / Typescript"
],
)
resume_screener = ResumeScreenerPack(
job_description="We're looking to hire a front-end engineer",
criteria=[
"The individual needs to be experienced in front-end / React / Typescript"
],
)
In [ ]:
Copied!
response = resume_screener.run(resume_path="jerry_resume.pdf")
response = resume_screener.run(resume_path="jerry_resume.pdf")
In [ ]:
Copied!
print(str(response.overall_reasoning))
print(str(response.overall_decision))
print(str(response.overall_reasoning))
print(str(response.overall_decision))
The candidate does not meet the specific criteria of having experience in front-end, React, or Typescript. False
OpenAI CEO 候选人筛选¶
Jerry 不会写 TypeScript,但他能成为 OpenAI 的 CEO 吗?
In [ ]:
Copied!
job_description = f"""\
We're looking to hire a CEO for OpenAI.
Instead of listing a set of specific criteria, each "criteria" is instead a short biography of a previous CEO.\
For each criteria/bio, outline if the candidate's experience matches or surpasses that of the candidate.
Also, here's a description of OpenAI from Wikipedia:
{openai_node.get_content()}
"""
profile_strs = [
f"Profile: {n.get_content()}" for n in [sama_node, mira_node, emmett_node]
]
resume_screener = ResumeScreenerPack(
job_description=job_description, criteria=profile_strs
)
job_description = f"""\
We're looking to hire a CEO for OpenAI.
Instead of listing a set of specific criteria, each "criteria" is instead a short biography of a previous CEO.\
For each criteria/bio, outline if the candidate's experience matches or surpasses that of the candidate.
Also, here's a description of OpenAI from Wikipedia:
{openai_node.get_content()}
"""
profile_strs = [
f"Profile: {n.get_content()}" for n in [sama_node, mira_node, emmett_node]
]
resume_screener = ResumeScreenerPack(
job_description=job_description, criteria=profile_strs
)
In [ ]:
Copied!
response = resume_screener.run(resume_path="jerry_resume.pdf")
response = resume_screener.run(resume_path="jerry_resume.pdf")
In [ ]:
Copied!
for cd in response.criteria_decisions:
print("### CRITERIA DECISION")
print(cd.reasoning)
print(cd.decision)
print("#### OVERALL REASONING ##### ")
print(str(response.overall_reasoning))
print(str(response.overall_decision))
for cd in response.criteria_decisions:
print("### CRITERIA DECISION")
print(cd.reasoning)
print(cd.decision)
print("#### OVERALL REASONING ##### ")
print(str(response.overall_reasoning))
print(str(response.overall_decision))
### CRITERIA DECISION The candidate, Jerry Liu, has a strong background in AI research and has led multiple projects in this field. However, he does not have the same level of executive leadership experience as Samuel Harris Altman, who served as CEO of OpenAI and president of Y Combinator. Altman also has experience leading an advanced AI research team at Microsoft, which Liu does not have. False ### CRITERIA DECISION While Jerry Liu has a strong background in AI and machine learning, his experience does not match or surpass that of Mira Murati. Murati served as the chief technology officer of OpenAI and briefly as its interim CEO. She led the company's work on several major projects and oversaw multiple teams. Liu does not have the same level of leadership or executive experience. False ### CRITERIA DECISION Jerry Liu's experience does not match or surpass that of Emmett Shear. Shear co-founded Justin.tv and served as the CEO of Twitch, demonstrating significant entrepreneurial and executive leadership experience. He also served as a part-time partner at venture capital firm Y Combinator and briefly as interim CEO of OpenAI. Liu, while having a strong background in AI research, does not have the same level of leadership or executive experience. False #### OVERALL REASONING ##### While Jerry Liu has a strong background in AI research and has led multiple projects in this field, his experience does not match or surpass that of the previous CEOs in terms of executive leadership and entrepreneurial experience. False
...可惜并非如此