gemechisw commited on
Commit
446a4fc
·
verified ·
1 Parent(s): 57639a9

Added a tool to fetch linkedin profile

Browse files
Files changed (1) hide show
  1. app.py +22 -1
app.py CHANGED
@@ -18,6 +18,27 @@ def addTwoNumbers(arg1:int, arg2:int)-> int: #it's import to specify the return
18
  """
19
  return arg1 + arg2
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  @tool
22
  def get_current_time_in_timezone(timezone: str) -> str:
23
  """A tool that fetches the current local time in a specified timezone.
@@ -55,7 +76,7 @@ with open("prompts.yaml", 'r') as stream:
55
 
56
  agent = CodeAgent(
57
  model=model,
58
- tools=[final_answer, addTwoNumbers, get_current_time_in_timezone, image_generation_tool], ## add your tools here (don't remove final answer)
59
  max_steps=6,
60
  verbosity_level=1,
61
  grammar=None,
 
18
  """
19
  return arg1 + arg2
20
 
21
+ @tool
22
+ def getLinkedinProfileInfo(username: str) -> str:
23
+ """A tool that calls an API to fetch linkedin profile info and returns it.
24
+ Args:
25
+ username: a linkedin username of a profile in question
26
+ Output: returns a JSON object containing the information from a given username's linkedin profile
27
+ """
28
+ import requests
29
+
30
+ url = "https://linkedin-data-api.p.rapidapi.com/about-this-profile"
31
+
32
+ querystring = {"username": username}
33
+
34
+ headers = {
35
+ "x-rapidapi-key": "929182774fmsh988ee3ad62ddef0p10b601jsnd75c6f4742e4",
36
+ "x-rapidapi-host": "linkedin-data-api.p.rapidapi.com"
37
+ }
38
+
39
+ response = requests.get(url, headers=headers, params=querystring)
40
+ return response
41
+
42
  @tool
43
  def get_current_time_in_timezone(timezone: str) -> str:
44
  """A tool that fetches the current local time in a specified timezone.
 
76
 
77
  agent = CodeAgent(
78
  model=model,
79
+ tools=[final_answer, addTwoNumbers, get_current_time_in_timezone, image_generation_tool, getLinkedinProfileInfo], ## add your tools here (don't remove final answer)
80
  max_steps=6,
81
  verbosity_level=1,
82
  grammar=None,