KoRiF commited on
Commit
5b8c340
·
1 Parent(s): 67479b4

pass context to the question answering

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -19,10 +19,10 @@ class JeSaisToutAgent(GAIAAnsweringWorkflow):
19
  def __init__(self):
20
  super().__init__()
21
  print("Agentics Workflow initialized.")
22
- def __call__(self, question: str) -> str:
23
  print(f"Agent received question (first 50 chars): {question[:50]}...")
24
  answer = "This is a default answer."
25
- answer=super().__call__(question)
26
  print(f"Agent returning answer: {answer}")
27
  return answer
28
 
@@ -83,11 +83,15 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
83
  for item in questions_data:
84
  task_id = item.get("task_id")
85
  question_text = item.get("question")
 
 
 
 
86
  if not task_id or question_text is None:
87
  print(f"Skipping item with missing task_id or question: {item}")
88
  continue
89
  try:
90
- submitted_answer = agent(question_text)
91
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
92
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
93
  except Exception as e:
 
19
  def __init__(self):
20
  super().__init__()
21
  print("Agentics Workflow initialized.")
22
+ def __call__(self, question: str, context) -> str:
23
  print(f"Agent received question (first 50 chars): {question[:50]}...")
24
  answer = "This is a default answer."
25
+ answer=super().__call__(question, context)
26
  print(f"Agent returning answer: {answer}")
27
  return answer
28
 
 
83
  for item in questions_data:
84
  task_id = item.get("task_id")
85
  question_text = item.get("question")
86
+ question_context = item
87
+ print(f"=== item[{task_id}]===")
88
+ print(item)
89
+ print("\n")
90
  if not task_id or question_text is None:
91
  print(f"Skipping item with missing task_id or question: {item}")
92
  continue
93
  try:
94
+ submitted_answer = agent(question_text, question_context)
95
  answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
96
  results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
97
  except Exception as e: