Refactored agent.py
Browse files
agent.py
CHANGED
|
@@ -12,11 +12,12 @@ model = LiteLLMModel("gemini/gemini-2.5-flash",api_key=api_key)
|
|
| 12 |
|
| 13 |
# Initialize tools
|
| 14 |
search_tool = DuckDuckGoSearchTool(max_results=5)
|
| 15 |
-
|
| 16 |
visit_webpage_tool = VisitWebpageTool()
|
| 17 |
python_interpreter_tool = PythonInterpreterTool()
|
| 18 |
calculator_tools = [addition_tool, subtraction_tool, multiplication_tool, division_tool, exponent_tool, modulus_tool]
|
| 19 |
-
main_tools = [search_tool,
|
|
|
|
| 20 |
|
| 21 |
# Agent Definitions
|
| 22 |
calculator_agent = CodeAgent(
|
|
@@ -24,16 +25,16 @@ calculator_agent = CodeAgent(
|
|
| 24 |
tools = calculator_tools,
|
| 25 |
name = "arithmetic_calculator_agent",
|
| 26 |
description = "You perform basic arithmetic calculations between two numbers.",
|
| 27 |
-
max_steps =
|
| 28 |
-
verbosity_level=3
|
| 29 |
)
|
| 30 |
|
| 31 |
main_agent = CodeAgent(
|
| 32 |
tools=main_tools,
|
| 33 |
model=model,
|
| 34 |
-
additional_authorized_imports
|
| 35 |
-
|
| 36 |
-
managed_agents
|
| 37 |
-
max_steps=
|
| 38 |
verbosity_level=3,
|
| 39 |
)
|
|
|
|
| 12 |
|
| 13 |
# Initialize tools
|
| 14 |
search_tool = DuckDuckGoSearchTool(max_results=5)
|
| 15 |
+
wiki_search_tool = WikipediaSearchTool()
|
| 16 |
visit_webpage_tool = VisitWebpageTool()
|
| 17 |
python_interpreter_tool = PythonInterpreterTool()
|
| 18 |
calculator_tools = [addition_tool, subtraction_tool, multiplication_tool, division_tool, exponent_tool, modulus_tool]
|
| 19 |
+
main_tools = [search_tool, wiki_search_tool, transcriber_tool, visit_webpage_tool, python_interpreter_tool, excel_loader_tool]
|
| 20 |
+
authorized_imports = ['requests', 'bs4', 'whisper', 'langchain_community', 'langchain', 'markdownify', 'openpyxl', 'tabulate']
|
| 21 |
|
| 22 |
# Agent Definitions
|
| 23 |
calculator_agent = CodeAgent(
|
|
|
|
| 25 |
tools = calculator_tools,
|
| 26 |
name = "arithmetic_calculator_agent",
|
| 27 |
description = "You perform basic arithmetic calculations between two numbers.",
|
| 28 |
+
max_steps = 4,
|
| 29 |
+
verbosity_level=3,
|
| 30 |
)
|
| 31 |
|
| 32 |
main_agent = CodeAgent(
|
| 33 |
tools=main_tools,
|
| 34 |
model=model,
|
| 35 |
+
additional_authorized_imports=authorized_imports,
|
| 36 |
+
instructions=system_prompt,
|
| 37 |
+
managed_agents=[calculator_agent],
|
| 38 |
+
max_steps=8,
|
| 39 |
verbosity_level=3,
|
| 40 |
)
|