madsc13nt1st commited on
Commit
c6aa09a
·
verified ·
1 Parent(s): b120e43

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +30 -0
agent.py CHANGED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from smolagents import DuckDuckGoSearchTool, CodeAgent, WikipediaSearchTool, LiteLLMModel
2
+ from langchain_community.document_loaders import TextLoader, PyPDFLoader, Docx2txtLoader, CSVLoader
3
+ from langchain_text_splitters import RecursiveCharacterTextSplitter
4
+ from langchain_community.retrievers import BM25Retriever
5
+ from agent_tools import *
6
+
7
+
8
+ # Initialize tools
9
+ search_tool = DuckDuckGoSearchTool(max_results = 5)
10
+ wiki_tool = WikipediaSearchTool()
11
+ rag_tool = RagTool()
12
+ calculator_tools = [addition_tool, subtraction_tool, multiplication_tool, division_tool, exponent_tool, modulus_tool]
13
+
14
+ # Agent Definitions
15
+ calculator_agent = CodeAgent(
16
+ model = model,
17
+ tools = calculator_tools,
18
+ name = "arithmetic_calculator_agent",
19
+ description = "Performs basic arithmetic calculations between two numbers.",
20
+ max_steps = 10,
21
+ verbosity_level=3
22
+ )
23
+
24
+ main_agent = CodeAgent(
25
+ tools=[search_tool, wiki_tool, rag_tool],
26
+ model=model,
27
+ managed_agents = [calculator_agent],
28
+ max_steps=10,
29
+ verbosity_level=3,
30
+ )