forked from desaianm/internship_finder
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathtools.py
More file actions
52 lines (38 loc) · 1.36 KB
/
tools.py
File metadata and controls
52 lines (38 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import json
from PyPDF2 import PdfReader
import os
import cohere
import requests
with open("resume_temp.json") as f:
file = json.load(f)
temp = json.dumps(file)
def resume_into_json(resume):
cohere_api_key = os.getenv("CO_API_KEY")
co = cohere.Client(cohere_api_key)
pdf_reader = PdfReader(resume)
text = ""
for page_num in range(len(pdf_reader.pages)):
page = pdf_reader.pages[page_num]
text += page.extract_text()
prompt = f"Act as Master in extracting data from resume. Don't give any explanation. Please analyze and convert resume data from this {text} into JSON, remove data like name, email, or personal information, and please return only the JSON file."
response = co.generate(
model='command-r-plus',
prompt=prompt,
max_tokens=10000,
num_generations=1,
temperature=0.2,
)
return json.loads(response.generations[0].text)
def company_url(company):
if company == "Astranis":
return "https://www.jeezai.com/companies/astranis-space-technologies"
company = (company.lower()).replace(" ", "-")
return f"https://www.jeezai.com/companies/{company}/"
def get_company_info(company):
data = requests.post(
"https://advanced-research-agents.onrender.com",
json={
"query": company,
}
)
return data.json()