Update app.py
Browse files
app.py
CHANGED
|
@@ -181,8 +181,11 @@ class BasicAgent:
|
|
| 181 |
max_steps=20,
|
| 182 |
)
|
| 183 |
#answering questions
|
| 184 |
-
def __call__(self, question: str) -> str:
|
| 185 |
print(f"Agent received question: {question[:50]}...")
|
|
|
|
|
|
|
|
|
|
| 186 |
try:
|
| 187 |
# Pass the incoming question to the agent
|
| 188 |
answer = self.agent.run(question)
|
|
@@ -253,7 +256,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 253 |
print(f"Skipping item with missing task_id or question: {item}")
|
| 254 |
continue
|
| 255 |
try:
|
| 256 |
-
submitted_answer = agent(question_text)
|
| 257 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 258 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
| 259 |
except Exception as e:
|
|
|
|
| 181 |
max_steps=20,
|
| 182 |
)
|
| 183 |
#answering questions
|
| 184 |
+
def __call__(self, question: str, task_id: str = None) -> str:
|
| 185 |
print(f"Agent received question: {question[:50]}...")
|
| 186 |
+
full_prompt = question
|
| 187 |
+
if task_id:
|
| 188 |
+
full_prompt = f"{question}\n\n(task_id for this question: {task_id})"
|
| 189 |
try:
|
| 190 |
# Pass the incoming question to the agent
|
| 191 |
answer = self.agent.run(question)
|
|
|
|
| 256 |
print(f"Skipping item with missing task_id or question: {item}")
|
| 257 |
continue
|
| 258 |
try:
|
| 259 |
+
submitted_answer = agent(question_text, task_id)
|
| 260 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 261 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
| 262 |
except Exception as e:
|