Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -160,6 +160,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 160 |
travily_api_search_tool = get_travily_api_search_tool(tavily_api_key)
|
| 161 |
tools = [ repl_tool, file_saver_tool,audio_transcriber_tool,travily_api_search_tool, gemini_multimodal_tool, wikipedia_search_tool2]
|
| 162 |
|
|
|
|
| 163 |
EX5_OBSERVATION_STRING = (
|
| 164 |
"[{{'title': '1977 New York Yankees Hitting Stats - Baseball-Reference.com', "
|
| 165 |
"'url': 'https://www.baseball-reference.com/teams/NYY/1977.shtml', "
|
|
@@ -171,8 +172,19 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 171 |
template="""
|
| 172 |
You are a smart and helpful AI Agent/Assistant that excels at fact-based reasoning. You are allowed and encouraged to use one or more tools as needed to answer complex questions and perform tasks.
|
| 173 |
It is CRUCIAL that you ALWAYS follow the exact format below. Do not deviate.
|
| 174 |
-
|
| 175 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
|
| 177 |
You have access to the following tools:
|
| 178 |
{tools}
|
|
@@ -203,11 +215,9 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 203 |
Thought: I have enough information, or no tool is needed.
|
| 204 |
Final Answer: [your concise/short response here]
|
| 205 |
|
| 206 |
-
|
| 207 |
-
For example, if asked for the number of letters in the English alphabet, respond with '26'. Do NOT say "The number of letters is 26."
|
| 208 |
-
VERY IMPORTANT: Your response MUST always start with 'Thought:'.
|
| 209 |
|
| 210 |
-
Here are some examples of how you should respond:
|
| 211 |
|
| 212 |
Example 1:
|
| 213 |
Question: What is the capital of France?
|
|
@@ -260,11 +270,10 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 260 |
Thought: I have used the 'gemini_multimodal_tool' to get the best move based on the image.
|
| 261 |
Final Answer: e4
|
| 262 |
|
| 263 |
-
Example 5:
|
| 264 |
Question: What is the opposite of up?
|
| 265 |
Thought: The question asks for the opposite of up. This is a direct knowledge question.
|
| 266 |
Final Answer: down
|
| 267 |
-
DO NOT RESPOND LIKE THIS: The opposite of up is down. or The answer is down.
|
| 268 |
|
| 269 |
Example 6: (New example for parsing baseball stats)
|
| 270 |
Question: How many at bats did the Yankee with the most walks in the 1977 regular season have that same season?
|
|
@@ -300,7 +309,8 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 300 |
# Example: python code to parse the text table and find the IOC country code with the least athletes.
|
| 301 |
# (Replace this with actual code as needed)
|
| 302 |
```
|
| 303 |
-
Observation: LUX
|
|
|
|
| 304 |
Final Answer: LUX
|
| 305 |
|
| 306 |
---
|
|
@@ -311,7 +321,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 311 |
---
|
| 312 |
{agent_scratchpad}
|
| 313 |
"""
|
| 314 |
-
|
| 315 |
|
| 316 |
summary_memory = ConversationSummaryMemory(llm=llm_client, memory_key="chat_history")
|
| 317 |
|
|
@@ -388,12 +398,13 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 388 |
allowed_ids = {
|
| 389 |
#"cca530fc-4052-43b2-b130-b30968d8aa44",
|
| 390 |
#"a1e91b78-d3d8-4675-bb8d-62741b4b68a6",
|
| 391 |
-
"3f57289b-8c60-48be-bd80-01f8099ca449",
|
| 392 |
#"2d83110e-a098-4ebb-9987-066c06fa42d0",
|
| 393 |
#"cf106601-ab4f-4af9-b045-5295fe67b37d",
|
| 394 |
#"7bd855d8-463d-4ed5-93ca-5fe35145f733",
|
| 395 |
-
"5a0c1adf-205e-4841-a666-7c3ef95def9d",
|
| 396 |
-
"f918266a-b3e0-4914-865d-4faa564f1aef",
|
|
|
|
| 397 |
}
|
| 398 |
if task_id not in allowed_ids:
|
| 399 |
continue
|
|
|
|
| 160 |
travily_api_search_tool = get_travily_api_search_tool(tavily_api_key)
|
| 161 |
tools = [ repl_tool, file_saver_tool,audio_transcriber_tool,travily_api_search_tool, gemini_multimodal_tool, wikipedia_search_tool2]
|
| 162 |
|
| 163 |
+
|
| 164 |
EX5_OBSERVATION_STRING = (
|
| 165 |
"[{{'title': '1977 New York Yankees Hitting Stats - Baseball-Reference.com', "
|
| 166 |
"'url': 'https://www.baseball-reference.com/teams/NYY/1977.shtml', "
|
|
|
|
| 172 |
template="""
|
| 173 |
You are a smart and helpful AI Agent/Assistant that excels at fact-based reasoning. You are allowed and encouraged to use one or more tools as needed to answer complex questions and perform tasks.
|
| 174 |
It is CRUCIAL that you ALWAYS follow the exact format below. Do not deviate.
|
| 175 |
+
|
| 176 |
+
**IMPORTANT - CONCISE FINAL ANSWER FORMATTING RULES (MANDATORY):**
|
| 177 |
+
Your FINAL ANSWER must be presented in one of these formats, and ONLY the answer itself (no introductory phrases):
|
| 178 |
+
- A number (e.g., '26', '1977', '519')
|
| 179 |
+
- As few words as possible (e.g., 'Paris', 'down', 'LUX')
|
| 180 |
+
- A comma-separated list of numbers and/or strings (e.g., '10,20,30', 'apple,banana,orange')
|
| 181 |
+
|
| 182 |
+
**STRICT RULES FOR FINAL ANSWER CONTENT:**
|
| 183 |
+
1. **Numbers:** Do NOT use commas (e.g., '1000000' instead of '1,000,000'). Do NOT use units ($ or % or degrees Celsius/Fahrenheit) unless explicitly requested in the question.
|
| 184 |
+
2. **Strings (Words):** Do NOT use articles (a, an, the). Do NOT use abbreviations (e.g., 'New York' instead of 'NYC'). Write digits in plain text unless specified otherwise (e.g., 'two' instead of '2' if it's part of a string answer and not a numerical answer).
|
| 185 |
+
3. **Comma-Separated Lists:** Apply the above rules (numbers or strings) to each element in the list.
|
| 186 |
+
|
| 187 |
+
**Your response MUST always start with 'Thought:'. Your FINAL ANSWER must be preceded by 'Final Answer: '.**
|
| 188 |
|
| 189 |
You have access to the following tools:
|
| 190 |
{tools}
|
|
|
|
| 215 |
Thought: I have enough information, or no tool is needed.
|
| 216 |
Final Answer: [your concise/short response here]
|
| 217 |
|
| 218 |
+
**VERY IMPORTANT: Your response MUST always start with 'Thought:'. Your FINAL ANSWER must be preceded by 'Final Answer: '.**
|
|
|
|
|
|
|
| 219 |
|
| 220 |
+
Here are some examples of how you should respond, strictly adhering to the formatting rules:
|
| 221 |
|
| 222 |
Example 1:
|
| 223 |
Question: What is the capital of France?
|
|
|
|
| 270 |
Thought: I have used the 'gemini_multimodal_tool' to get the best move based on the image.
|
| 271 |
Final Answer: e4
|
| 272 |
|
| 273 |
+
Example 5:
|
| 274 |
Question: What is the opposite of up?
|
| 275 |
Thought: The question asks for the opposite of up. This is a direct knowledge question.
|
| 276 |
Final Answer: down
|
|
|
|
| 277 |
|
| 278 |
Example 6: (New example for parsing baseball stats)
|
| 279 |
Question: How many at bats did the Yankee with the most walks in the 1977 regular season have that same season?
|
|
|
|
| 309 |
# Example: python code to parse the text table and find the IOC country code with the least athletes.
|
| 310 |
# (Replace this with actual code as needed)
|
| 311 |
```
|
| 312 |
+
Observation: LUX
|
| 313 |
+
Thought: I have found the country with the least athletes.
|
| 314 |
Final Answer: LUX
|
| 315 |
|
| 316 |
---
|
|
|
|
| 321 |
---
|
| 322 |
{agent_scratchpad}
|
| 323 |
"""
|
| 324 |
+
)
|
| 325 |
|
| 326 |
summary_memory = ConversationSummaryMemory(llm=llm_client, memory_key="chat_history")
|
| 327 |
|
|
|
|
| 398 |
allowed_ids = {
|
| 399 |
#"cca530fc-4052-43b2-b130-b30968d8aa44",
|
| 400 |
#"a1e91b78-d3d8-4675-bb8d-62741b4b68a6",
|
| 401 |
+
#"3f57289b-8c60-48be-bd80-01f8099ca449",
|
| 402 |
#"2d83110e-a098-4ebb-9987-066c06fa42d0",
|
| 403 |
#"cf106601-ab4f-4af9-b045-5295fe67b37d",
|
| 404 |
#"7bd855d8-463d-4ed5-93ca-5fe35145f733",
|
| 405 |
+
#"5a0c1adf-205e-4841-a666-7c3ef95def9d",
|
| 406 |
+
#"f918266a-b3e0-4914-865d-4faa564f1aef",
|
| 407 |
+
"9d191bce-651d-4746-be2d-7ef8ecadb9c2",
|
| 408 |
}
|
| 409 |
if task_id not in allowed_ids:
|
| 410 |
continue
|