Update app.py
Browse files
app.py
CHANGED
|
@@ -44,16 +44,10 @@ class BasicAgent:
|
|
| 44 |
except Exception as e:
|
| 45 |
print(f"Warning: Could not load test_questions.csv: {e}")
|
| 46 |
# Load test_answers.json into a dict for fast lookup (second priority)
|
| 47 |
-
|
| 48 |
-
answers = json.load(f)
|
| 49 |
-
self.taskid_to_answer = {item["task_id"]: item["answer"] for item in answers}
|
| 50 |
|
| 51 |
def __call__(self, question: str, task_id: str = None) -> str:
|
| 52 |
|
| 53 |
-
if task_id and task_id in self.csv_taskid_to_answer:
|
| 54 |
-
print(f"Answering from test_questions.csv for task_id {task_id}")
|
| 55 |
-
return self.csv_taskid_to_answer[task_id]
|
| 56 |
-
|
| 57 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 58 |
messages = [HumanMessage(content=question)]
|
| 59 |
messages = self.graph.invoke({"messages": messages})
|
|
|
|
| 44 |
except Exception as e:
|
| 45 |
print(f"Warning: Could not load test_questions.csv: {e}")
|
| 46 |
# Load test_answers.json into a dict for fast lookup (second priority)
|
| 47 |
+
|
|
|
|
|
|
|
| 48 |
|
| 49 |
def __call__(self, question: str, task_id: str = None) -> str:
|
| 50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 52 |
messages = [HumanMessage(content=question)]
|
| 53 |
messages = self.graph.invoke({"messages": messages})
|