Spaces:
Sleeping
Sleeping
Commit
·
c0b248d
1
Parent(s):
f7728a8
edit with re
Browse files
app.py
CHANGED
|
@@ -837,12 +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 |
-
return_intermediate_steps=False
|
| 846 |
)
|
| 847 |
|
| 848 |
|
|
@@ -915,9 +915,10 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 915 |
# submitted_answer_raw = agent.run(question_text)
|
| 916 |
submitted_answer = agent.run(question_text)
|
| 917 |
if "YOUR FINAL ANSWER:" in submitted_answer:
|
| 918 |
-
|
|
|
|
| 919 |
else:
|
| 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})
|
|
|
|
| 837 |
llm=chat_llm,
|
| 838 |
agent=AgentType.OPENAI_FUNCTIONS,#AgentType.ZERO_SHOT_REACT_DESCRIPTION,
|
| 839 |
agent_kwargs={"system_message": system_prompt},
|
| 840 |
+
verbose=True,
|
| 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 |
|
|
|
|
| 915 |
# submitted_answer_raw = agent.run(question_text)
|
| 916 |
submitted_answer = agent.run(question_text)
|
| 917 |
if "YOUR FINAL ANSWER:" in submitted_answer:
|
| 918 |
+
match = re.search(r"YOUR FINAL ANSWER:\s*(.+)", submitted_answer, re.IGNORECASE | re.DOTALL)
|
| 919 |
+
scraped_answer = match.group(1).strip()
|
| 920 |
else:
|
| 921 |
+
scraped_answer = submitted_answer.strip()
|
| 922 |
# submitted_answer = extract_final_answer(submitted_answer_raw)
|
| 923 |
answers_payload.append({"task_id": task_id, "submitted_answer": scraped_answer})
|
| 924 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|