Spaces:
Sleeping
Sleeping
graph test
Browse files
app.py
CHANGED
|
@@ -97,11 +97,11 @@ class BasicAgent:
|
|
| 97 |
return res.get("answer", "N/A")
|
| 98 |
|
| 99 |
def log_question(self, state: AnswerState) -> Dict[str, Any]:
|
| 100 |
-
print(f"Agent received question: {state['question']}...")
|
| 101 |
return {}
|
| 102 |
|
| 103 |
def final_answer(self, state: AnswerState) -> Dict[str, Any]:
|
| 104 |
-
print(f"Agent returning answer: {state['answer']}")
|
| 105 |
answer = state["answer"] if state["answer"] else "I don't know"
|
| 106 |
return {
|
| 107 |
"answer": answer,
|
|
@@ -109,6 +109,8 @@ class BasicAgent:
|
|
| 109 |
}
|
| 110 |
|
| 111 |
def try_answer(self, state: AnswerState) -> str:
|
|
|
|
|
|
|
| 112 |
messages = [HumanMessage(content=PROMPT.format(question=state["question"]))]
|
| 113 |
response = self.model.invoke(messages)
|
| 114 |
print(f"Agent response: {response.content}")
|
|
@@ -184,7 +186,7 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
| 184 |
results_log = []
|
| 185 |
answers_payload = []
|
| 186 |
print(f"Running agent on {len(questions_data)} questions...")
|
| 187 |
-
for item in questions_data[:
|
| 188 |
task_id = item.get("task_id")
|
| 189 |
question_text = item.get("question")
|
| 190 |
if not task_id or question_text is None:
|
|
|
|
| 97 |
return res.get("answer", "N/A")
|
| 98 |
|
| 99 |
def log_question(self, state: AnswerState) -> Dict[str, Any]:
|
| 100 |
+
print(f"[log_question] Agent received question: {state['question']}...")
|
| 101 |
return {}
|
| 102 |
|
| 103 |
def final_answer(self, state: AnswerState) -> Dict[str, Any]:
|
| 104 |
+
print(f"[final_answer] Agent returning answer: {state['answer']}")
|
| 105 |
answer = state["answer"] if state["answer"] else "I don't know"
|
| 106 |
return {
|
| 107 |
"answer": answer,
|
|
|
|
| 109 |
}
|
| 110 |
|
| 111 |
def try_answer(self, state: AnswerState) -> str:
|
| 112 |
+
print("[final_answer] Agent trying to answer")
|
| 113 |
+
|
| 114 |
messages = [HumanMessage(content=PROMPT.format(question=state["question"]))]
|
| 115 |
response = self.model.invoke(messages)
|
| 116 |
print(f"Agent response: {response.content}")
|
|
|
|
| 186 |
results_log = []
|
| 187 |
answers_payload = []
|
| 188 |
print(f"Running agent on {len(questions_data)} questions...")
|
| 189 |
+
for item in questions_data[:1]:
|
| 190 |
task_id = item.get("task_id")
|
| 191 |
question_text = item.get("question")
|
| 192 |
if not task_id or question_text is None:
|