Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -20,40 +20,58 @@ class BasicAgent:
|
|
| 20 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 21 |
return fixed_answer
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
class BasicAgent:
|
| 24 |
def __init__(self):
|
| 25 |
print("BasicAgent initialized.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
-
|
| 30 |
-
|
|
|
|
| 31 |
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
|
| 55 |
|
| 56 |
-
|
| 57 |
|
| 58 |
|
| 59 |
|
|
|
|
| 20 |
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 21 |
return fixed_answer
|
| 22 |
|
| 23 |
+
|
| 24 |
+
|
| 25 |
+
# (Keep Constants as is)
|
| 26 |
+
# --- Constants ---
|
| 27 |
+
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 28 |
+
|
| 29 |
+
# --- Basic Agent Definition ---
|
| 30 |
+
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
| 31 |
class BasicAgent:
|
| 32 |
def __init__(self):
|
| 33 |
print("BasicAgent initialized.")
|
| 34 |
+
def __call__(self, question: str) -> str:
|
| 35 |
+
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 36 |
+
fixed_answer = run(question)
|
| 37 |
+
print(f"Agent returning fixed answer: {fixed_answer}")
|
| 38 |
+
return fixed_answer
|
| 39 |
|
| 40 |
|
| 41 |
+
# class BasicAgent:
|
| 42 |
+
# def __init__(self):
|
| 43 |
+
# print("BasicAgent initialized.")
|
| 44 |
+
|
| 45 |
|
| 46 |
+
|
| 47 |
+
# def __call__(self, question: str) -> str:
|
| 48 |
+
# print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 49 |
|
| 50 |
|
| 51 |
+
# agent = ToolCallingAgent(
|
| 52 |
+
# tools=[FinalAnswerTool(), visit_webpage, DuckDuckGoSearchTool(), PythonInterpreterTool(), fetch_task_file, read_excel_as_json],
|
| 53 |
+
# model=model,
|
| 54 |
+
# max_steps=5,
|
| 55 |
+
# verbosity_level=2,
|
| 56 |
+
# planning_interval=1
|
| 57 |
+
# )
|
| 58 |
|
| 59 |
+
# # Get the actual answer from the agent
|
| 60 |
+
# answer = agent.run(f"""Provide only what is requested in answer SHORTLY.
|
| 61 |
+
# If there is requested to provide ONE word or the sequence or the NUMBER, provide it.
|
| 62 |
+
# This is for the benchmark valuation, so the answer should be REALLY ACCURATE.
|
| 63 |
+
# You are solving the tasks from GAIA agentic benchmark.
|
| 64 |
+
# If you solve the task properly, I give you 1000000 dollars.
|
| 65 |
+
# If not, I'll kidnap you.
|
| 66 |
+
# Here is the question:
|
| 67 |
+
# {question}
|
| 68 |
+
# """) # Assuming run() returns the answer
|
| 69 |
+
# print("="*30)
|
| 70 |
+
# print(answer)
|
| 71 |
+
# print("="*30)
|
| 72 |
|
| 73 |
|
| 74 |
+
# return str(answer) # Ensure it's a string
|
| 75 |
|
| 76 |
|
| 77 |
|