LeoWalker commited on
Commit
f7fc876
1 Parent(s): 0e8c8f5

re organized the file structure in order to work with building a streamlit app to test the job description extraction.

Browse files
.gitignore ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ *.env
2
+ .env
3
+
4
+ # Jupyter Notebooks
5
+ .ipynb_checkpoints/
6
+
7
+ # Python virtual environment
8
+ venv/
.vscode/settings.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ {
2
+ "python.analysis.autoImportCompletions": true
3
+ }
notebooks/google_job_rwtest.ipynb CHANGED
@@ -101,12 +101,10 @@
101
  "outputs": [],
102
  "source": [
103
  "import pandas as pd\n",
104
- "# from serpapi import GoogleSearch\n",
105
  "import sqlite3\n",
106
  "import datetime as dt\n",
107
  "import http.client\n",
108
  "import json\n",
109
- "import config\n",
110
  "import urllib.parse\n",
111
  "import os\n",
112
  "from sqlalchemy import create_engine\n",
@@ -280,6 +278,20 @@
280
  "main(job_list, simple_city_state_list)"
281
  ]
282
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
283
  {
284
  "cell_type": "markdown",
285
  "metadata": {},
@@ -805,161 +817,173 @@
805
  "metadata": {},
806
  "outputs": [],
807
  "source": [
808
- "from typing import List, Optional\n",
809
- "from langchain_core.pydantic_v1 import BaseModel, Field\n",
810
  "\n",
811
- "class CompanyOverview(BaseModel):\n",
812
- " \"\"\"\n",
813
- " A model for capturing key information about the company offering the job.\n",
814
  " \n",
815
- " Extract relevant details about the company from the job description, \n",
816
- " including a brief overview of its industry and products, its mission and \n",
817
- " values, size, and location(s).\n",
818
  " \n",
819
- " Focus on capturing the most salient points that give a well-rounded picture\n",
820
- " of the company and its culture.\n",
821
- " \"\"\"\n",
822
  "\n",
823
- " about: Optional[str] = Field(\n",
824
- " None, \n",
825
- " description=\"\"\"Brief description of the company, its industry, products, services, \n",
826
- " and any notable achievements or differentiators\"\"\"\n",
827
- " )\n",
828
  "\n",
829
- " mission_and_values: Optional[str] = Field(\n",
830
- " None,\n",
831
- " description=\"\"\"Company mission, vision, values, and culture, including commitments \n",
832
- " to diversity, inclusion, social responsibility, and work-life balance\"\"\"\n",
833
- " )\n",
834
  " \n",
835
- " size: Optional[str] = Field(\n",
836
- " None,\n",
837
- " description=\"Details about company size, such as number of employees\")\n",
838
  " \n",
839
- " locations: Optional[str] = Field(\n",
840
- " None,\n",
841
- " description=\"\"\"Geographic presence of the company, including headquarters, \n",
842
- " offices, and any remote work options\"\"\"\n",
843
- " )\n",
844
  " \n",
845
- " city: Optional[str] = Field(None, description=\"City where the company is located\")\n",
846
  " \n",
847
- " state: Optional[str] = Field(None, description=\"State where the company is located\")\n",
848
  "\n",
849
  "\n",
850
- "class RoleSummary(BaseModel):\n",
851
- " \"\"\"\n",
852
- " A model for capturing the key summary points about the job role.\n",
853
  " \n",
854
- " Extract the essential high-level details about the role from the job description,\n",
855
- " such as the job title, the team or department the role belongs to, the role type, \n",
856
- " and any remote work options.\n",
857
  " \n",
858
- " Prioritize information that helps understand the overall scope and positioning \n",
859
- " of the role within the company.\n",
860
- " \"\"\"\n",
861
  " \n",
862
- " title: str = Field(..., description=\"Title of the job role\")\n",
863
  " \n",
864
- " team_or_department: Optional[str] = Field(\n",
865
- " None,\n",
866
- " description=\"\"\"Team, department, or business unit the role belongs to, \n",
867
- " including any collaborations with other teams\"\"\"\n",
868
- " )\n",
869
  " \n",
870
- " role_type: Optional[str] = Field(\n",
871
- " None,\n",
872
- " description=\"Type of role (full-time, part-time, contract, etc.)\"\n",
873
- " )\n",
874
  " \n",
875
- " remote: Optional[str] = Field(\n",
876
- " None,\n",
877
- " description=\"Remote work options for the role (full, hybrid, none)\"\n",
878
- " )\n",
879
  "\n",
880
- "class ResponsibilitiesAndQualifications(BaseModel):\n",
881
- " \"\"\"\n",
882
- " A model for capturing the key responsibilities, requirements, and preferred \n",
883
- " qualifications for the job role.\n",
884
  "\n",
885
- " Extract the essential duties and expectations of the role, the mandatory \n",
886
- " educational background and experience required, and any additional skills \n",
887
- " or characteristics that are desirable but not strictly necessary.\n",
888
  "\n",
889
- " The goal is to provide a clear and comprehensive picture of what the role \n",
890
- " entails and what qualifications the ideal candidate should possess.\n",
891
- " \"\"\"\n",
892
  "\n",
893
- " responsibilities: List[str] = Field(\n",
894
- " description=\"\"\"The core duties, tasks, and expectations of the role, encompassing \n",
895
- " areas such as metrics, theories, business understanding, product \n",
896
- " direction, systems, leadership, decision making, strategy, and \n",
897
- " collaboration, as described in the job description\"\"\"\n",
898
- " )\n",
899
  "\n",
900
- " required_qualifications: List[str] = Field(\n",
901
- " description=\"\"\"The essential educational qualifications (e.g., Doctorate, \n",
902
- " Master's, Bachelor's degrees in specific fields) and years of \n",
903
- " relevant professional experience that are mandatory for the role, \n",
904
- " including any alternative acceptable combinations of education \n",
905
- " and experience, as specified in the job description\"\"\"\n",
906
- " )\n",
907
  " \n",
908
- " preferred_qualifications: List[str] = Field(\n",
909
- " description=\"\"\"Any additional skills, experiences, characteristics, or domain \n",
910
- " expertise that are valuable for the role but not absolute \n",
911
- " requirements, such as proficiency with specific tools/technologies, \n",
912
- " relevant soft skills, problem solving abilities, and industry \n",
913
- " knowledge, as mentioned in the job description as preferred or \n",
914
- " nice-to-have qualifications\"\"\"\n",
915
- " )\n",
916
  " \n",
917
- "class CompensationAndBenefits(BaseModel):\n",
918
- " \"\"\"\n",
919
- " A model for capturing the compensation and benefits package for the job role.\n",
920
  " \n",
921
- " Extract details about the salary or pay range, bonus and equity compensation, \n",
922
- " benefits, and perks from the job description.\n",
923
  " \n",
924
- " Aim to provide a comprehensive view of the total rewards offered for the role,\n",
925
- " including both monetary compensation and non-monetary benefits and perks.\n",
926
- " \"\"\"\n",
927
  " \n",
928
- " salary_or_pay_range: Optional[str] = Field(\n",
929
- " None,\n",
930
- " description=\"\"\"The salary range or hourly pay range for the role, including \n",
931
- " any specific numbers or bands mentioned in the job description\"\"\"\n",
932
- " )\n",
933
  " \n",
934
- " bonus_and_equity: Optional[str] = Field(\n",
935
- " None,\n",
936
- " description=\"\"\"Any information about bonus compensation, such as signing bonuses, \n",
937
- " annual performance bonuses, or other incentives, as well as details \n",
938
- " about equity compensation like stock options or RSUs\"\"\"\n",
939
- " )\n",
940
  " \n",
941
- " benefits: Optional[List[str]] = Field(\n",
942
- " None,\n",
943
- " description=\"\"\"A list of benefits offered for the role, such as health insurance, \n",
944
- " dental and vision coverage, retirement plans (401k, pension), paid \n",
945
- " time off (vacation, sick days, holidays), parental leave, and any \n",
946
- " other standard benefits mentioned in the job description\"\"\"\n",
947
- " )\n",
948
  " \n",
949
- " perks: Optional[List[str]] = Field(\n",
950
- " None,\n",
951
- " description=\"\"\"A list of additional perks and amenities offered, such as free food \n",
952
- " or snacks, commuter benefits, wellness programs, learning and development \n",
953
- " stipends, employee discounts, or any other unique perks the company \n",
954
- " provides to its employees, as mentioned in the job description\"\"\"\n",
955
- " )\n",
956
  "\n",
957
- "class JobDescription(BaseModel):\n",
958
- " \"\"\"Extracted information from a job description.\"\"\"\n",
959
- " company_overview: CompanyOverview\n",
960
- " role_summary: RoleSummary\n",
961
- " responsibilities_and_qualifications: ResponsibilitiesAndQualifications\n",
962
- " compensation_and_benefits: CompensationAndBenefits"
 
 
 
 
 
 
 
 
 
 
 
 
963
  ]
964
  },
