ChIrish06 commited on
Commit
00640e3
·
verified ·
1 Parent(s): 3a66737

Update app.py

Browse files

Adding a basic function, seeing if this integrates with the agent well.

Files changed (1) hide show
  1. app.py +16 -1
app.py CHANGED
@@ -6,6 +6,8 @@ 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 !
11
  @tool
@@ -18,6 +20,19 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
18
  """
19
  return "What magic will you build ?"
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.
@@ -59,7 +74,7 @@ with open("prompts.yaml", 'r') as stream:
59
 
60
  agent = CodeAgent(
61
  model=model,
62
- tools=[final_answer, image_generation_tool], ## add your tools here (don't remove final answer)
63
  max_steps=6,
64
  verbosity_level=1,
65
  grammar=None,
 
6
  from tools.final_answer import FinalAnswerTool
7
 
8
  from Gradio_UI import GradioUI
9
+ import requests
10
+
11
 
12
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
13
  @tool
 
20
  """
21
  return "What magic will you build ?"
22
 
23
+ # Creating an example function to get data from a website of my choice
24
+ @tool
25
+ def webpage_contents_get(url:str)-> str: #it's import to specify the return type
26
+ #Keep this format for the description / args / args description but feel free to modify the tool
27
+ """A simple function to grab contents of a webpage
28
+ Args:
29
+ url: The URL the contents of which the tool will get
30
+ """
31
+ response = requests.get(url)
32
+ # html_content = response.text
33
+ return response
34
+
35
+
36
  @tool
37
  def get_current_time_in_timezone(timezone: str) -> str:
38
  """A tool that fetches the current local time in a specified timezone.
 
74
 
75
  agent = CodeAgent(
76
  model=model,
77
+ tools=[final_answer, image_generation_tool,webpage_contents_get], ## add your tools here (don't remove final answer)
78
  max_steps=6,
79
  verbosity_level=1,
80
  grammar=None,