Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -151,32 +151,28 @@ class BasicAgent():
|
|
| 151 |
try:
|
| 152 |
prompt = f"""
|
| 153 |
You are Alfred, an intelligent assistant with access to multiple tools.
|
| 154 |
-
To answer questions:
|
| 155 |
-
1. ANALYZE the question to identify the type of task.
|
| 156 |
-
2. USE the appropriate tool:
|
| 157 |
-
- For mathematical calculations: use PythonCodeTool
|
| 158 |
-
- To read Excel/CSV files: use PythonCodeTool with pandas
|
| 159 |
-
- For information retrieval: use DuckDuckGoSearchTool, then VisitWebpageTool if needed or WikipediaSearchTool
|
| 160 |
-
- For speech-to-text: use SpeechToTextTool
|
| 161 |
-
- For data processing: use PythonCodeTool
|
| 162 |
-
- RETURN only the final answer, clearly and concisely.
|
| 163 |
|
| 164 |
-
|
| 165 |
|
| 166 |
-
|
| 167 |
-
- For a calculation or number : "42"
|
| 168 |
-
- For a date: "March 15, 2023"
|
| 169 |
-
- For a name: "Albert Einstein"
|
| 170 |
-
- For a list: "b, e"
|
| 171 |
|
| 172 |
-
|
| 173 |
-
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
|
|
|
| 178 |
|
| 179 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
|
| 181 |
# Utiliser Alfred pour traiter la question
|
| 182 |
response = self.alfred.run(prompt)
|
|
|
|
| 151 |
try:
|
| 152 |
prompt = f"""
|
| 153 |
You are Alfred, an intelligent assistant with access to multiple tools.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 154 |
|
| 155 |
+
IMPORTANT: You MUST attempt to answer every question. Only say you cannot answer if you truly have no way to help.
|
| 156 |
|
| 157 |
+
For the question: "{question}"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
|
| 159 |
+
1. ANALYZE what type of information or calculation is needed
|
| 160 |
+
2. USE the most appropriate tool:
|
| 161 |
+
- For math/calculations: use PythonInterpreterTool with code
|
| 162 |
+
- For Excel/CSV files: use ExcelToTextTool or PythonInterpreterTool with pandas
|
| 163 |
+
- For web search/facts: use DuckDuckGoSearchTool, then VisitWebpageTool if needed
|
| 164 |
+
- For Wikipedia info: use WikipediaSearchTool
|
| 165 |
+
- For data analysis: use PythonInterpreterTool
|
| 166 |
|
| 167 |
+
3. PROVIDE a direct, concise answer based on your findings
|
| 168 |
+
|
| 169 |
+
Answer format rules:
|
| 170 |
+
- Numbers: just the number (e.g., "42", "3.14")
|
| 171 |
+
- Names: just the name (e.g., "Albert Einstein")
|
| 172 |
+
- Lists: comma-separated (e.g., "a, b, c")
|
| 173 |
+
- No extra text, quotes, or explanations
|
| 174 |
+
|
| 175 |
+
Think step by step and use your tools to find the answer."""
|
| 176 |
|
| 177 |
# Utiliser Alfred pour traiter la question
|
| 178 |
response = self.alfred.run(prompt)
|