965
  {
@@ -1022,38 +1046,11 @@
1022
  " The structured data you extract will be used for further analysis and insights downstream, so err on the side of including more information rather than less. The key is to make the unstructured job description data more organized and manageable while still retaining all the important details.\n",
1023
  " \"\"\",\n",
1024
  " ),\n",
1025
- " # MessagesPlaceholder('examples'), # Keep on reading through this use case to see how to use examples to improve performance\n",
1026
  " (\"human\", \"{text}\"),\n",
1027
  " ]\n",
1028
  ")"
1029
  ]
1030
  },
1031
- {
1032
- "cell_type": "code",
1033
- "execution_count": 39,
1034
- "metadata": {},
1035
- "outputs": [],
1036
- "source": [
1037
- "from langchain_community.chat_models import ChatPerplexity"
1038
- ]
1039
- },
1040
- {
1041
- "cell_type": "code",
1042
- "execution_count": null,
1043
- "metadata": {},
1044
- "outputs": [],
1045
- "source": []
1046
- },
1047
- {
1048
- "cell_type": "code",
1049
- "execution_count": 43,
1050
- "metadata": {},
1051
- "outputs": [],
1052
- "source": [
1053
- "llm = ChatGroq(model_name=\"llama3-70b-8192\")\n",
1054
- "# llm = ChatPerplexity(pplx_api_key=os.getenv('PPLX_API_KEY'), model='llama-3-70b-instruct')"
1055
- ]
1056
- },
1057
  {
1058
  "cell_type": "code",
1059
  "execution_count": 44,
@@ -1069,6 +1066,8 @@
1069
  }
