Added GoogleSearchTool
Browse files
app.py
CHANGED
|
@@ -7,7 +7,7 @@ import pandas as pd
|
|
| 7 |
import asyncio
|
| 8 |
import aiohttp
|
| 9 |
|
| 10 |
-
from smolagents import CodeAgent, LiteLLMModel,
|
| 11 |
|
| 12 |
# --- Constants ---
|
| 13 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
@@ -35,7 +35,7 @@ class BasicAgent:
|
|
| 35 |
|
| 36 |
# --- smolagents Initialization ---
|
| 37 |
try:
|
| 38 |
-
search_tool =
|
| 39 |
|
| 40 |
llm_model = LiteLLMModel(
|
| 41 |
model_id=MODEL_ID,
|
|
@@ -44,9 +44,10 @@ class BasicAgent:
|
|
| 44 |
self.agent_executor = CodeAgent(
|
| 45 |
model=llm_model,
|
| 46 |
tools=[search_tool],
|
| 47 |
-
|
|
|
|
| 48 |
)
|
| 49 |
-
print("smolagents AgentExecutor initialized successfully with
|
| 50 |
|
| 51 |
except ImportError:
|
| 52 |
print("ERROR: smolagents library not found. Please ensure 'smolagents' is installed and import paths are correct.")
|
|
|
|
| 7 |
import asyncio
|
| 8 |
import aiohttp
|
| 9 |
|
| 10 |
+
from smolagents import CodeAgent, LiteLLMModel, GoogleSearchTool
|
| 11 |
|
| 12 |
# --- Constants ---
|
| 13 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
|
|
| 35 |
|
| 36 |
# --- smolagents Initialization ---
|
| 37 |
try:
|
| 38 |
+
search_tool = GoogleSearchTool()
|
| 39 |
|
| 40 |
llm_model = LiteLLMModel(
|
| 41 |
model_id=MODEL_ID,
|
|
|
|
| 44 |
self.agent_executor = CodeAgent(
|
| 45 |
model=llm_model,
|
| 46 |
tools=[search_tool],
|
| 47 |
+
max_steps=12,
|
| 48 |
+
planning_interval=4,
|
| 49 |
)
|
| 50 |
+
print("smolagents AgentExecutor initialized successfully with GoogleSearchTool.")
|
| 51 |
|
| 52 |
except ImportError:
|
| 53 |
print("ERROR: smolagents library not found. Please ensure 'smolagents' is installed and import paths are correct.")
|