Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -100,8 +100,19 @@ Always end with just the direct answer the question asks for."""
|
|
100 |
|
101 |
try:
|
102 |
# Let the CodeAgent handle everything with ReAct pattern
|
103 |
-
#
|
104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
105 |
|
106 |
final_answer = str(result).strip()
|
107 |
print(f"Agent answer: {final_answer}")
|
@@ -118,6 +129,7 @@ Always end with just the direct answer the question asks for."""
|
|
118 |
print("Smolagents not available - using basic fallback")
|
119 |
return "Smolagents required but not available"
|
120 |
|
|
|
121 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
122 |
"""
|
123 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|
|
|
100 |
|
101 |
try:
|
102 |
# Let the CodeAgent handle everything with ReAct pattern
|
103 |
+
# We'll include formatting instructions in our prompt
|
104 |
+
formatted_question = f"""Please answer this question with just the direct answer needed (no prefixes like "The answer is"):
|
105 |
+
|
106 |
+
{question}
|
107 |
+
|
108 |
+
Important:
|
109 |
+
- For numbers, provide just the number
|
110 |
+
- For names/words, provide just the name/word
|
111 |
+
- For yes/no questions, answer just "Yes" or "No"
|
112 |
+
- Use web search when you need current information
|
113 |
+
- Write Python code for calculations or data processing"""
|
114 |
+
|
115 |
+
result = self.agent.run(formatted_question)
|
116 |
|
117 |
final_answer = str(result).strip()
|
118 |
print(f"Agent answer: {final_answer}")
|
|
|
129 |
print("Smolagents not available - using basic fallback")
|
130 |
return "Smolagents required but not available"
|
131 |
|
132 |
+
|
133 |
def run_and_submit_all( profile: gr.OAuthProfile | None):
|
134 |
"""
|
135 |
Fetches all questions, runs the BasicAgent on them, submits all answers,
|