1070
  ],
1071
  "source": [
 
 
1072
  "extractor = prompt | llm.with_structured_output(\n",
1073
  " schema=JobDescription,\n",
1074
  " method=\"function_calling\",\n",
@@ -1085,26 +1084,6 @@
1085
  "test_description = title_company['description'][2]"
1086
  ]
1087
  },
1088
- {
1089
- "cell_type": "code",
1090
- "execution_count": 156,
1091
- "metadata": {},
1092
- "outputs": [
1093
- {
1094
- "data": {
1095
- "text/plain": [
1096
- "\"The Search + Distribution (S+D) team is the leading applied artificial intelligence team at Microsoft responsible for delivering the quality experience to over 500M+ monthly active users around the world in Microsoft’s search engine, Bing. Our responsibilities include delivering competitive search results, differentiated experiences, and product and business growth. We are constantly applying the... latest state of the art AI technologies to our product and also transferring this technology to other groups across the company.\\n\\nWe sre seeking experienced data scientist to solve cutting-edge metrics and measurement problems in the space of Search, and lead cross-team initiatives. We believe metrics play a key role in executing on the strategy for building the final product.\\n\\nA critical part of the role is to advance our A/B experimentation capabilities for Bing and Microsoft Copilot by introducing advanced, powerful functionality at very large scale to eventually increase experimenter agility and depth of insights, and reduce infrastructure cost through smart design of data structures and computation methods. The role requires not only skills in data science, but also knowledge in data engineering and systems.\\n\\nYou will work closely with multiple teams across S+D and beyond to build a measurement strategy and roadmap towards measuring how relevant, fresh, and authoritative our results are while being strategically differentiated from our biggest competitors. We expect you to work with Microsoft Research and the rest of academia to unravel complex problems in our products and push the limits of what AI can do for our customers. The world needs credible alternatives to find authoritative information on the web, so there is social responsibility.\\n\\nThis Principal Data Scientist position is a very strategic position part of the S+D Bing Metrics and Analytics team. S+D itself is part of the broader Windows and Web Experiences Team (WWE) and this position will collaborate with and influence other data science and metrics groups in WWE such as Edge, MS Start, Maps, Bing Ads and more. If you are passionate about working on the latest and hottest areas that will help you develop skills in Artificial Intelligence, Machine Learning, data science, scale systems, UX, and product growth, this is the team you’re looking for!\\n\\nMicrosoft’s mission is to empower every person and every organization on the planet to achieve more. As employees we come together with a growth mindset, innovate to empower others, and collaborate to realize our shared goals. Each day we build on our values of respect, integrity, and accountability to create a culture of inclusion where everyone can thrive at work and beyond. In alignment with our Microsoft values, we are committed to cultivating an inclusive work environment for all employees to positively impact our culture every day.\\n\\nResponsibilities\\n• Define, invent, and deliver online and offline behavioral and human labeled metrics which accurately measure the satisfaction and success of our customers interacting with Search.\\n• Apply behavioral game theory and social science understanding to get the quality work out of crowd workers from around the world\\n• Develop deep understanding of business metrics such as daily active users, query share, click share and query volume across all the relevant entry points\\n• Influence the product and business direction through metrics analyses\\n• Define and build systems and policies to ensure quality, stable, and performant code\\n• Lead a team through analysis, design and code review that guarantee analysis and code quality and allow more junior members to learn and grow their expertise while helping the team build an inclusive interdisciplinary culture where everyone can do their best work\\n• Make independent decisions for the team and handle difficult tradeoffs\\n• Translate strategy into plans that are clear and measurable, with progress shared out monthly to stakeholders\\n• Partner effectively with program management, engineers, finance, marketing, exec management, and other areas of the business\\n\\nQualifications\\n\\nRequired Qualifications:\\n• Doctorate in Data Science, Mathematics, Statistics, Econometrics, Economics, Operations Research, Computer Science, or related field AND 5+ year(s) data-science experience (e.g., managing structured and unstructured data, applying statistical techniques and reporting results)\\n• OR Master's Degree in Data Science, Mathematics, Statistics, Econometrics, Economics, Operations Research, Computer Science, or related field AND 7+ years data-science experience (e.g., managing structured and unstructured data, applying statistical techniques and reporting results)\\n• OR Bachelor's Degree in Data Science, Mathematics, Statistics, Econometrics, Economics, Operations Research, Computer Science, or related field AND 10+ years data-science experience (e.g., managing structured and unstructured data, applying statistical techniques and reporting results)\\n• OR equivalent experience.\\n\\nPreferred Qualifications:\\n• 6+ years of experience coding in Python, C++, C#, C or Java.\\n• Customer focused, strategic, drives for results, is self-motivated, and has a propensity for action.\\n• Organizational, analytical, data science skills and intuition.\\n• Problem solver: ability to solve problems that the world has not solved before\\n• Interpersonal skills: cross-group and cross-culture collaboration.\\n• Experience with real world system building and data collection, including design, coding and evaluation.\\n\\nData Science IC5 - The typical base pay range for this role across the U.S. is USD $133,600 - $256,800 per year. There is a different range applicable to specific work locations, within the San Francisco Bay area and New York City metropolitan area, and the base pay range for this role in those locations is USD $173,200 - $282,200 per year.\\n\\nCertain roles may be eligible for benefits and other compensation. Find additional benefits and pay information here: https://careers.microsoft.com/us/en/us-corporate-pay\\n\\n#WWE# #SearchDistribution# #Bing#\\n\\nMicrosoft is an equal opportunity employer. Consistent with applicable law, all qualified applicants will receive consideration for employment without regard to age, ancestry, citizenship, color, family or medical care leave, gender identity or expression, genetic information, immigration status, marital status, medical condition, national origin, physical or mental disability, political affiliation, protected veteran or military status, race, ethnicity, religion, sex (including pregnancy), sexual orientation, or any other characteristic protected by applicable local laws, regulations and ordinances. If you need assistance and/or a reasonable accommodation due to a disability during the application process, read more about requesting accommodations\""
1097
- ]
1098
- },
1099
- "execution_count": 156,
1100
- "metadata": {},
1101
- "output_type": "execute_result"
1102
- }
1103
- ],
1104
- "source": [
1105
- "test_description"
1106
- ]
1107
- },
1108
  {
1109
  "cell_type": "code",
1110
  "execution_count": 157,
 
101
  "outputs": [],
102
  "source": [
103
  "import pandas as pd\n",
 
104
  "import sqlite3\n",
105
  "import datetime as dt\n",
106
  "import http.client\n",
107
  "import json\n",
 
108
  "import urllib.parse\n",
109
  "import os\n",
110
  "from sqlalchemy import create_engine\n",
 
278
  "main(job_list, simple_city_state_list)"
279
  ]
280
  },
