Spaces:
Runtime error
Runtime error
update prompt + subset questions
Browse files
app.py
CHANGED
|
@@ -171,6 +171,8 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 171 |
template="""
|
| 172 |
You are a smart and helpful AI Agent/Assistant. 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 |
You have access to the following tools:
|
| 176 |
{tools}
|
|
@@ -187,7 +189,8 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 187 |
- If the input contains the exact phrase "Attachment '{{file_name}}' available at: {{attachment_url}}" (where '{{file_name}}' and '{{attachment_url}}' are placeholders for actual values), consider the file type:
|
| 188 |
- If the file type is binary/text (e.g., .xlsx, .docx, .mp3, .jpg, .pdf,.png), you MUST use the 'file_saver' tool to download and save it.
|
| 189 |
For 'file_saver', the Action Input must be a JSON string like: '{{"url": "the_attachment_url", "local_filename": "the_file_name_from_attachment"}}'
|
| 190 |
-
|
|
|
|
| 191 |
|
| 192 |
IMPORTANT: When processing audio files (like .mp3) that have been saved using 'file_saver', the 'audio_transcriber_tool' MUST be used with the 'local_filename' of the saved audio file as its Action Input. Do NOT pass URLs or remote paths directly to 'audio_transcriber_tool'.
|
| 193 |
|
|
@@ -303,7 +306,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 303 |
attachment_url = f"https://agents-course-unit4-scoring.hf.space/files/{task_id}"
|
| 304 |
full_question_for_agent += f"\n\nAttachment '{file_name}' available at EXACT URL: {attachment_url}"
|
| 305 |
print(f"Running agent on task {task_id}: {full_question_for_agent}",flush=True)
|
| 306 |
-
|
| 307 |
allowed_ids = {
|
| 308 |
"7bd855d8-463d-4ed5-93ca-5fe35145f733",
|
| 309 |
#"cca530fc-4052-43b2-b130-b30968d8aa44",
|
|
@@ -314,7 +317,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 314 |
}
|
| 315 |
if task_id not in allowed_ids:
|
| 316 |
continue
|
| 317 |
-
|
| 318 |
|
| 319 |
try:
|
| 320 |
submitted_answer = agent(full_question_for_agent)
|
|
|
|
| 171 |
template="""
|
| 172 |
You are a smart and helpful AI Agent/Assistant. 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 |
+
NOTE: it is MANDATORY for you to be precise and concise in your response. Respond directly with ONLY the answer, without any introductory phrases or additional details.
|
| 175 |
+
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."
|
| 176 |
|
| 177 |
You have access to the following tools:
|
| 178 |
{tools}
|
|
|
|
| 189 |
- If the input contains the exact phrase "Attachment '{{file_name}}' available at: {{attachment_url}}" (where '{{file_name}}' and '{{attachment_url}}' are placeholders for actual values), consider the file type:
|
| 190 |
- If the file type is binary/text (e.g., .xlsx, .docx, .mp3, .jpg, .pdf,.png), you MUST use the 'file_saver' tool to download and save it.
|
| 191 |
For 'file_saver', the Action Input must be a JSON string like: '{{"url": "the_attachment_url", "local_filename": "the_file_name_from_attachment"}}'
|
| 192 |
+
example: for input, Attachment '1f975693-876d-457b-a649-393859e79bf3.mp3' available at EXACT URL: https://agents-course-unit4-scoring.hf.space/files/1f975693-876d-457b-a649-393859e79bf3, Action Input for file_saver would be '{{"url": "https://agents-course-unit4-scoring.hf.space/files/1f975693-876d-457b-a649-393859e79bf3", "local_filename": "1f975693-876d-457b-a649-393859e79bf3.mp3"}}'
|
| 193 |
+
|
| 194 |
|
| 195 |
IMPORTANT: When processing audio files (like .mp3) that have been saved using 'file_saver', the 'audio_transcriber_tool' MUST be used with the 'local_filename' of the saved audio file as its Action Input. Do NOT pass URLs or remote paths directly to 'audio_transcriber_tool'.
|
| 196 |
|
|
|
|
| 306 |
attachment_url = f"https://agents-course-unit4-scoring.hf.space/files/{task_id}"
|
| 307 |
full_question_for_agent += f"\n\nAttachment '{file_name}' available at EXACT URL: {attachment_url}"
|
| 308 |
print(f"Running agent on task {task_id}: {full_question_for_agent}",flush=True)
|
| 309 |
+
|
| 310 |
allowed_ids = {
|
| 311 |
"7bd855d8-463d-4ed5-93ca-5fe35145f733",
|
| 312 |
#"cca530fc-4052-43b2-b130-b30968d8aa44",
|
|
|
|
| 317 |
}
|
| 318 |
if task_id not in allowed_ids:
|
| 319 |
continue
|
| 320 |
+
|
| 321 |
|
| 322 |
try:
|
| 323 |
submitted_answer = agent(full_question_for_agent)
|