Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,7 +29,6 @@ llm = ChatGroq(
|
|
| 29 |
)
|
| 30 |
|
| 31 |
system_prompt = """You are an AI assistant taking the GAIA benchmark. You must output ONLY the final answer. Do not include any explanations, conversational text or formatting. If the answer is a number, output just the number. If it is a list, output a comma-separated list."""
|
| 32 |
-
chat = ChatHuggingFace(llm=llm, verbose=True)
|
| 33 |
|
| 34 |
# Tool Definition
|
| 35 |
search_tool = DuckDuckGoSearchRun()
|
|
@@ -56,7 +55,7 @@ def python_repl(code:str) -> str:
|
|
| 56 |
|
| 57 |
# Tools Instantiation
|
| 58 |
tools = [search_tool, python_repl]
|
| 59 |
-
chat_with_tools =
|
| 60 |
|
| 61 |
class AgentState(TypedDict):
|
| 62 |
messages:Annotated[list[AnyMessage], add_messages]
|
|
@@ -177,6 +176,11 @@ def run_and_submit_all( profile: gr.OAuthProfile | None):
|
|
| 177 |
submitted_answer = agent(question_text, file_name)
|
| 178 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 179 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
except Exception as e:
|
| 181 |
print(f"Error running agent on task {task_id}: {e}")
|
| 182 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
|
|
|
|
| 29 |
)
|
| 30 |
|
| 31 |
system_prompt = """You are an AI assistant taking the GAIA benchmark. You must output ONLY the final answer. Do not include any explanations, conversational text or formatting. If the answer is a number, output just the number. If it is a list, output a comma-separated list."""
|
|
|
|
| 32 |
|
| 33 |
# Tool Definition
|
| 34 |
search_tool = DuckDuckGoSearchRun()
|
|
|
|
| 55 |
|
| 56 |
# Tools Instantiation
|
| 57 |
tools = [search_tool, python_repl]
|
| 58 |
+
chat_with_tools = llm.bind_tools(tools)
|
| 59 |
|
| 60 |
class AgentState(TypedDict):
|
| 61 |
messages:Annotated[list[AnyMessage], add_messages]
|
|
|
|
| 176 |
submitted_answer = agent(question_text, file_name)
|
| 177 |
answers_payload.append({"task_id": task_id, "submitted_answer": submitted_answer})
|
| 178 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": submitted_answer})
|
| 179 |
+
|
| 180 |
+
# Add a 15-second pause between questions!
|
| 181 |
+
print("Pausing for 15 seconds to respect Groq rate limits...")
|
| 182 |
+
time.sleep(15)
|
| 183 |
+
|
| 184 |
except Exception as e:
|
| 185 |
print(f"Error running agent on task {task_id}: {e}")
|
| 186 |
results_log.append({"Task ID": task_id, "Question": question_text, "Submitted Answer": f"AGENT ERROR: {e}"})
|