Spaces:
Runtime error
Runtime error
Sheshank Joshi
commited on
Commit
·
72ae3ec
1
Parent(s):
7e3e394
latest change for adding reasoning agents
Browse files- __pycache__/reasoning_agent.cpython-312.pyc +0 -0
- app.py +4 -1
- reasoning_agent.py +2 -1
__pycache__/reasoning_agent.cpython-312.pyc
CHANGED
|
Binary files a/__pycache__/reasoning_agent.cpython-312.pyc and b/__pycache__/reasoning_agent.cpython-312.pyc differ
|
|
|
app.py
CHANGED
|
@@ -90,14 +90,17 @@ def run_and_submit_all(profile: gr.OAuthProfile | None):
|
|
| 90 |
|
| 91 |
try:
|
| 92 |
print(f"Processing question {i+1}/{len(questions_data)}: {task_id}")
|
|
|
|
| 93 |
submitted_answer = agent(question_text)
|
|
|
|
|
|
|
| 94 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 95 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
| 96 |
|
| 97 |
# Add delay between questions to avoid rate limiting (5 seconds)
|
| 98 |
if i < len(questions_data) - 1:
|
| 99 |
print(f"Waiting 5 seconds before next question...")
|
| 100 |
-
time.sleep(5)
|
| 101 |
|
| 102 |
except Exception as e:
|
| 103 |
print(f"Error running agent on task {task_id}: {e}")
|
|
|
|
| 90 |
|
| 91 |
try:
|
| 92 |
print(f"Processing question {i+1}/{len(questions_data)}: {task_id}")
|
| 93 |
+
print("Question text:", question_text)
|
| 94 |
submitted_answer = agent(question_text)
|
| 95 |
+
print("Submitted answer:", submitted_answer)
|
| 96 |
+
print("="*15)
|
| 97 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 98 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
| 99 |
|
| 100 |
# Add delay between questions to avoid rate limiting (5 seconds)
|
| 101 |
if i < len(questions_data) - 1:
|
| 102 |
print(f"Waiting 5 seconds before next question...")
|
| 103 |
+
# time.sleep(5)
|
| 104 |
|
| 105 |
except Exception as e:
|
| 106 |
print(f"Error running agent on task {task_id}: {e}")
|
reasoning_agent.py
CHANGED
|
@@ -227,7 +227,8 @@ def generate_response(state: AgentState) -> AgentState:
|
|
| 227 |
|
| 228 |
# Create prompt for response generation
|
| 229 |
response_prompt = ChatPromptTemplate.from_messages([
|
| 230 |
-
SystemMessage(content="""Generate a helpful response to the user based on your reasoning and tool outputs. Give exact, to the point and concise one word or number as an answer.
|
|
|
|
| 231 |
("user",
|
| 232 |
"User request: {user_request}\n\nReasoning: {reasoning}\n\nTool outputs: {tool_outputs}")
|
| 233 |
])
|
|
|
|
| 227 |
|
| 228 |
# Create prompt for response generation
|
| 229 |
response_prompt = ChatPromptTemplate.from_messages([
|
| 230 |
+
SystemMessage(content="""Generate a helpful response to the user based on your reasoning and tool outputs. Give exact, to the point and concise one word or number as an answer.
|
| 231 |
+
No explanation is needed at all. Make sure that if numerical number is asked, you return only a number and nothing else. If you don't know the answer, make a guess from your training data, but don't return None. Return answer in only the language in which the question was asked."""),
|
| 232 |
("user",
|
| 233 |
"User request: {user_request}\n\nReasoning: {reasoning}\n\nTool outputs: {tool_outputs}")
|
| 234 |
])
|