Popline commited on
Commit
4007dfc
·
verified ·
1 Parent(s): 4d14403

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -4,6 +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
 
@@ -19,6 +21,13 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
19
  return "What magic will you build ?"
20
 
21
 
 
 
 
 
 
 
 
22
  @tool
23
  def get_current_time_in_timezone(timezone: str) -> str:
24
  """A tool that fetches the current local time in a specified timezone.
@@ -56,7 +65,7 @@ with open("prompts.yaml", 'r') as stream:
56
 
57
  agent = CodeAgent(
58
  model=model,
59
- tools=[final_answer, get_current_time_in_timezone, image_generation_tool], ## add your tools here (don't remove final answer)
60
  max_steps=6,
61
  verbosity_level=1,
62
  grammar=None,
 
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
7
+ from llama_index.tools.wikipedia import WikipediaToolSpec
8
+ from llama_index.agent.openai import OpenAIAgent
9
 
10
  from Gradio_UI import GradioUI
11
 
 
21
  return "What magic will you build ?"
22
 
23
 
24
+ tool_spec = WikipediaToolSpec()
25
+
26
+ agent = OpenAIAgent.from_tools(tool_spec.to_tool_list())
27
+
28
+ #agent.chat("Who is Ben Afflecks spouse?")
29
+
30
+
31
  @tool
32
  def get_current_time_in_timezone(timezone: str) -> str:
33
  """A tool that fetches the current local time in a specified timezone.
 
65
 
66
  agent = CodeAgent(
67
  model=model,
68
+ tools=[final_answer, get_current_time_in_timezone, image_generation_tool, agent], ## add your tools here (don't remove final answer)
69
  max_steps=6,
70
  verbosity_level=1,
71
  grammar=None,