diff --git a/TalentLLM-main/.gitignore b/TalentLLM-main/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..c0887b35df24ad8e1ccf4dccd3579917a1741bfb --- /dev/null +++ b/TalentLLM-main/.gitignore @@ -0,0 +1,2 @@ +service_creds.json +.env \ No newline at end of file diff --git a/TalentLLM-main/.vscode/launch.json b/TalentLLM-main/.vscode/launch.json new file mode 100644 index 0000000000000000000000000000000000000000..325838697c495b094e757fae128730f23fb8b083 --- /dev/null +++ b/TalentLLM-main/.vscode/launch.json @@ -0,0 +1,16 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Python: Current File (pdb)", + "type": "python", + "request": "launch", + "program": "${file}", + "console": "integratedTerminal", + "python": "python3.11", + "cwd": "${workspaceFolder}", + "env": {}, + "internalConsoleOptions": "neverOpen" + } + ] +} diff --git a/TalentLLM-main/Candidate.py b/TalentLLM-main/Candidate.py new file mode 100644 index 0000000000000000000000000000000000000000..0850457b412c6309a43daaa7e553eb019b1486bb --- /dev/null +++ b/TalentLLM-main/Candidate.py @@ -0,0 +1,103 @@ +from typing import Optional +import gdown +import os +from datetime import datetime # Importing the datetime class directly +from gh import getBasicReport +from mathpix import extract_text +from pathlib import Path +class JobCandidate: + def __init__(self, data: list): + self.timestamp = datetime.strptime(data[0], "%m/%d/%Y %H:%M:%S") + self.name = data[1] + self.email = data[2] + self.resume_link = data[3] + self.resume_text= self.parse_resume() + self.cover_letter = data[4] + self.linkedin = data[5] + self.github_link = data[6] + self.github_text= self.parse_gh() + self.personal_website_link = data[7] + self.visa_sponsorship = data[8] + self.disability_status = data[9] + self.ethnic_background = data[10] + self.gender = data[11] + self.military_service = data[12] + + def __str__(self): + return (f"Job Candidate: {self.name}\n" + f"Applied on: {self.timestamp}\n" + f"Email: {self.email}\n" + f"Resume {self.resume_text}\n" + f"Personal Website: {self.personal_website_link}\n" + f"Visa Sponsorship: {self.visa_sponsorship}\n" + f"Disability Status: {self.disability_status}\n" + f"Ethnic Background: {self.ethnic_background}\n" + f"Gender: {self.gender}\n" + f"Military Service: {self.military_service}") + + def parse_resume(self): + id = self.resume_link.split('=')[-1] + pdf_dir = os.path.join(os.getcwd(), "resume_pdfs") + mmd_dir = os.path.join(os.getcwd(), "resume_mmds") + + # Ensure the directories exist + if not os.path.exists(pdf_dir): + os.makedirs(pdf_dir) + if not os.path.exists(mmd_dir): + os.makedirs(mmd_dir) + + pdf_path = os.path.join(pdf_dir, f"{self.email}.pdf") + mmd_path = os.path.join(mmd_dir, f"{self.email}.pdf.mmd") + + try: + # Check if the parsed text already exists + if os.path.exists(mmd_path): + with open(mmd_path, "r") as f: + return f.read() + else: + # Download the PDF + gdown.download(id=id, quiet=True, use_cookies=False, output=pdf_path) + + # Check if the download was successful + if os.path.exists(pdf_path): + t = extract_text(pdf_path) + preproccessed = t.replace(self.name, "applicant") + preprocessed = preproccessed.replace(self.name.split(" ")[0], "applicant") + return preprocessed + else: + return "Failed to download the PDF." + except Exception as e: + return str(e) + + + + def parse_gh(self): + username = self.github_link.replace("https://github.com/", "").replace("github.com", "").replace("/", "") + + summary="" + if username: + file_path = Path(os.getcwd()) / "gh_cache" / f"{username}.md" + if not file_path.exists(): + summary = str(getBasicReport(username)) + # Write the summary to the file + file_path.write_text(summary) + else: + summary = open(file_path,"r").read() + return summary + else: + return "" + def parse_portfolio(self): + pass + + + + + + + def __lt__(self, other): + if not isinstance(other, JobCandidate): + return NotImplemented + return self.timestamp < other.timestamp + + def __eq__(self, other): + return False \ No newline at end of file diff --git a/TalentLLM-main/__pycache__/Candidate.cpython-311.pyc b/TalentLLM-main/__pycache__/Candidate.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b2e9e35e5337406c214dd168e8c92f725a520716 Binary files /dev/null and b/TalentLLM-main/__pycache__/Candidate.cpython-311.pyc differ diff --git a/TalentLLM-main/__pycache__/claude_compator.cpython-311.pyc b/TalentLLM-main/__pycache__/claude_compator.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d9739372074a5fb1f0ec3ce6df5d25cb6ad740c2 Binary files /dev/null and b/TalentLLM-main/__pycache__/claude_compator.cpython-311.pyc differ diff --git a/TalentLLM-main/__pycache__/compator.cpython-311.pyc b/TalentLLM-main/__pycache__/compator.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..fcbc5e3688543f214d3b429949a4315da882abe8 Binary files /dev/null and b/TalentLLM-main/__pycache__/compator.cpython-311.pyc differ diff --git a/TalentLLM-main/__pycache__/gh.cpython-311.pyc b/TalentLLM-main/__pycache__/gh.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d2c845f88691fcf22110c53e50efa4c8aae0fd09 Binary files /dev/null and b/TalentLLM-main/__pycache__/gh.cpython-311.pyc differ diff --git a/TalentLLM-main/__pycache__/mathpix.cpython-311.pyc b/TalentLLM-main/__pycache__/mathpix.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..f0799404ee67a2e7e78bc29f519be7d81b382378 Binary files /dev/null and b/TalentLLM-main/__pycache__/mathpix.cpython-311.pyc differ diff --git a/TalentLLM-main/__pycache__/results.cpython-311.pyc b/TalentLLM-main/__pycache__/results.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..a9ac51ed5d7c6cb6bbc6885e70958b36d61343c3 Binary files /dev/null and b/TalentLLM-main/__pycache__/results.cpython-311.pyc differ diff --git a/TalentLLM-main/__pycache__/resume_conversation.cpython-311.pyc b/TalentLLM-main/__pycache__/resume_conversation.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b980ab5a878a5d3f45b31995d453f470231f2e84 Binary files /dev/null and b/TalentLLM-main/__pycache__/resume_conversation.cpython-311.pyc differ diff --git a/TalentLLM-main/__pycache__/resume_conversation_interactive.cpython-311.pyc b/TalentLLM-main/__pycache__/resume_conversation_interactive.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..6e5dd4dd3b8d05714752cfe48957661a8120f504 Binary files /dev/null and b/TalentLLM-main/__pycache__/resume_conversation_interactive.cpython-311.pyc differ diff --git a/TalentLLM-main/__pycache__/set_envs.cpython-311.pyc b/TalentLLM-main/__pycache__/set_envs.cpython-311.pyc new file mode 100644 index 0000000000000000000000000000000000000000..b37ea736847941feef58381eb0517954ed138160 Binary files /dev/null and b/TalentLLM-main/__pycache__/set_envs.cpython-311.pyc differ diff --git a/TalentLLM-main/comparisons.json b/TalentLLM-main/comparisons.json new file mode 100644 index 0000000000000000000000000000000000000000..f0ed001805c40bf3216afa1db8ab93c9c0338a9d --- /dev/null +++ b/TalentLLM-main/comparisons.json @@ -0,0 +1 @@ +{"danikhan632@gmail.com#tawfiqaliu@gmail.com#0": -1, "tawfiqaliu@gmail.com#danikhan632@gmail.com#0": 1, "danikhan632@gmail.com#jamesryzhkov@gmail.com#0": 0, "jamesryzhkov@gmail.com#danikhan632@gmail.com#0": 0, "danikhan632@gmail.com#tawfiqfm@gmail.com#0": -1, "tawfiqfm@gmail.com#danikhan632@gmail.com#0": 1, "tawfiqaliu@gmail.com#jamesryzhkov@gmail.com#0": -1, "jamesryzhkov@gmail.com#tawfiqaliu@gmail.com#0": 1, "tawfiqaliu@gmail.com#tawfiqfm@gmail.com#0": 0, "tawfiqfm@gmail.com#tawfiqaliu@gmail.com#0": 0, "jamesryzhkov@gmail.com#tawfiqfm@gmail.com#0": 1, "tawfiqfm@gmail.com#jamesryzhkov@gmail.com#0": -1, "danikhan632@gmail.com#smufti3@gatech.edu#0": 0, "smufti3@gatech.edu#danikhan632@gmail.com#0": 0, "jamesryzhkov@gmail.com#smufti3@gatech.edu#0": 0, "smufti3@gatech.edu#jamesryzhkov@gmail.com#0": 0, "tawfiqaliu@gmail.com#smufti3@gatech.edu#0": -1, "smufti3@gatech.edu#tawfiqaliu@gmail.com#0": 1, "tawfiqfm@gmail.com#smufti3@gatech.edu#0": 0, "smufti3@gatech.edu#tawfiqfm@gmail.com#0": 0, "tawfiqfm@gmail.com#dan.hus120@gmail.com#0": 1, "dan.hus120@gmail.com#tawfiqfm@gmail.com#0": -1, "smufti3@gatech.edu#dan.hus120@gmail.com#0": 1, "dan.hus120@gmail.com#smufti3@gatech.edu#0": -1, "dan.hus120@gmail.com#danikhan632@gmail.com#0": 0, "danikhan632@gmail.com#dan.hus120@gmail.com#0": 0, "dan.hus120@gmail.com#jamesryzhkov@gmail.com#0": 0, "jamesryzhkov@gmail.com#dan.hus120@gmail.com#0": 0, "dan.hus120@gmail.com#tawfiqaliu@gmail.com#0": 0, "tawfiqaliu@gmail.com#dan.hus120@gmail.com#0": 0} \ No newline at end of file diff --git a/TalentLLM-main/compator.py b/TalentLLM-main/compator.py new file mode 100644 index 0000000000000000000000000000000000000000..48d2f15ce44e9c943e0e082ad8214ee4e0e32d2c --- /dev/null +++ b/TalentLLM-main/compator.py @@ -0,0 +1,234 @@ +import openai; +import json, os,sys +from dotenv import load_dotenv +load_dotenv() +# openai.api_key = os.environ.get("OPENAI_API_KEY") +import openai; openai.api_key = "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" +from Candidate import JobCandidate + + +import litellm +from litellm import completion + + +import xml.etree.ElementTree as ET + + + + + + + +def printc(obj, color="cyan"): + color_code = { + "black": "30", "red": "31", "green": "32", "yellow": "33", + "blue": "34", "magenta": "35", "cyan": "36", "white": "37" + } + colored_text = f"\033[{color_code[color]}m{obj}\033[0m" if color in color_code else obj + print(colored_text) + + + +LLM=os.environ.get("COMPARATOR_LLM","chat-bison") +# LLM=os.environ.get("COMPARATOR_LLM","gpt-3.5-turbo-1106") +def getContent(candidateA, candidateB) -> str: + return ( + "Given the following two candidates, choose between the two. Here is the rubric: " + + get_rubric() + + "Candidate A: " + + "\nRESUME:\n" +candidateA.resume_text+"\nEND Resume\n" + + "\nGITHUB:\n" +candidateA.github_text+"\nEND GITHUB\n" + + " END OF Candidate A" + + "\n\nCandidate B: " + + "\nRESUME:\n" +candidateB.resume_text+"\nEND Resume\n" + + "\nGITHUB:\n" +candidateB.github_text+"\nEND GITHUB\n" + + " END OF Candidate B" + + ) + + + +def google_compare_resumes(content:str, nameA="", nameB=""): + choice =0 + messages=[ + {"role": "user", "content": "You are an LLM recrutier who will choose between two candidates based on an provided rubric"}, + {"role": "user", "content": + """ + You are an LLM recrutier who will choose between two candidates based on an provided rubric, + you will only use bullet point and broken english instead of proper english to be more concise + """ + }, + {"role": "assistant", "content": + """ + I can assist you in evaluating two candidates based on a provided rubric. + Provide me with the rubric or the criteria you'd like to use for the evaluation, + and I'll help you assess the candidates accordingly and explain myself in less that 50 words + """ + }, + {"role": "user", "content": content} + ] + + response =completion(model=LLM, messages=messages,max_tokens=170,) + printc(response["choices"][0]["message"],'red') + + messages=[ + {"role": "assistant","content":str(response["choices"][0]["message"])}, + {"role": "user","content":"okay so now with just a single token select A or B, "} + ] + retries=3 + while retries >0: + response =completion(model=LLM, messages=messages,max_tokens=5,temperature=0.01) + # printc(response,'cyan') + html=''.join(str(response["choices"][0]["message"]['content']).split()) + if "