Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,12 +24,20 @@ class BasicAgent:
|
|
| 24 |
self.graph = build_graph()
|
| 25 |
|
| 26 |
def __call__(self, question: str) -> str:
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
|
| 35 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
@@ -108,7 +116,12 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 108 |
return "Agent did not produce any answers to submit.", pd.DataFrame(results_log)
|
| 109 |
|
| 110 |
# 4. Prepare Submission
|
| 111 |
-
print(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
|
| 113 |
submission_data = {
|
| 114 |
"username": username.strip(),
|
|
|
|
| 24 |
self.graph = build_graph()
|
| 25 |
|
| 26 |
def __call__(self, question: str) -> str:
|
| 27 |
+
print(f"Agent received question (first 50 chars): {question[:50]}...")
|
| 28 |
+
messages = [HumanMessage(content=question)]
|
| 29 |
+
response = self.graph.invoke({"messages": messages})
|
| 30 |
+
raw_output = response["messages"][-1].content.strip()
|
| 31 |
+
|
| 32 |
+
# Validate and clean answer
|
| 33 |
+
if raw_output.startswith("FINAL ANSWER:"):
|
| 34 |
+
final_answer = raw_output[len("FINAL ANSWER:"):].strip()
|
| 35 |
+
else:
|
| 36 |
+
final_answer = raw_output.strip() # fallback if not formatted properly
|
| 37 |
+
print("⚠️ Output missing 'FINAL ANSWER:' prefix.")
|
| 38 |
+
|
| 39 |
+
return final_answer
|
| 40 |
+
|
| 41 |
|
| 42 |
|
| 43 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
|
|
| 116 |
return "Agent did not produce any answers to submit.", pd.DataFrame(results_log)
|
| 117 |
|
| 118 |
# 4. Prepare Submission
|
| 119 |
+
print("Sanitized submission preview:")
|
| 120 |
+
print("username →", repr(username))
|
| 121 |
+
print("agent_code →", repr(agent_code))
|
| 122 |
+
for a in answers_payload[:3]: # Show first few answers
|
| 123 |
+
print("sample answer →", repr(a))
|
| 124 |
+
|
| 125 |
|
| 126 |
submission_data = {
|
| 127 |
"username": username.strip(),
|