drAbreu commited on
Commit
431317f
·
1 Parent(s): 43efb22

Adding web tools to main agent

Browse files
agents/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (189 Bytes). View file
 
agents/__pycache__/llama_index_agent.cpython-311.pyc ADDED
Binary file (2.44 kB). View file
 
agents/llama_index_agent.py CHANGED
@@ -5,6 +5,10 @@ from typing import Optional, List, Any
5
  from llama_index.llms.openai import OpenAI
6
  from llama_index.llms.anthropic import Anthropic
7
 
 
 
 
 
8
  class GaiaAgent(ReActAgent):
9
  """
10
  A flexible ReActAgent for GAIA benchmark tasks that supports multiple LLM providers.
@@ -47,7 +51,11 @@ class GaiaAgent(ReActAgent):
47
 
48
  # Use default tools if not provided
49
  if tools is None:
50
- tools = [reverse_text_tool]
 
 
 
 
51
 
52
  # Use default system prompt if not provided
53
  if system_prompt is None:
@@ -72,19 +80,7 @@ class GaiaAgent(ReActAgent):
72
 
73
  elif model_provider == "anthropic":
74
  return Anthropic(model=model_name, api_key=api_key or os.getenv("ANTHROPIC_API_KEY"))
75
-
76
- elif model_provider == "cohere":
77
- from llama_index.llms.cohere import Cohere
78
- return Cohere(model=model_name, api_key=api_key or os.getenv("COHERE_API_KEY"))
79
-
80
- elif model_provider == "huggingface":
81
- from llama_index.llms.huggingface import HuggingFaceLLM
82
- return HuggingFaceLLM(model_name=model_name, tokenizer_name=model_name)
83
-
84
- elif model_provider == "llama":
85
- from llama_index.llms.llama_cpp import LlamaCPP
86
- return LlamaCPP(model_path=model_name)
87
-
88
  else:
89
  raise ValueError(f"Unsupported model provider: {model_provider}. "
90
  f"Supported providers are: openai, anthropic, cohere, huggingface, llama")
 
5
  from llama_index.llms.openai import OpenAI
6
  from llama_index.llms.anthropic import Anthropic
7
 
8
+ from tools.web_tools import (
9
+ tavily_tool,
10
+ wikipedia_tool
11
+ )
12
  class GaiaAgent(ReActAgent):
13
  """
14
  A flexible ReActAgent for GAIA benchmark tasks that supports multiple LLM providers.
 
51
 
52
  # Use default tools if not provided
53
  if tools is None:
54
+ tools = [
55
+ reverse_text_tool,
56
+ wikipedia_tool,
57
+ tavily_tool
58
+ ]
59
 
60
  # Use default system prompt if not provided
61
  if system_prompt is None:
 
80
 
81
  elif model_provider == "anthropic":
82
  return Anthropic(model=model_name, api_key=api_key or os.getenv("ANTHROPIC_API_KEY"))
83
+
 
 
 
 
 
 
 
 
 
 
 
 
84
  else:
85
  raise ValueError(f"Unsupported model provider: {model_provider}. "
86
  f"Supported providers are: openai, anthropic, cohere, huggingface, llama")
tools/__pycache__/__init__.cpython-311.pyc ADDED
Binary file (188 Bytes). View file
 
tools/__pycache__/text_tools.cpython-311.pyc ADDED
Binary file (663 Bytes). View file
 
tools/web_tools.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ from llama_index.tools.wikipedia import WikipediaToolSpec
2
+ from llama_index.tools.tavily_research import TavilyToolSpec
3
+ import os
4
+
5
+ wikipedia_tool = WikipediaToolSpec()
6
+ tavily_tool = TavilyToolSpec(
7
+ api_key=os.getenv("TAVILY_API_KEY")
8
+ )