umair894 commited on
Commit
592bdee
1 Parent(s): 4049941

Upload 14 files

Browse files
resume_screener_pack/README.md ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ DO NOT DELETE
2
+ This readme file is needed to install from pyproject.toml.
resume_screener_pack/llama_index/packs/resume_screener/.gradio/certificate.pem ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAw
3
+ TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
4
+ cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4
5
+ WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQGEwJVUzEpMCcGA1UEChMgSW50ZXJu
6
+ ZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMTDElTUkcgUm9vdCBY
7
+ MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54rVygc
8
+ h77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+
9
+ 0TM8ukj13Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6U
10
+ A5/TR5d8mUgjU+g4rk8Kb4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sW
11
+ T8KOEUt+zwvo/7V3LvSye0rgTBIlDHCNAymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyH
12
+ B5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ4Q7e2RCOFvu396j3x+UC
13
+ B5iPNgiV5+I3lg02dZ77DnKxHZu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F2LN9d11TPA
29
+ mRGunUHBcnWEvgJBQl9nJEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57d
30
+ emyPxgcYxn/eR44/KJ4EBs+lVDR3veyJm+kXQ99b21/+jh5Xos1AnX5iItreGCc=
31
+ -----END CERTIFICATE-----
resume_screener_pack/llama_index/packs/resume_screener/BUILD ADDED
@@ -0,0 +1 @@
 
 
1
+ python_sources()
resume_screener_pack/llama_index/packs/resume_screener/__init__.py ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ from llama_index.packs.resume_screener.base import ResumeScreenerPack
2
+
3
+ __all__ = ["ResumeScreenerPack"]
resume_screener_pack/llama_index/packs/resume_screener/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (271 Bytes). View file
 
resume_screener_pack/llama_index/packs/resume_screener/__pycache__/base.cpython-310.pyc ADDED
Binary file (3.59 kB). View file
 
resume_screener_pack/llama_index/packs/resume_screener/base.py ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pathlib import Path
2
+ from typing import Any, Dict, List, Optional
3
+
4
+ from llama_index.core import Settings
5
+ from llama_index.core.llama_pack.base import BaseLlamaPack
6
+ from llama_index.core.response_synthesizers import TreeSummarize
7
+ from llama_index.core.schema import NodeWithScore
8
+ from llama_index.llms.openai import OpenAI
9
+ from llama_index.readers.file import PDFReader
10
+ from llama_index.core.bridge.pydantic import BaseModel, Field
11
+
12
+ # backwards compatibility
13
+ try:
14
+ from llama_index.core.llms.llm import LLM
15
+ except ImportError:
16
+ from llama_index.core.llms.base import LLM
17
+
18
+ QUERY_TEMPLATE = """
19
+ You are an expert resume reviewer.
20
+ You job is to decide if the candidate pass the resume screen given the job description and a list of criteria:
21
+
22
+ ### Job Description
23
+ {job_description}
24
+
25
+ ### Screening Criteria
26
+ {criteria_str}
27
+ """
28
+
29
+
30
+ class CriteriaDecision(BaseModel):
31
+ """The decision made based on a single criteria."""
32
+
33
+ decision: bool = Field(description="The decision made based on the criteria")
34
+ reasoning: str = Field(description="The reasoning behind the decision")
35
+
36
+
37
+ class ResumeScreenerDecision(BaseModel):
38
+ """The decision made by the resume screener."""
39
+
40
+ criteria_decisions: List[CriteriaDecision] = Field(
41
+ description="The decisions made based on the criteria"
42
+ )
43
+ overall_reasoning: str = Field(
44
+ description="The reasoning behind the overall decision"
45
+ )
46
+ overall_decision: bool = Field(
47
+ description="The overall decision made based on the criteria"
48
+ )
49
+
50
+
51
+ def _format_criteria_str(criteria: List[str]) -> str:
52
+ criteria_str = ""
53
+ for criterion in criteria:
54
+ criteria_str += f"- {criterion}\n"
55
+ return criteria_str
56
+
57
+
58
+ class ResumeScreenerPack(BaseLlamaPack):
59
+ def __init__(
60
+ self, job_description: str, criteria: List[str], llm: Optional[LLM] = None
61
+ ) -> None:
62
+ self.reader = PDFReader()
63
+ llm = llm or OpenAI(model="gpt-3.5-turbo")
64
+ Settings.llm = llm
65
+ self.synthesizer = TreeSummarize(output_cls=ResumeScreenerDecision)
66
+ criteria_str = _format_criteria_str(criteria)
67
+ self.query = QUERY_TEMPLATE.format(
68
+ job_description=job_description, criteria_str=criteria_str
69
+ )
70
+
71
+ def get_modules(self) -> Dict[str, Any]:
72
+ """Get modules."""
73
+ return {"reader": self.reader, "synthesizer": self.synthesizer}
74
+
75
+ def run(self, resume_path: str, *args: Any, **kwargs: Any) -> Any:
76
+ """Run pack."""
77
+ docs = self.reader.load_data(Path(resume_path))
78
+ output = self.synthesizer.synthesize(
79
+ query=self.query,
80
+ nodes=[NodeWithScore(node=doc, score=1.0) for doc in docs],
81
+ )
82
+ return output.response
resume_screener_pack/llama_index/packs/resume_screener/resume_screener_pack/README.md ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ DO NOT DELETE
2
+ This readme file is needed to install from pyproject.toml.
resume_screener_pack/llama_index/packs/resume_screener/resume_screener_pack/llama_index/packs/resume_screener/BUILD ADDED
@@ -0,0 +1 @@
 
 
1
+ python_sources()
resume_screener_pack/llama_index/packs/resume_screener/resume_screener_pack/llama_index/packs/resume_screener/__init__.py ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ from llama_index.packs.resume_screener.base import ResumeScreenerPack
2
+
3
+ __all__ = ["ResumeScreenerPack"]
resume_screener_pack/llama_index/packs/resume_screener/resume_screener_pack/llama_index/packs/resume_screener/__pycache__/__init__.cpython-310.pyc ADDED
Binary file (326 Bytes). View file
 
