Spaces:
Sleeping
Sleeping
Commit
·
7db1ce5
1
Parent(s):
b86e7fd
edited the final answer
Browse files
app.py
CHANGED
|
@@ -733,7 +733,7 @@ Action: (the tool to use, if needed)
|
|
| 733 |
Action Input: (input to the tool)
|
| 734 |
Observation: (result of the tool call)
|
| 735 |
|
| 736 |
-
Repeat this process as needed. ONLY AFTER finishing your reasoning and/or tool use, provide
|
| 737 |
YOUR FINAL ANSWER should be just a number, string, or comma-separated list with no explanations and no thoughts, but just the answer
|
| 738 |
|
| 739 |
You also have access to a set of tools, which you can use to answer the question. The available tools are:
|
|
@@ -837,11 +837,12 @@ agent = initialize_agent(
|
|
| 837 |
llm=chat_llm,
|
| 838 |
agent=AgentType.OPENAI_FUNCTIONS,#AgentType.ZERO_SHOT_REACT_DESCRIPTION,
|
| 839 |
agent_kwargs={"system_message": system_prompt},
|
| 840 |
-
verbose=
|
| 841 |
max_iterations=15, # Increase as needed
|
| 842 |
max_execution_time=4000, # Increase as needed
|
| 843 |
early_stopping_method="generate",
|
| 844 |
-
handle_parsing_errors=True
|
|
|
|
| 845 |
)
|
| 846 |
|
| 847 |
|
|
@@ -913,8 +914,12 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 913 |
# submitted_answer = agent.run(full_prompt)
|
| 914 |
# submitted_answer_raw = agent.run(question_text)
|
| 915 |
submitted_answer = agent.run(question_text)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 916 |
# submitted_answer = extract_final_answer(submitted_answer_raw)
|
| 917 |
-
answers_payload.append({"task_id": task_id, "submitted_answer":
|
| 918 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
| 919 |
except Exception as e:
|
| 920 |
print(f"Error running agent on task {task_id}: {e}")
|
|
|
|
| 733 |
Action Input: (input to the tool)
|
| 734 |
Observation: (result of the tool call)
|
| 735 |
|
| 736 |
+
Repeat this process as needed. ONLY AFTER finishing your reasoning and/or tool use, provide YOUR FINAL ANSWER
|
| 737 |
YOUR FINAL ANSWER should be just a number, string, or comma-separated list with no explanations and no thoughts, but just the answer
|
| 738 |
|
| 739 |
You also have access to a set of tools, which you can use to answer the question. The available tools are:
|
|
|
|
| 837 |
llm=chat_llm,
|
| 838 |
agent=AgentType.OPENAI_FUNCTIONS,#AgentType.ZERO_SHOT_REACT_DESCRIPTION,
|
| 839 |
agent_kwargs={"system_message": system_prompt},
|
| 840 |
+
verbose=False,
|
| 841 |
max_iterations=15, # Increase as needed
|
| 842 |
max_execution_time=4000, # Increase as needed
|
| 843 |
early_stopping_method="generate",
|
| 844 |
+
handle_parsing_errors=True,
|
| 845 |
+
return_intermediate_steps=False
|
| 846 |
)
|
| 847 |
|
| 848 |
|
|
|
|
| 914 |
# submitted_answer = agent.run(full_prompt)
|
| 915 |
# submitted_answer_raw = agent.run(question_text)
|
| 916 |
submitted_answer = agent.run(question_text)
|
| 917 |
+
try:
|
| 918 |
+
scraped_answer = submitted_answer.split("YOUR FINAL ANSWER:")[-1].strip()
|
| 919 |
+
except:
|
| 920 |
+
scraped_answer = submitted_answer
|
| 921 |
# submitted_answer = extract_final_answer(submitted_answer_raw)
|
| 922 |
+
answers_payload.append({"task_id": task_id, "submitted_answer": scraped_answer})
|
| 923 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
| 924 |
except Exception as e:
|
| 925 |
print(f"Error running agent on task {task_id}: {e}")
|