lwant commited on
Commit
4f304eb
Β·
1 Parent(s): c2fbc47

Replace unused Wikipedia tool spec and integrate `WikipediaToolSpec` with a dedicated `wikipedia_agent`.

Browse files
src/gaia_solving_agent/agent.py CHANGED
@@ -4,6 +4,7 @@ from llama_index.core.agent.workflow import FunctionAgent, AgentWorkflow
4
  from llama_index.core.prompts import RichPromptTemplate
5
  from llama_index.llms.nebius import NebiusLLM
6
  from llama_index.tools.requests import RequestsToolSpec
 
7
  from workflows import Workflow, step
8
  from workflows.events import StartEvent, Event, StopEvent
9
 
@@ -101,9 +102,19 @@ visit_website = FunctionAgent(
101
  description="Agent that visit a web page and return a summary of the page."
102
  )
103
 
 
 
 
 
 
 
 
 
 
 
104
 
105
  gaia_solving_agent = AgentWorkflow(
106
- agents = [tavily_search_engine, visit_website, wikipedia_tool_spec],
107
  initial_state = dict(),
108
  root_agent = tavily_search_engine.name,
109
  handoff_prompt = None,
 
4
  from llama_index.core.prompts import RichPromptTemplate
5
  from llama_index.llms.nebius import NebiusLLM
6
  from llama_index.tools.requests import RequestsToolSpec
7
+ from llama_index.tools.wikipedia import WikipediaToolSpec
8
  from workflows import Workflow, step
9
  from workflows.events import StartEvent, Event, StopEvent
10
 
 
102
  description="Agent that visit a web page and return a summary of the page."
103
  )
104
 
105
+ wikipedia_agent = FunctionAgent(
106
+ tools=[*WikipediaToolSpec().to_tool_list()],
107
+ llm=get_llm(),
108
+ system_prompt="""
109
+ You are a helpful assistant that searches Wikipedia and visit Wikipedia pages.
110
+ """,
111
+ name="wikipedia_agent",
112
+ description="Agent that searches Wikipedia and visit Wikipedia pages."
113
+ )
114
+
115
 
116
  gaia_solving_agent = AgentWorkflow(
117
+ agents = [tavily_search_engine, visit_website, wikipedia_agent],
118
  initial_state = dict(),
119
  root_agent = tavily_search_engine.name,
120
  handoff_prompt = None,
src/gaia_solving_agent/tools.py CHANGED
@@ -1,4 +1,3 @@
1
- from llama_index.tools.wikipedia.base import WikipediaToolSpec
2
  from tavily import AsyncTavilyClient
3
 
4
  from gaia_solving_agent import TAVILY_API_KEY
@@ -11,5 +10,3 @@ async def tavily_search_web(query: str) -> str:
11
  client = AsyncTavilyClient(api_key=TAVILY_API_KEY)
12
  return str(await client.search(query))
13
 
14
-
15
- wikipedia_tool_spec = WikipediaToolSpec().to_tool_list()
 
 
1
  from tavily import AsyncTavilyClient
2
 
3
  from gaia_solving_agent import TAVILY_API_KEY
 
10
  client = AsyncTavilyClient(api_key=TAVILY_API_KEY)
11
  return str(await client.search(query))
12