Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,8 @@ import requests
|
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
from smolagents import CodeAgent, OpenAIServerModel, GoogleSearchTool
|
|
|
|
|
|
|
| 7 |
|
| 8 |
|
| 9 |
# (Keep Constants as is)
|
|
@@ -17,9 +19,18 @@ class BasicAgent:
|
|
| 17 |
print("BasicAgent initialized.")
|
| 18 |
MyModel = OpenAIServerModel(model_id="gpt-4o")
|
| 19 |
search_tool = GoogleSearchTool()
|
|
|
|
|
|
|
| 20 |
self.agent = CodeAgent(
|
| 21 |
model = MyModel,
|
| 22 |
-
tools=[search_tool]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
)
|
| 24 |
def __call__(self, question: str) -> str:
|
| 25 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
|
|
|
| 4 |
import inspect
|
| 5 |
import pandas as pd
|
| 6 |
from smolagents import CodeAgent, OpenAIServerModel, GoogleSearchTool
|
| 7 |
+
from tools import FinalAnswerTool as FinalAnswer
|
| 8 |
+
from tools import VisitWebpageTool as VisitWebpage
|
| 9 |
|
| 10 |
|
| 11 |
# (Keep Constants as is)
|
|
|
|
| 19 |
print("BasicAgent initialized.")
|
| 20 |
MyModel = OpenAIServerModel(model_id="gpt-4o")
|
| 21 |
search_tool = GoogleSearchTool()
|
| 22 |
+
visit_webpage = VisitWebpage()
|
| 23 |
+
final_answer = FinalAnswer()
|
| 24 |
self.agent = CodeAgent(
|
| 25 |
model = MyModel,
|
| 26 |
+
tools=[search_tool, visit_webpage, final_answer]
|
| 27 |
+
managed_agents=[],
|
| 28 |
+
max_steps=8,
|
| 29 |
+
verbosity_level=2,
|
| 30 |
+
grammar=None,
|
| 31 |
+
planning_interval=None,
|
| 32 |
+
name=None,
|
| 33 |
+
description=None,
|
| 34 |
)
|
| 35 |
def __call__(self, question: str) -> str:
|
| 36 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|