bstraehle commited on
Commit
82c862d
·
1 Parent(s): 21b067a

Update agent_llamaindex.py

Browse files
Files changed (1) hide show
  1. agent_llamaindex.py +3 -3
agent_llamaindex.py CHANGED
@@ -6,7 +6,7 @@ from llama_index.agent import OpenAIAgent
6
  from llama_index.llms import OpenAI
7
  from llama_index.tools import FunctionTool
8
 
9
- def date_tool(text: str) -> str:
10
  """Returns today's date. Use this for any questions related to knowing today's date.
11
  The input should always be an empty string, and this function will always return today's date.
12
  Any date mathematics should occur outside this function."""
@@ -20,11 +20,11 @@ def agent_llamaindex(config, prompt):
20
  tool_spec = OpenWeatherMapToolSpec(key = os.environ["OPENWEATHERMAP_API_KEY"])
21
  tools = tool_spec.to_tool_list()
22
 
23
- dt_tool = FunctionTool.from_defaults(fn = date_tool)
24
 
25
  agent = OpenAIAgent.from_tools(
26
  [tools[0], # built-in tools
27
- dt_tool], # custom tools
28
  llm = llm,
29
  verbose = True
30
  )
 
6
  from llama_index.llms import OpenAI
7
  from llama_index.tools import FunctionTool
8
 
9
+ def today_tool(text: str) -> str:
10
  """Returns today's date. Use this for any questions related to knowing today's date.
11
  The input should always be an empty string, and this function will always return today's date.
12
  Any date mathematics should occur outside this function."""
 
20
  tool_spec = OpenWeatherMapToolSpec(key = os.environ["OPENWEATHERMAP_API_KEY"])
21
  tools = tool_spec.to_tool_list()
22
 
23
+ date_tool = FunctionTool.from_defaults(fn = today_tool)
24
 
25
  agent = OpenAIAgent.from_tools(
26
  [tools[0], # built-in tools
27
+ date_tool], # custom tools
28
  llm = llm,
29
  verbose = True
30
  )