resume_screener_pack/llama_index/packs/resume_screener/resume_screener_pack/llama_index/packs/resume_screener/base.py ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pathlib import Path
2
+ from typing import Any, Dict, List, Optional
3
+
4
+ from llama_index.core import Settings
5
+ from llama_index.core.llama_pack.base import BaseLlamaPack
6
+ from llama_index.core.response_synthesizers import TreeSummarize
7
+ from llama_index.core.schema import NodeWithScore
8
+ from llama_index.llms.openai import OpenAI
9
+ from llama_index.readers.file import PDFReader
10
+ from llama_index.core.bridge.pydantic import BaseModel, Field
11
+
12
+ # backwards compatibility
13
+ try:
14
+ from llama_index.core.llms.llm import LLM
15
+ except ImportError:
16
+ from llama_index.core.llms.base import LLM
17
+
18
+ QUERY_TEMPLATE = """
19
+ You are an expert resume reviewer.
20
+ You job is to decide if the candidate pass the resume screen given the job description and a list of criteria:
21
+
22
+ ### Job Description
23
+ {job_description}
24
+
25
+ ### Screening Criteria
26
+ {criteria_str}
27
+ """
28
+
29
+
30
+ class CriteriaDecision(BaseModel):
31
+ """The decision made based on a single criteria."""
32
+
33
+ decision: bool = Field(description="The decision made based on the criteria")
34
+ reasoning: str = Field(description="The reasoning behind the decision")
35
+
36
+
37
+ class ResumeScreenerDecision(BaseModel):
38
+ """The decision made by the resume screener."""
39
+
40
+ criteria_decisions: List[CriteriaDecision] = Field(
41
+ description="The decisions made based on the criteria"
42
+ )
43
+ overall_reasoning: str = Field(
44
+ description="The reasoning behind the overall decision"
45
+ )
46
+ overall_decision: bool = Field(
47
+ description="The overall decision made based on the criteria"
48
+ )
49
+
50
+
51
+ def _format_criteria_str(criteria: List[str]) -> str:
52
+ criteria_str = ""
53
+ for criterion in criteria:
54
+ criteria_str += f"- {criterion}\n"
55
+ return criteria_str
56
+
57
+
58
+ class ResumeScreenerPack(BaseLlamaPack):
59
+ def __init__(
60
+ self, job_description: str, criteria: List[str], llm: Optional[LLM] = None
61
+ ) -> None:
62
+ self.reader = PDFReader()
63
+ llm = llm or OpenAI(model="gpt-4")
64
+ Settings.llm = llm
65
+ self.synthesizer = TreeSummarize(output_cls=ResumeScreenerDecision)
66
+ criteria_str = _format_criteria_str(criteria)
67
+ self.query = QUERY_TEMPLATE.format(
68
+ job_description=job_description, criteria_str=criteria_str
69
+ )
70
+
71
+ def get_modules(self) -> Dict[str, Any]:
72
+ """Get modules."""
73
+ return {"reader": self.reader, "synthesizer": self.synthesizer}
74
+
75
+ def run(self, resume_path: str, *args: Any, **kwargs: Any) -> Any:
76
+ """Run pack."""
77
+ docs = self.reader.load_data(Path(resume_path))
78
+ output = self.synthesizer.synthesize(
79
+ query=self.query,
80
+ nodes=[NodeWithScore(node=doc, score=1.0) for doc in docs],
81
+ )
82
+ return output.response
resume_screener_pack/llama_index/packs/resume_screener/resume_screener_pack/pyproject.toml ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [build-system]
2
+ build-backend = "poetry.core.masonry.api"
3
+ requires = ["poetry-core"]
4
+
5
+ [tool.codespell]
6
+ check-filenames = true
7
+ check-hidden = true
8
+ skip = "*.csv,*.html,*.json,*.jsonl,*.pdf,*.txt,*.ipynb"
9
+
10
+ [tool.llamahub]
11
+ contains_example = false
12
+ import_path = "llama_index.packs.resume_screener"
13
+
14
+ [tool.llamahub.class_authors]
15
+ ResumeScreenerPack = "Disiok"
16
+
17
+ [tool.mypy]
18
+ disallow_untyped_defs = true
19
+ exclude = ["_static", "build", "examples", "notebooks", "venv"]
20
+ ignore_missing_imports = true
21
+ python_version = "3.8"
22
+
23
+ [tool.poetry]
24
+ authors = ["Your Name <you@example.com>"]
25
+ description = "llama-index packs resume_screener integration"
26
+ exclude = ["**/BUILD"]
27
+ keywords = ["document", "pdf", "resume", "structured output"]
28
+ license = "MIT"
29
+ maintainers = ["Disiok"]
30
+ name = "llama-index-packs-resume-screener"
31
+ readme = "README.md"
32
+ version = "0.4.0"
33
+
34
+ [tool.poetry.dependencies]
35
+ python = ">=3.8.1,<4.0"
36
+ pypdf = "^4.0.1"
37
+ llama-index-readers-file = "^0.2.0"
38
+ llama-index-llms-openai = "^0.2.0"
39
+
40
+ [tool.poetry.group.dev.dependencies]
41
+ ipython = "8.10.0"
42
+ jupyter = "^1.0.0"
43
+ mypy = "0.991"
44
+ pre-commit = "3.2.0"
45
+ pylint = "2.15.10"
46
+ pytest = "7.2.1"
47
+ pytest-mock = "3.11.1"
48
+ ruff = "0.0.292"
49
+ tree-sitter-languages = "^1.8.0"
50
+ types-Deprecated = ">=0.1.0"
51
+ types-PyYAML = "^6.0.12.12"
52
+ types-protobuf = "^4.24.0.4"
53
+ types-redis = "4.5.5.0"
54
+ types-requests = "2.28.11.8"
55
+ types-setuptools = "67.1.0.0"
56
+
57
+ [tool.poetry.group.dev.dependencies.black]
58
+ extras = ["jupyter"]
59
+ version = "<=23.9.1,>=23.7.0"
60
+
61
+ [tool.poetry.group.dev.dependencies.codespell]
62
+ extras = ["toml"]
63
+ version = ">=v2.2.6"
64
+
65
+ [[tool.poetry.packages]]
66
+ include = "llama_index/"
resume_screener_pack/pyproject.toml ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [build-system]
2
+ build-backend = "poetry.core.masonry.api"
3
+ requires = ["poetry-core"]
4
+
5
+ [tool.codespell]
6
+ check-filenames = true
7
+ check-hidden = true
8
+ skip = "*.csv,*.html,*.json,*.jsonl,*.pdf,*.txt,*.ipynb"
9
+
10
+ [tool.llamahub]
11
+ contains_example = false
12
+ import_path = "llama_index.packs.resume_screener"
13
+
14
+ [tool.llamahub.class_authors]
15
+ ResumeScreenerPack = "Disiok"
16
+
17
+ [tool.mypy]
18
+ disallow_untyped_defs = true
19
+ exclude = ["_static", "build", "examples", "notebooks", "venv"]
20
+ ignore_missing_imports = true
21
+ python_version = "3.8"
22
+
23
+ [tool.poetry]
24
+ authors = ["Your Name <you@example.com>"]
25
+ description = "llama-index packs resume_screener integration"
26
+ exclude = ["**/BUILD"]
27
+ keywords = ["document", "pdf", "resume", "structured output"]
28
+ license = "MIT"
29
+ maintainers = ["Disiok"]
30
+ name = "llama-index-packs-resume-screener"
31
+ readme = "README.md"
32
+ version = "0.4.0"
33
+
34
+ [tool.poetry.dependencies]
35
+ python = ">=3.8.1,<4.0"
36
+ pypdf = "^4.0.1"
37
+ llama-index-readers-file = "^0.2.0"
38
+ llama-index-llms-openai = "^0.2.0"
39
+
40
+ [tool.poetry.group.dev.dependencies]
41
+ ipython = "8.10.0"
42
+ jupyter = "^1.0.0"
43
+ mypy = "0.991"
44
+ pre-commit = "3.2.0"
45
+ pylint = "2.15.10"
46
+ pytest = "7.2.1"
47
+ pytest-mock = "3.11.1"
48
+ ruff = "0.0.292"
49
+ tree-sitter-languages = "^1.8.0"
50
+ types-Deprecated = ">=0.1.0"
51
+ types-PyYAML = "^6.0.12.12"
52
+ types-protobuf = "^4.24.0.4"
53
+ types-redis = "4.5.5.0"
54
+ types-requests = "2.28.11.8"
55
+ types-setuptools = "67.1.0.0"
56
+
57
+ [tool.poetry.group.dev.dependencies.black]
58
+ extras = ["jupyter"]
59
+ version = "<=23.9.1,>=23.7.0"
60
+
61
+ [tool.poetry.group.dev.dependencies.codespell]
62
+ extras = ["toml"]
63
+ version = ">=v2.2.6"
64
+
65
+ [[tool.poetry.packages]]
66
+ include = "llama_index/"