Spaces:
Sleeping
Sleeping
Shourya Angrish commited on
Commit ·
aa853d4
1
Parent(s): 1083936
fixing typeerror
Browse files
app.py
CHANGED
|
@@ -31,26 +31,27 @@ def get_commands(arg1:str)-> str:
|
|
| 31 |
return f"Here are the top 5 commands for {arg1}:\n{results}"
|
| 32 |
|
| 33 |
@tool
|
| 34 |
-
def get_jobs(args1:str,args2:str)-> str:
|
| 35 |
"""A tool that fetches the jobs from a given location.
|
| 36 |
Args:
|
| 37 |
args1: the job title.
|
| 38 |
args2: the location.
|
| 39 |
"""
|
| 40 |
-
api= os.getenv('api_key')
|
| 41 |
params = {
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
}
|
| 47 |
|
| 48 |
search = GoogleSearch(params)
|
| 49 |
results = search.get_dict()
|
| 50 |
jobs = results['jobs_results']
|
|
|
|
| 51 |
for i in range(5):
|
| 52 |
-
|
| 53 |
-
return f"Here are the top 5 {args1} jobs in {args2}:\n{
|
| 54 |
|
| 55 |
@tool
|
| 56 |
def get_wiki(arg1:str)-> str:
|
|
|
|
| 31 |
return f"Here are the top 5 commands for {arg1}:\n{results}"
|
| 32 |
|
| 33 |
@tool
|
| 34 |
+
def get_jobs(args1: str, args2: str) -> str:
|
| 35 |
"""A tool that fetches the jobs from a given location.
|
| 36 |
Args:
|
| 37 |
args1: the job title.
|
| 38 |
args2: the location.
|
| 39 |
"""
|
| 40 |
+
api = os.getenv('api_key')
|
| 41 |
params = {
|
| 42 |
+
"engine": "google_jobs",
|
| 43 |
+
"q": f"{args1} jobs in {args2}",
|
| 44 |
+
"hl": "en",
|
| 45 |
+
"api_key": api
|
| 46 |
}
|
| 47 |
|
| 48 |
search = GoogleSearch(params)
|
| 49 |
results = search.get_dict()
|
| 50 |
jobs = results['jobs_results']
|
| 51 |
+
job_list = ""
|
| 52 |
for i in range(5):
|
| 53 |
+
job_list += f"{i+1}. {jobs[i]['apply_options']}\n"
|
| 54 |
+
return f"Here are the top 5 {args1} jobs in {args2}:\n{job_list}"
|
| 55 |
|
| 56 |
@tool
|
| 57 |
def get_wiki(arg1:str)-> str:
|