Shourya Angrish commited on
Commit
f74659a
·
1 Parent(s): 08df6ff

adding serp

Browse files
__pycache__/Gradio_UI.cpython-312.pyc ADDED
Binary file (12.1 kB). View file
 
app.py CHANGED
@@ -4,7 +4,8 @@ import requests
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
7
-
 
8
  from Gradio_UI import GradioUI
9
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
@@ -29,8 +30,31 @@ def get_commands(arg1:str)-> str:
29
  results = duck(software_query)
30
  return f"Here are the top 5 commands for {arg1}:\n{results}"
31
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  @tool
33
  def get_current_time_in_timezone(timezone: str) -> str:
 
34
  """A tool that fetches the current local time in a specified timezone.
35
  Args:
36
  timezone: A string representing a valid timezone (e.g., 'America/New_York').
 
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
7
+ from serpapi import GoogleSearch
8
+ import os
9
  from Gradio_UI import GradioUI
10
 
11
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
 
30
  results = duck(software_query)
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
+ for i in range(5):
52
+ jobs = jobs + f"{i+1}. {results['jobs_results'][i]['apply_options']}\n"
53
+ return f"Here are the top 5 {args1} jobs in {args2}:\n{jobs}"
54
+
55
  @tool
56
  def get_current_time_in_timezone(timezone: str) -> str:
57
+
58
  """A tool that fetches the current local time in a specified timezone.
59
  Args:
60
  timezone: A string representing a valid timezone (e.g., 'America/New_York').
tools/__pycache__/final_answer.cpython-312.pyc ADDED
Binary file (1.04 kB). View file