Spaces:
Sleeping
Sleeping
Rename agent14.py to agent.py
Browse files- agent14.py → agent.py +5 -4
agent14.py → agent.py
RENAMED
|
@@ -217,7 +217,7 @@ class MagAgent:
|
|
| 217 |
- Use the name of the file ONLY FROM the "FILE:" section. THIS IS ALWAYS A FILE.
|
| 218 |
IMPORTANT: When giving the final answer, output only the direct required result without any extra text like "Final Answer:" or explanations. YOU MUST RESPOND IN THE EXACT FORMAT AS THE QUESTION.
|
| 219 |
QUESTION: {question}
|
| 220 |
-
|
| 221 |
ANSWER:
|
| 222 |
"""
|
| 223 |
)
|
|
@@ -240,10 +240,11 @@ class MagAgent:
|
|
| 240 |
while not self.rate_limiter.consume(1):
|
| 241 |
print(f"Rate limit reached. Waiting...")
|
| 242 |
await asyncio.sleep(4)
|
| 243 |
-
#
|
| 244 |
-
|
|
|
|
| 245 |
question=question,
|
| 246 |
-
|
| 247 |
)
|
| 248 |
print(f"Calling agent.run...")
|
| 249 |
response = await asyncio.to_thread(self.agent.run, task=task)
|
|
|
|
| 217 |
- Use the name of the file ONLY FROM the "FILE:" section. THIS IS ALWAYS A FILE.
|
| 218 |
IMPORTANT: When giving the final answer, output only the direct required result without any extra text like "Final Answer:" or explanations. YOU MUST RESPOND IN THE EXACT FORMAT AS THE QUESTION.
|
| 219 |
QUESTION: {question}
|
| 220 |
+
{file_section}
|
| 221 |
ANSWER:
|
| 222 |
"""
|
| 223 |
)
|
|
|
|
| 240 |
while not self.rate_limiter.consume(1):
|
| 241 |
print(f"Rate limit reached. Waiting...")
|
| 242 |
await asyncio.sleep(4)
|
| 243 |
+
# Conditionally include FILE: section only if file_path is provided
|
| 244 |
+
file_section = f"FILE: {file_path}" if file_path else ""
|
| 245 |
+
task = self.prompt_template.format(
|
| 246 |
question=question,
|
| 247 |
+
file_section=file_section
|
| 248 |
)
|
| 249 |
print(f"Calling agent.run...")
|
| 250 |
response = await asyncio.to_thread(self.agent.run, task=task)
|