Update app.py
Browse files
app.py
CHANGED
|
@@ -126,6 +126,21 @@ def wikipedia_search(query: str) -> str:
|
|
| 126 |
# === Constants ===
|
| 127 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 128 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
# === BasicAgent ===
|
| 130 |
class BasicAgent:
|
| 131 |
def __init__(self):
|
|
@@ -135,7 +150,10 @@ class BasicAgent:
|
|
| 135 |
temperature=0.5,
|
| 136 |
)
|
| 137 |
|
| 138 |
-
|
|
|
|
|
|
|
|
|
|
| 139 |
|
| 140 |
self.rag_fallbacks = {
|
| 141 |
"Mercedes Sosa": "Mercedes Sosa released **5** studio albums between 2000–2009.",
|
|
|
|
| 126 |
# === Constants ===
|
| 127 |
DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
|
| 128 |
|
| 129 |
+
# === Tool 7: Final Answer Tool ===
|
| 130 |
+
@tool
|
| 131 |
+
def final_answer(text: str) -> str:
|
| 132 |
+
"""
|
| 133 |
+
Wraps and formats the final answer clearly for scoring.
|
| 134 |
+
|
| 135 |
+
Args:
|
| 136 |
+
text: The conclusive answer.
|
| 137 |
+
|
| 138 |
+
Returns:
|
| 139 |
+
A string in the format 'Final Answer: ...'
|
| 140 |
+
"""
|
| 141 |
+
return f"Final Answer: {text}"
|
| 142 |
+
|
| 143 |
+
|
| 144 |
# === BasicAgent ===
|
| 145 |
class BasicAgent:
|
| 146 |
def __init__(self):
|
|
|
|
| 150 |
temperature=0.5,
|
| 151 |
)
|
| 152 |
|
| 153 |
+
# Already defined above
|
| 154 |
+
# No need to instantiate it like a class
|
| 155 |
+
# So we just use `final_answer` as a reference to the tool
|
| 156 |
+
|
| 157 |
|
| 158 |
self.rag_fallbacks = {
|
| 159 |
"Mercedes Sosa": "Mercedes Sosa released **5** studio albums between 2000–2009.",
|