Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,7 +3,7 @@ import gradio as gr
|
|
3 |
import requests
|
4 |
import inspect
|
5 |
import pandas as pd
|
6 |
-
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, LiteLLMModel
|
7 |
|
8 |
# (Keep Constants as is)
|
9 |
# --- Constants ---
|
@@ -13,12 +13,13 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
13 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
14 |
class BasicAgent:
|
15 |
def __init__(self):
|
16 |
-
model =
|
17 |
-
api_key = os.getenv("GEMINI_API_KEY"),
|
18 |
-
max_tokens=8192,)
|
19 |
self.agent = CodeAgent(
|
20 |
model = model,
|
21 |
-
tools=[
|
|
|
|
|
|
|
22 |
)
|
23 |
def __call__(self, question: str) -> str:
|
24 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
|
|
3 |
import requests
|
4 |
import inspect
|
5 |
import pandas as pd
|
6 |
+
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel, LiteLLMModel, GoogleSearchTool
|
7 |
|
8 |
# (Keep Constants as is)
|
9 |
# --- Constants ---
|
|
|
13 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
14 |
class BasicAgent:
|
15 |
def __init__(self):
|
16 |
+
model = HfApiModel(model_id="meta-llama/Meta-Llama-3-8B-Instruct", provider="serpapi")
|
|
|
|
|
17 |
self.agent = CodeAgent(
|
18 |
model = model,
|
19 |
+
tools=[GoogleSearchTool()],
|
20 |
+
add_base_tools=True, # Add any additional base tools
|
21 |
+
max_steps=15,
|
22 |
+
planning_interval=3 # Enable planning every 3 steps
|
23 |
)
|
24 |
def __call__(self, question: str) -> str:
|
25 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|