Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -167,8 +167,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 167 |
)
|
| 168 |
|
| 169 |
prompt = PromptTemplate(
|
| 170 |
-
|
| 171 |
-
input_variables=["input", "agent_scratchpad", "tool_names"],
|
| 172 |
template="""
|
| 173 |
You are a smart and helpful AI Agent/Assistant that excels at fact-based reasoning. You are allowed and encouraged to use one or more tools as needed to answer complex questions and perform tasks.
|
| 174 |
It is CRUCIAL that you ALWAYS follow the exact format below. Do not deviate.
|
|
@@ -305,6 +304,8 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 305 |
Final Answer: LUX
|
| 306 |
|
| 307 |
---
|
|
|
|
|
|
|
| 308 |
|
| 309 |
New input: {input}
|
| 310 |
---
|
|
@@ -312,8 +313,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 312 |
"""
|
| 313 |
)
|
| 314 |
|
| 315 |
-
|
| 316 |
-
summary_memory = None
|
| 317 |
|
| 318 |
|
| 319 |
# Initialize gemini model with streaming enabled
|
|
@@ -384,7 +384,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 384 |
full_question_for_agent += f"\n\nAttachment '{file_name}' available at EXACT URL: {attachment_url}"
|
| 385 |
print(f"Running agent on task {task_id}: {full_question_for_agent}",flush=True)
|
| 386 |
|
| 387 |
-
|
| 388 |
allowed_ids = {
|
| 389 |
#"cca530fc-4052-43b2-b130-b30968d8aa44",
|
| 390 |
#"a1e91b78-d3d8-4675-bb8d-62741b4b68a6",
|
|
@@ -397,7 +397,7 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 397 |
}
|
| 398 |
if task_id not in allowed_ids:
|
| 399 |
continue
|
| 400 |
-
|
| 401 |
try:
|
| 402 |
submitted_answer = agent(full_question_for_agent)
|
| 403 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
|
|
|
| 167 |
)
|
| 168 |
|
| 169 |
prompt = PromptTemplate(
|
| 170 |
+
input_variables=["input", "agent_scratchpad", "chat_history", "tool_names"],
|
|
|
|
| 171 |
template="""
|
| 172 |
You are a smart and helpful AI Agent/Assistant that excels at fact-based reasoning. You are allowed and encouraged to use one or more tools as needed to answer complex questions and perform tasks.
|
| 173 |
It is CRUCIAL that you ALWAYS follow the exact format below. Do not deviate.
|
|
|
|
| 304 |
Final Answer: LUX
|
| 305 |
|
| 306 |
---
|
| 307 |
+
Previous conversation history:
|
| 308 |
+
{chat_history}
|
| 309 |
|
| 310 |
New input: {input}
|
| 311 |
---
|
|
|
|
| 313 |
"""
|
| 314 |
)
|
| 315 |
|
| 316 |
+
summary_memory = ConversationSummaryMemory(llm=llm_client, memory_key="chat_history")
|
|
|
|
| 317 |
|
| 318 |
|
| 319 |
# Initialize gemini model with streaming enabled
|
|
|
|
| 384 |
full_question_for_agent += f"\n\nAttachment '{file_name}' available at EXACT URL: {attachment_url}"
|
| 385 |
print(f"Running agent on task {task_id}: {full_question_for_agent}",flush=True)
|
| 386 |
|
| 387 |
+
'''
|
| 388 |
allowed_ids = {
|
| 389 |
#"cca530fc-4052-43b2-b130-b30968d8aa44",
|
| 390 |
#"a1e91b78-d3d8-4675-bb8d-62741b4b68a6",
|
|
|
|
| 397 |
}
|
| 398 |
if task_id not in allowed_ids:
|
| 399 |
continue
|
| 400 |
+
'''
|
| 401 |
try:
|
| 402 |
submitted_answer = agent(full_question_for_agent)
|
| 403 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|