jeanflop commited on
Commit
4a53bad
·
verified ·
1 Parent(s): 88edac1

Update app.py

Browse files

improve the agent

Files changed (1) hide show
  1. app.py +15 -2
app.py CHANGED
@@ -7,9 +7,20 @@ 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 !
11
  @tool
12
- def my_job_tool(arg1: str)-> dict: #it's import to specify the return type
13
  #Keep this format for the description / args / args description but feel free to modify the tool
14
  """A tool that fetches jobs offers located in France from linkedin website
15
  Args:
@@ -42,7 +53,9 @@ def my_job_tool(arg1: str)-> dict: #it's import to specify the return type
42
  }
43
 
44
  response = requests.post(url, json=payload, headers=headers)
45
- return response.json()
 
 
46
 
47
  except Exception as e:
48
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
 
7
 
8
  from Gradio_UI import GradioUI
9
 
10
+ ## utils
11
+ def format_job(job):
12
+ return (
13
+ f"Company: {job.get('company_name', 'Unknown Company')}\n"
14
+ f"Job Title: {job.get('title', 'No title available')}\n"
15
+ f"Location: {job.get('location', 'Unknown Location')}\n"
16
+ f"Remote: {job.get('work_type', 'Unknown Work Type')}\n"
17
+ f"Posted Time: {job.get('posted_at', 'Unknown Time')}\n"
18
+ f"Job URL: {job.get('job_url', 'No URL available')}\n"
19
+ f"{'=' * 80}"
20
+ )
21
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
22
  @tool
23
+ def my_job_tool(arg1: str)-> str: #it's import to specify the return type
24
  #Keep this format for the description / args / args description but feel free to modify the tool
25
  """A tool that fetches jobs offers located in France from linkedin website
26
  Args:
 
53
  }
54
 
55
  response = requests.post(url, json=payload, headers=headers)
56
+ jobs = response.json()
57
+ result = "\n".join(map(format_job, jobs[:3]))
58
+ return result
59
 
60
  except Exception as e:
61
  return f"Error fetching time for timezone '{timezone}': {str(e)}"