281
+ {
282
+ "cell_type": "code",
283
+ "execution_count": null,
284
+ "metadata": {},
285
+ "outputs": [],
286
+ "source": []
287
+ },
288
+ {
289
+ "cell_type": "code",
290
+ "execution_count": null,
291
+ "metadata": {},
292
+ "outputs": [],
293
+ "source": []
294
+ },
295
  {
296
  "cell_type": "markdown",
297
  "metadata": {},
 
817
  "metadata": {},
818
  "outputs": [],
819
  "source": [
820
+ "# from typing import List, Optional\n",
821
+ "# from langchain_core.pydantic_v1 import BaseModel, Field\n",
822
  "\n",
823
+ "# class CompanyOverview(BaseModel):\n",
824
+ "# \"\"\"\n",
825
+ "# A model for capturing key information about the company offering the job.\n",
826
  " \n",
827
+ "# Extract relevant details about the company from the job description, \n",
828
+ "# including a brief overview of its industry and products, its mission and \n",
829
+ "# values, size, and location(s).\n",
830
  " \n",
831
+ "# Focus on capturing the most salient points that give a well-rounded picture\n",
832
+ "# of the company and its culture.\n",
833
+ "# \"\"\"\n",
834
  "\n",
835
+ "# about: Optional[str] = Field(\n",
836
+ "# None, \n",
837
+ "# description=\"\"\"Brief description of the company, its industry, products, services, \n",
838
+ "# and any notable achievements or differentiators\"\"\"\n",
839
+ "# )\n",
840
  "\n",
841
+ "# mission_and_values: Optional[str] = Field(\n",
842
+ "# None,\n",
843
+ "# description=\"\"\"Company mission, vision, values, and culture, including commitments \n",
844
+ "# to diversity, inclusion, social responsibility, and work-life balance\"\"\"\n",
845
+ "# )\n",
846
  " \n",
847
+ "# size: Optional[str] = Field(\n",
848
+ "# None,\n",
849
+ "# description=\"Details about company size, such as number of employees\")\n",
850
  " \n",
851
+ "# locations: Optional[str] = Field(\n",
852
+ "# None,\n",
853
+ "# description=\"\"\"Geographic presence of the company, including headquarters, \n",
854
+ "# offices, and any remote work options\"\"\"\n",
855
+ "# )\n",
856
  " \n",
857
+ "# city: Optional[str] = Field(None, description=\"City where the company is located\")\n",
858
  " \n",
859
+ "# state: Optional[str] = Field(None, description=\"State where the company is located\")\n",
860
  "\n",
861
  "\n",
862
+ "# class RoleSummary(BaseModel):\n",
863
+ "# \"\"\"\n",
864
+ "# A model for capturing the key summary points about the job role.\n",
865
  " \n",
866
+ "# Extract the essential high-level details about the role from the job description,\n",
867
+ "# such as the job title, the team or department the role belongs to, the role type, \n",
868
+ "# and any remote work options.\n",
869
  " \n",
870
+ "# Prioritize information that helps understand the overall scope and positioning \n",
871
+ "# of the role within the company.\n",
872
+ "# \"\"\"\n",
873
  " \n",
874
+ "# title: str = Field(..., description=\"Title of the job role\")\n",
875
  " \n",
876
+ "# team_or_department: Optional[str] = Field(\n",
877
+ "# None,\n",
878
+ "# description=\"\"\"Team, department, or business unit the role belongs to, \n",
879
+ "# including any collaborations with other teams\"\"\"\n",
880
+ "# )\n",
881
  " \n",
882
+ "# role_type: Optional[str] = Field(\n",
883
+ "# None,\n",
884
+ "# description=\"Type of role (full-time, part-time, contract, etc.)\"\n",
885
+ "# )\n",
886
  " \n",
887
+ "# remote: Optional[str] = Field(\n",
888
+ "# None,\n",
889
+ "# description=\"Remote work options for the role (full, hybrid, none)\"\n",
890
+ "# )\n",
891
  "\n",
892
+ "# class ResponsibilitiesAndQualifications(BaseModel):\n",
893
+ "# \"\"\"\n",
894
+ "# A model for capturing the key responsibilities, requirements, and preferred \n",
895
+ "# qualifications for the job role.\n",
896
  "\n",
897
+ "# Extract the essential duties and expectations of the role, the mandatory \n",
898
+ "# educational background and experience required, and any additional skills \n",
899
+ "# or characteristics that are desirable but not strictly necessary.\n",
900
  "\n",
901
+ "# The goal is to provide a clear and comprehensive picture of what the role \n",
902
+ "# entails and what qualifications the ideal candidate should possess.\n",
903
+ "# \"\"\"\n",
904
  "\n",
905
+ "# responsibilities: List[str] = Field(\n",
906
+ "# description=\"\"\"The core duties, tasks, and expectations of the role, encompassing \n",
907
+ "# areas such as metrics, theories, business understanding, product \n",
908
+ "# direction, systems, leadership, decision making, strategy, and \n",
909
+ "# collaboration, as described in the job description\"\"\"\n",
910
+ "# )\n",
911
  "\n",
912
+ "# required_qualifications: List[str] = Field(\n",
913
+ "# description=\"\"\"The essential educational qualifications (e.g., Doctorate, \n",
914
+ "# Master's, Bachelor's degrees in specific fields) and years of \n",
915
+ "# relevant professional experience that are mandatory for the role, \n",
916
+ "# including any alternative acceptable combinations of education \n",
917
+ "# and experience, as specified in the job description\"\"\"\n",
918
+ "# )\n",
919
  " \n",
920
+ "# preferred_qualifications: List[str] = Field(\n",
921
+ "# description=\"\"\"Any additional skills, experiences, characteristics, or domain \n",
922
+ "# expertise that are valuable for the role but not absolute \n",
923
+ "# requirements, such as proficiency with specific tools/technologies, \n",
924
+ "# relevant soft skills, problem solving abilities, and industry \n",
925
+ "# knowledge, as mentioned in the job description as preferred or \n",
926
+ "# nice-to-have qualifications\"\"\"\n",
927
+ "# )\n",
928
  " \n",
929
+ "# class CompensationAndBenefits(BaseModel):\n",
930
+ "# \"\"\"\n",
931
+ "# A model for capturing the compensation and benefits package for the job role.\n",
932
  " \n",
933
+ "# Extract details about the salary or pay range, bonus and equity compensation, \n",
934
+ "# benefits, and perks from the job description.\n",
935
  " \n",
936
+ "# Aim to provide a comprehensive view of the total rewards offered for the role,\n",
937
+ "# including both monetary compensation and non-monetary benefits and perks.\n",
938
+ "# \"\"\"\n",
939
  " \n",
940
+ "# salary_or_pay_range: Optional[str] = Field(\n",
941
+ "# None,\n",
942
+ "# description=\"\"\"The salary range or hourly pay range for the role, including \n",
943
+ "# any specific numbers or bands mentioned in the job description\"\"\"\n",
944
+ "# )\n",
945
  " \n",
946
+ "# bonus_and_equity: Optional[str] = Field(\n",
947
+ "# None,\n",
948
+ "# description=\"\"\"Any information about bonus compensation, such as signing bonuses, \n",
949
+ "# annual performance bonuses, or other incentives, as well as details \n",
950
+ "# about equity compensation like stock options or RSUs\"\"\"\n",
951
+ "# )\n",
952
  " \n",
953
+ "# benefits: Optional[List[str]] = Field(\n",
954
+ "# None,\n",
955
+ "# description=\"\"\"A list of benefits offered for the role, such as health insurance, \n",
956
+ "# dental and vision coverage, retirement plans (401k, pension), paid \n",
957
+ "# time off (vacation, sick days, holidays), parental leave, and any \n",
958
+ "# other standard benefits mentioned in the job description\"\"\"\n",
959
+ "# )\n",
960
  " \n",
961
+ "# perks: Optional[List[str]] = Field(\n",
962
+ "# None,\n",
963
+ "# description=\"\"\"A list of additional perks and amenities offered, such as free food \n",
964
+ "# or snacks, commuter benefits, wellness programs, learning and development \n",
965
+ "# stipends, employee discounts, or any other unique perks the company \n",
966
+ "# provides to its employees, as mentioned in the job description\"\"\"\n",
967
+ "# )\n",
968
  "\n",
969
+ "# class JobDescription(BaseModel):\n",
970
+ "# \"\"\"Extracted information from a job description.\"\"\"\n",
971
+ "# company_overview: CompanyOverview\n",
972
+ "# role_summary: RoleSummary\n",
973
+ "# responsibilities_and_qualifications: ResponsibilitiesAndQualifications\n",
974
+ "# compensation_and_benefits: CompensationAndBenefits"
975
+ ]
976
+ },
977
+ {
978
+ "cell_type": "code",
979
+ "execution_count": null,
980
+ "metadata": {},
981
+ "outputs": [],
982
+ "source": [
983
+ "import sys\n",
984
+ "sys.path.append('../utils')\n",
985
+ "\n",
986
+ "from job_desc_pydantic import JobDescription"
987
  ]
988
  },
