Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ import requests
|
|
4 |
import inspect
|
5 |
import pandas as pd
|
6 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
7 |
-
from tools import InternetSearchTool,
|
8 |
from smolagents import CodeAgent, InferenceClientModel
|
9 |
|
10 |
# (Keep Constants as is)
|
@@ -19,18 +19,21 @@ class BasicAgent:
|
|
19 |
# Initialize the Hugging Face model
|
20 |
model = ChatGoogleGenerativeAI(model="gemini-1.5-flash-latest")
|
21 |
|
22 |
-
# Initialize
|
23 |
search_tool = InternetSearchTool()
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
27 |
|
28 |
# Create agent
|
29 |
self.agent= CodeAgent(
|
30 |
-
tools=[
|
31 |
model=InferenceClientModel(token=os.getenv("HF_TOKEN"), provider="together"),
|
32 |
add_base_tools=True, # Add any additional base tools
|
33 |
-
planning_interval=3 # Enable planning every 3 steps
|
|
|
34 |
)
|
35 |
|
36 |
def __call__(self, question: str) -> str:
|
|
|
4 |
import inspect
|
5 |
import pandas as pd
|
6 |
from langchain_google_genai import ChatGoogleGenerativeAI
|
7 |
+
from tools import InternetSearchTool, WebscraperTool, ExcelTool, WikipediaTool, SummarizeTool
|
8 |
from smolagents import CodeAgent, InferenceClientModel
|
9 |
|
10 |
# (Keep Constants as is)
|
|
|
19 |
# Initialize the Hugging Face model
|
20 |
model = ChatGoogleGenerativeAI(model="gemini-1.5-flash-latest")
|
21 |
|
22 |
+
# Initialize tools
|
23 |
search_tool = InternetSearchTool()
|
24 |
+
webscraper_tool = WebscraperTool()
|
25 |
+
excel_tool = ExcelTool()
|
26 |
+
python_tool = PythonTool()
|
27 |
+
wikipedia_tool = WikipediaTool()
|
28 |
+
summarize_tool = SummarizeTool()
|
29 |
|
30 |
# Create agent
|
31 |
self.agent= CodeAgent(
|
32 |
+
tools=[search_tool, webscraper_tool, excel_tool, python_tool, wikipedia_tool, summarize_tool],
|
33 |
model=InferenceClientModel(token=os.getenv("HF_TOKEN"), provider="together"),
|
34 |
add_base_tools=True, # Add any additional base tools
|
35 |
+
planning_interval=3, # Enable planning every 3 steps
|
36 |
+
max_steps=10
|
37 |
)
|
38 |
|
39 |
def __call__(self, question: str) -> str:
|