Commit
·
96c725c
1
Parent(s):
61e51ef
Bigger LLM and new search tool.
Browse files- app.py +7 -6
- requirements.txt +1 -1
app.py
CHANGED
@@ -10,7 +10,8 @@ from llama_index.core.llms import ChatMessage, TextBlock, ImageBlock, AudioBlock
|
|
10 |
from llama_index.llms.openai import OpenAI
|
11 |
from llama_index.core.agent.workflow import ReActAgent, AgentOutput
|
12 |
from llama_index.core.tools import FunctionTool
|
13 |
-
from llama_index.tools.duckduckgo import DuckDuckGoSearchToolSpec
|
|
|
14 |
from llama_index.tools.wikipedia import WikipediaToolSpec
|
15 |
from dotenv import load_dotenv
|
16 |
from pydantic import ValidationError
|
@@ -33,13 +34,13 @@ SYSTEM_PROMPT = (Path(__file__).parent / 'system_prompt.txt').read_text()
|
|
33 |
# --- Basic Agent Definition ---
|
34 |
class BasicAgent:
|
35 |
def __init__(self, max_calls_per_minute=15):
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
self._tools
|
40 |
|
41 |
#self._llm = GoogleGenAI(api_key=GOOGLE_API_KEY, model="gemini-2.0-flash", max_tokens=1600)
|
42 |
-
self._llm = OpenAI(model="gpt-
|
43 |
self._agent = ReActAgent(tools=self._tools, llm=self._llm)
|
44 |
# Modify the react prompt.
|
45 |
self._agent.update_prompts({"react_header": SYSTEM_PROMPT})
|
|
|
10 |
from llama_index.llms.openai import OpenAI
|
11 |
from llama_index.core.agent.workflow import ReActAgent, AgentOutput
|
12 |
from llama_index.core.tools import FunctionTool
|
13 |
+
#from llama_index.tools.duckduckgo import DuckDuckGoSearchToolSpec
|
14 |
+
from llama_index.tools.tavily_research.base import TavilyToolSpec
|
15 |
from llama_index.tools.wikipedia import WikipediaToolSpec
|
16 |
from dotenv import load_dotenv
|
17 |
from pydantic import ValidationError
|
|
|
34 |
# --- Basic Agent Definition ---
|
35 |
class BasicAgent:
|
36 |
def __init__(self, max_calls_per_minute=15):
|
37 |
+
self._tools = TavilyToolSpec(api_key=os.environ["TAVILY_API_KEY"]).to_tool_list()
|
38 |
+
#FunctionTool.from_defaults(TavilyToolSpec().duckduckgo_full_search)
|
39 |
+
self._tools.append(FunctionTool.from_defaults(WikipediaToolSpec().load_data))
|
40 |
+
self._tools.append(FunctionTool.from_defaults(WikipediaToolSpec().search_data))
|
41 |
|
42 |
#self._llm = GoogleGenAI(api_key=GOOGLE_API_KEY, model="gemini-2.0-flash", max_tokens=1600)
|
43 |
+
self._llm = OpenAI(model="gpt-o3", temperature=0.0)
|
44 |
self._agent = ReActAgent(tools=self._tools, llm=self._llm)
|
45 |
# Modify the react prompt.
|
46 |
self._agent.update_prompts({"react_header": SYSTEM_PROMPT})
|
requirements.txt
CHANGED
@@ -4,5 +4,5 @@ requests
|
|
4 |
pandas
|
5 |
llama-index
|
6 |
llama-index-llms-openai
|
7 |
-
|
8 |
llama-index-tools-wikipedia
|
|
|
4 |
pandas
|
5 |
llama-index
|
6 |
llama-index-llms-openai
|
7 |
+
lama-index-tools-tavily-research
|
8 |
llama-index-tools-wikipedia
|