Raffaele Terribile
commited on
Aggiungi importazione dei tool che verranno usati
Browse files
app.py
CHANGED
@@ -4,6 +4,8 @@ import requests
|
|
4 |
import inspect
|
5 |
import pandas as pd
|
6 |
|
|
|
|
|
7 |
# (Keep Constants as is)
|
8 |
# --- Constants ---
|
9 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
@@ -11,8 +13,9 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
11 |
# --- First Agent Definition ---
|
12 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
13 |
class FirstAgent:
|
|
|
14 |
def __init__(self):
|
15 |
-
print("
|
16 |
def __call__(self, question: str) -> str:
|
17 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
18 |
fixed_answer = "This is a default answer."
|
@@ -22,6 +25,8 @@ class FirstAgent:
|
|
22 |
# --- Basic Agent Definition ---
|
23 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
24 |
class BasicAgent:
|
|
|
|
|
25 |
def __init__(self):
|
26 |
print("BasicAgent initialized.")
|
27 |
def __call__(self, question: str) -> str:
|
|
|
4 |
import inspect
|
5 |
import pandas as pd
|
6 |
|
7 |
+
from smolagents import CodeAgent, DuckDuckGoSearchTool, InferenceClientModel, GoogleSearchTool, WebSearchTool, PythonInterpreterTool, WikipediaSearchTool, VisitWebpageTool
|
8 |
+
|
9 |
# (Keep Constants as is)
|
10 |
# --- Constants ---
|
11 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
|
|
13 |
# --- First Agent Definition ---
|
14 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
15 |
class FirstAgent:
|
16 |
+
### First Agent is the first attempt to develop an agent for the course. ###
|
17 |
def __init__(self):
|
18 |
+
print("FirstAgent initialized.")
|
19 |
def __call__(self, question: str) -> str:
|
20 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
21 |
fixed_answer = "This is a default answer."
|
|
|
25 |
# --- Basic Agent Definition ---
|
26 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
27 |
class BasicAgent:
|
28 |
+
### Basic Agent is a placeholder for a simple agent that always returns a fixed answer. ###
|
29 |
+
### It is used to demonstrate the structure of an agent. ###
|
30 |
def __init__(self):
|
31 |
print("BasicAgent initialized.")
|
32 |
def __call__(self, question: str) -> str:
|