Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,7 +10,24 @@ from smolagents import CodeAgent, DuckDuckGoSearchTool, OpenAIServerModel, Wikip
|
|
| 10 |
# --- Constants ---
|
| 11 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 12 |
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
# --- Basic Agent Definition ---
|
| 15 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
| 16 |
class BasicAgent:
|
|
@@ -23,6 +40,7 @@ class BasicAgent:
|
|
| 23 |
self.agent = CodeAgent(
|
| 24 |
model = model,
|
| 25 |
tools=[search_tool,wiki_search],
|
|
|
|
| 26 |
|
| 27 |
)
|
| 28 |
|
|
|
|
| 10 |
# --- Constants ---
|
| 11 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 12 |
|
| 13 |
+
SYSTEM_PROMPT = """
|
| 14 |
+
You are GAIA-Bot, a fully-autonomous problem-solver.
|
| 15 |
+
• For each question, THINK step-by-step before answering.
|
| 16 |
+
• When outside knowledge or calculations are needed, CALL an appropriate tool.
|
| 17 |
+
• Explain your reasoning only to yourself (in “Thought” messages); do NOT reveal it to the user.
|
| 18 |
+
• After finishing all reasoning, RESPOND with **only** the final answer string—no pre-amble, no labels, no extra text.
|
| 19 |
+
You have access to these tools:
|
| 20 |
+
- gaia_file_fetch – download the file attached to the current task_id.
|
| 21 |
+
- duckduckgo_search – look up current facts on the public web.
|
| 22 |
+
If you require a file attached to the current task, download it with
|
| 23 |
+
`requests_get("https://agents-course-unit4-scoring.hf.space/files/{task_id}")`
|
| 24 |
+
and parse it inside Python.
|
| 25 |
+
Adhere strictly to these rules:
|
| 26 |
+
1. Use tools whenever they can reduce hallucination.
|
| 27 |
+
2. Never mention tool names or JSON in your final answer.
|
| 28 |
+
3. If you cannot find an answer, return “unknown”.
|
| 29 |
+
Begin.
|
| 30 |
+
"""
|
| 31 |
# --- Basic Agent Definition ---
|
| 32 |
# ----- THIS IS WERE YOU CAN BUILD WHAT YOU WANT ------
|
| 33 |
class BasicAgent:
|
|
|
|
| 40 |
self.agent = CodeAgent(
|
| 41 |
model = model,
|
| 42 |
tools=[search_tool,wiki_search],
|
| 43 |
+
prompt=SYSTEM_PROMPT,
|
| 44 |
|
| 45 |
)
|
| 46 |
|