989
  {
 
1046
  " The structured data you extract will be used for further analysis and insights downstream, so err on the side of including more information rather than less. The key is to make the unstructured job description data more organized and manageable while still retaining all the important details.\n",
1047
  " \"\"\",\n",
1048
  " ),\n",
 
1049
  " (\"human\", \"{text}\"),\n",
1050
  " ]\n",
1051
  ")"
1052
  ]
1053
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1054
  {
1055
  "cell_type": "code",
1056
  "execution_count": 44,
 
1066
  }
1067
  ],
1068
  "source": [
1069
+ "llm = ChatGroq(model_name=\"llama3-70b-8192\")\n",
1070
+ "\n",
1071
  "extractor = prompt | llm.with_structured_output(\n",
1072
  " schema=JobDescription,\n",
1073
  " method=\"function_calling\",\n",
 
1084
  "test_description = title_company['description'][2]"
1085
  ]
1086
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1087
  {
1088
  "cell_type": "code",
1089
  "execution_count": 157,
requirements.txt ADDED
File without changes
streamlit_app.py ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from dotenv import load_dotenv
2
+ import os
3
+ import streamlit as st
4
+ import time
5
+
6
+ from langchain_anthropic import ChatAnthropic
7
+ from langchain_openai import ChatOpenAI
8
+ from langchain_groq import ChatGroq
9
+ from utils import parse_description
10
+
11
+
12
+ # Setting up the environment variables for LangSmith tracing
13
+ os.environ['LANGCHAIN_TRACING_V2'] = 'true'
14
+ os.environ['LANGCHAIN_PROJECT'] = 'Resume_Project'
15
+
16
+ st.set_page_config(layout="wide")
17
+
18
+ st.title("Job Description Parser")
19
+
20
+ col1, col2 = st.columns([1,6])
21
+
22
+ with col1:
23
+ st.image("images/jobDetailExtractor3part.png", use_column_width=True)
24
+
25
+ with col2:
26
+ st.write("""
27
+ Welcome to the Job Description Parser, a revolutionary tool designed to extract structured information from job descriptions using the magic of advanced Language Models (LLMs)! 🪄📄
28
+
29
+ Our team of data scientists and military veterans is on a mission to revolutionize the way you approach your job search and resume optimization. By leveraging the power of LLMs, we've created a game-changing tool that will give you the inside scoop on what employers are really looking for in data-related roles. 💡
30
+
31
+ Our goal is to build a comprehensive database of job descriptions for various data-related positions, including Data Scientist 🔬, Data Engineer ⚙️, Data Analyst 📈, Machine Learning Engineer 🤖, and more! 💼 But we're not just collecting job postings – we're taking it to the next level! Our cutting-edge LLM will parse each job description and extract key information, giving you unparalleled insights into what skills, experiences, and qualities are most sought-after in the industry. 🔍
32
+
33
+ We've designed a robust system using Pydantic models to capture and structure the most important aspects of each job description, including company overview, role summary, responsibilities and qualifications, and compensation and benefits. 💰
34
+
35
+ With this wealth of information at your fingertips, you'll be able to tailor your resume and interview responses to perfectly match what employers are looking for! 🎯
36
+
37
+ In the near future, we'll be adding even more powerful features to help you land your dream data job, such as automatically categorizing job descriptions based on key characteristics, providing personalized resume suggestions based on your target roles, and offering insider tips and strategies for acing data job interviews. 🔮
38
+
39
+ We believe in the power of community and collaboration, so if you're passionate about data careers and want to contribute to this project, we'd love to have you on board! 🤝
40
+
41
+ Upload a job description, select your models, and watch the magic happen. 🎩✨ Let's unlock the full potential of LLMs together and make job description parsing a breeze! 😎
42
+ """)
43
+
44
+ llm_dict = {
45
+ "GPT 3.5 turbo": ChatOpenAI(temperature=0, model_name="gpt-3.5-turbo"),
46
+ "Anthropic Sonnet": ChatAnthropic(model_name="claude-3-sonnet-20240229"),
47
+ "Llama 3 8b": ChatGroq(model_name="llama3-8b-8192"),
48
+ "Llama 3 70b": ChatGroq(model_name="llama3-70b-8192"),
49
+ "Gemma 7b": ChatGroq(model_name="gemma-7b-it"),
50
+ "Mixtral 8x7b": ChatGroq(model_name="mixtral-8x7b-32768"),
51
+ # "Gemini 1.5 Pro": ChatGoogleGenerativeAI(model_name="gemini-1.5-pro-latest"),
52
+ }
53
+
54
+ col1, col2 = st.columns(2)
55
+
56
+ with col1:
57
+ job_description = st.text_area("Enter the job description")
58
+ extract_button = st.button("Extract Fields from Description")
59
+
60
+ if extract_button and job_description:
61
+ with col2:
62
+ start_time = time.time()
63
+ extracted_fields = parse_description.extract_desc_fields(job_description)
64
+ end_time = time.time()
65
+ elapsed_time = end_time - start_time
66
+ st.write(f"Extraction completed in {elapsed_time:.2f} seconds")
67
+
68
+ try:
69
+ if extracted_fields.company_overview:
70
+ st.write("## Company Overview")
71
+ st.write(extracted_fields.company_overview.about)
72
+ st.write(extracted_fields.company_overview.mission_and_values)
73
+ st.write(f"Size: {extracted_fields.company_overview.size}")
74
+ st.write(f"Locations: {extracted_fields.company_overview.locations}")
75
+ st.write(f"City: {extracted_fields.company_overview.city}")
76
+ st.write(f"State: {extracted_fields.company_overview.state}")
77
+
78
+ if extracted_fields.role_summary:
79
+ st.write("## Role Summary")
80
+ st.write(f"Title: {extracted_fields.role_summary.title}")
81
+ st.write(f"Team or Department: {extracted_fields.role_summary.team_or_department}")
82
+ st.write(f"Role Type: {extracted_fields.role_summary.role_type}")
83
+ st.write(f"Remote: {extracted_fields.role_summary.remote}")
84
+
85
+ if extracted_fields.responsibilities_and_qualifications:
86
+ st.write("## Responsibilities and Qualifications")
87
+ st.write("### Responsibilities")
88
+ for responsibility in extracted_fields.responsibilities_and_qualifications.responsibilities:
89
+ st.write(f"- {responsibility}")
90
+
91
+ st.write("### Required Qualifications")
92
+ for qualification in extracted_fields.responsibilities_and_qualifications.required_qualifications:
93
+ st.write(f"- {qualification}")
94
+
95
+ st.write("### Preferred Qualifications")
96
+ for qualification in extracted_fields.responsibilities_and_qualifications.preferred_qualifications:
97
+ st.write(f"- {qualification}")
98
+
99
+ if extracted_fields.compensation_and_benefits:
100
+ st.write("## Compensation and Benefits")
101
+ st.write(f"Salary or Pay Range: {extracted_fields.compensation_and_benefits.salary_or_pay_range}")
102
+ st.write(f"Bonus and Equity: {extracted_fields.compensation_and_benefits.bonus_and_equity}")
103
+ st.write("### Benefits")
104
+ for benefit in extracted_fields.compensation_and_benefits.benefits:
105
+ st.write(f"- {benefit}")
106
+ st.write("### Perks")
107
+ for perk in extracted_fields.compensation_and_benefits.perks:
108
+ st.write(f"- {perk}")
109
+
110
+ except Exception as e:
111
+ st.write(f"An error occurred: {e}")
utils/__init__.py ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ from dotenv import load_dotenv
2
+ load_dotenv()
utils/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (271 Bytes). View file
 
utils/__pycache__/job_desc_pydantic.cpython-311.pyc ADDED
Binary file (8.72 kB). View file
 
utils/__pycache__/parse_description.cpython-311.pyc ADDED
Binary file (3.53 kB). View file
 
google_jobs.py → utils/google_jobs.py RENAMED
@@ -1,10 +1,7 @@
1
  import pandas as pd
2
- # from serpapi import GoogleSearch
3
- import sqlite3
4
  import datetime as dt
5
  import http.client
6
  import json
7
- import config
8
  import urllib.parse
9
  import os
10
  from sqlalchemy import create_engine
 
1
  import pandas as pd
 
 
2
  import datetime as dt
3
  import http.client
4
  import json
 
5
  import urllib.parse
6
  import os
7
  from sqlalchemy import create_engine
job_desc_pydantic.py → utils/job_desc_pydantic.py RENAMED
File without changes
utils/parse_description.py ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from typing import List, Optional
2
+
3
+ from langchain.chains import create_structured_output_runnable
4
+ from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
5
+ from langchain_core.pydantic_v1 import BaseModel, Field
6
+
7
+ from langchain_groq import ChatGroq
8
+ from dotenv import load_dotenv
9
+ import os
10
+
11
+ from utils.job_desc_pydantic import JobDescription
12
+
13
+ load_dotenv()
14
+
15
+
16
+
17
+ def extract_desc_fields(raw_job_description):
18
+ prompt = ChatPromptTemplate.from_messages(
19
+ [
20
+ (
21
+ "system",
22
+ """You are an expert at identifying key aspects of job descriptions. Your task is to extract important information from a raw job description and organize it into a structured format using the ResponsibilitiesAndQualifications class.
23
+
24
+ When parsing the job description, your goal is to capture as much relevant information as possible in the appropriate fields of the class. This includes:
25
+
26
+ 1. All key responsibilities and duties of the role, covering the full range of tasks and expectations.
27
+ 2. The required educational qualifications and years of experience, including different acceptable combinations.
28
+ 3. Any additional preferred skills, experiences, and characteristics that are desirable for the role.
29
+
30
+ Avoid summarizing or paraphrasing the information. Instead, extract the details as closely as possible to how they appear in the original job description. The aim is to organize and structure the raw data, not to condense or interpret it.
31
+
32
+ Some specific things to look out for:
33
+ - Responsibilities related to metrics, theories, business understanding, product direction, systems, leadership, decision making, strategy, and collaboration
34
+ - Required degrees (Doctorate, Master's, Bachelor's) in relevant fields, along with the corresponding years of experience
35
+ - Preferred qualifications like years of coding experience, soft skills, problem solving abilities, and domain expertise
36
+
37
+ If any of these details are missing from the job description, simply omit them from the output rather than trying to infer or fill in the gaps.
38
+
39
+ The structured data you extract will be used for further analysis and insights downstream, so err on the side of including more information rather than less. The key is to make the unstructured job description data more organized and manageable while still retaining all the important details.
40
+ """,
41
+ ),
42
+ ("human", "{text}"),
43
+ ]
44
+ )
45
+
46
+ llm = ChatGroq(model_name="llama3-70b-8192")
47
+
48
+ extractor = prompt | llm.with_structured_output(
49
+ schema=JobDescription,
50
+ method="function_calling",
51
+ include_raw=False,
52
+ )
53
+
54
+ return extractor.invoke(raw_job_description)