Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -373,10 +373,10 @@ class SlpMultiAgent:
|
|
| 373 |
|
| 374 |
# Simplified research agent
|
| 375 |
research_agent = CodeAgent(
|
| 376 |
-
tools=[GoogleSearchTool(), KnowledgeBaseTool()],
|
| 377 |
model=model if not isinstance(model, GeminiModel) else OpenAIServerModel(model_id="gpt-3.5-turbo", temperature=0.0, max_tokens=400),
|
| 378 |
additional_authorized_imports=["re", "json"],
|
| 379 |
-
max_steps=
|
| 380 |
name="ResearchAgent",
|
| 381 |
verbosity_level=0,
|
| 382 |
description="Simple research with Google Search."
|
|
@@ -386,7 +386,7 @@ class SlpMultiAgent:
|
|
| 386 |
tools=[MathTool(), GoogleSearchTool()],
|
| 387 |
model=model if not isinstance(model, GeminiModel) else OpenAIServerModel(model_id="gpt-3.5-turbo", temperature=0.0, max_tokens=400),
|
| 388 |
additional_authorized_imports=["math", "re"],
|
| 389 |
-
max_steps=
|
| 390 |
name="SolverAgent",
|
| 391 |
verbosity_level=0,
|
| 392 |
description="Simple problem solving with math and search."
|
|
@@ -394,14 +394,14 @@ class SlpMultiAgent:
|
|
| 394 |
|
| 395 |
manager_agent = CodeAgent(
|
| 396 |
model=model if not isinstance(model, GeminiModel) else OpenAIServerModel(model_id="gpt-3.5-turbo", temperature=0.0, max_tokens=400),
|
| 397 |
-
tools=[GoogleSearchTool(), MathTool(), FileProcessorTool(), KnowledgeBaseTool()],
|
| 398 |
managed_agents=[research_agent, solver_agent],
|
| 399 |
name="ManagerAgent",
|
| 400 |
description="Manager with comprehensive tool access and agent coordination.",
|
| 401 |
additional_authorized_imports=["re", "math", "json", "pandas", "numpy", "requests", "time", "os", "tempfile", "uuid"],
|
| 402 |
planning_interval=1,
|
| 403 |
verbosity_level=0,
|
| 404 |
-
max_steps=
|
| 405 |
final_answer_checks=[check_reasoning]
|
| 406 |
)
|
| 407 |
|
|
@@ -416,29 +416,39 @@ class SlpMultiAgent:
|
|
| 416 |
None,
|
| 417 |
lambda: manager_agent.run(f"""
|
| 418 |
Question: {short_question}
|
| 419 |
-
|
| 420 |
-
INSTRUCTIONS:
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
| 426 |
-
|
| 427 |
Available tools:
|
| 428 |
- google_search(query): Search the web
|
| 429 |
- math_calculator(expression): Calculate math
|
| 430 |
- file_processor(action, data): Handle files
|
| 431 |
- knowledge_base(topic): Get knowledge
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
|
| 435 |
-
|
| 436 |
-
|
| 437 |
-
|
| 438 |
-
|
| 439 |
-
|
| 440 |
-
|
| 441 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 442 |
""")
|
| 443 |
)
|
| 444 |
break # Success, exit retry loop
|
|
|
|
| 373 |
|
| 374 |
# Simplified research agent
|
| 375 |
research_agent = CodeAgent(
|
| 376 |
+
tools=[GoogleSearchTool(), KnowledgeBaseTool(), WikipediaSearchTool(), CodeExecutorTool(), WebScrapeTool()],
|
| 377 |
model=model if not isinstance(model, GeminiModel) else OpenAIServerModel(model_id="gpt-3.5-turbo", temperature=0.0, max_tokens=400),
|
| 378 |
additional_authorized_imports=["re", "json"],
|
| 379 |
+
max_steps=6,
|
| 380 |
name="ResearchAgent",
|
| 381 |
verbosity_level=0,
|
| 382 |
description="Simple research with Google Search."
|
|
|
|
| 386 |
tools=[MathTool(), GoogleSearchTool()],
|
| 387 |
model=model if not isinstance(model, GeminiModel) else OpenAIServerModel(model_id="gpt-3.5-turbo", temperature=0.0, max_tokens=400),
|
| 388 |
additional_authorized_imports=["math", "re"],
|
| 389 |
+
max_steps=6,
|
| 390 |
name="SolverAgent",
|
| 391 |
verbosity_level=0,
|
| 392 |
description="Simple problem solving with math and search."
|
|
|
|
| 394 |
|
| 395 |
manager_agent = CodeAgent(
|
| 396 |
model=model if not isinstance(model, GeminiModel) else OpenAIServerModel(model_id="gpt-3.5-turbo", temperature=0.0, max_tokens=400),
|
| 397 |
+
tools=[GoogleSearchTool(), MathTool(), FileProcessorTool(), KnowledgeBaseTool(), WikipediaSearchTool(), CodeExecutorTool(), WebScrapeTool()],
|
| 398 |
managed_agents=[research_agent, solver_agent],
|
| 399 |
name="ManagerAgent",
|
| 400 |
description="Manager with comprehensive tool access and agent coordination.",
|
| 401 |
additional_authorized_imports=["re", "math", "json", "pandas", "numpy", "requests", "time", "os", "tempfile", "uuid"],
|
| 402 |
planning_interval=1,
|
| 403 |
verbosity_level=0,
|
| 404 |
+
max_steps=6,
|
| 405 |
final_answer_checks=[check_reasoning]
|
| 406 |
)
|
| 407 |
|
|
|
|
| 416 |
None,
|
| 417 |
lambda: manager_agent.run(f"""
|
| 418 |
Question: {short_question}
|
| 419 |
+
|
| 420 |
+
CRITICAL INSTRUCTIONS:
|
| 421 |
+
1. Use tools DIRECTLY, not in code execution
|
| 422 |
+
2. For factual questions: Use google_search() tool immediately
|
| 423 |
+
3. For math: Use math_calculator() tool directly
|
| 424 |
+
4. DO NOT write complex code - use tools instead
|
| 425 |
+
5. DO NOT call ResearchAgent() or SolverAgent() in code
|
| 426 |
+
|
| 427 |
Available tools:
|
| 428 |
- google_search(query): Search the web
|
| 429 |
- math_calculator(expression): Calculate math
|
| 430 |
- file_processor(action, data): Handle files
|
| 431 |
- knowledge_base(topic): Get knowledge
|
| 432 |
+
|
| 433 |
+
SIMPLE APPROACH:
|
| 434 |
+
- Call the appropriate tool
|
| 435 |
+
- Get the result
|
| 436 |
+
- Provide final_answer()
|
| 437 |
+
|
| 438 |
+
Example for factual question:
|
| 439 |
+
1. Call google_search("your query")
|
| 440 |
+
2. Extract answer from results
|
| 441 |
+
3. Call final_answer("the answer")
|
| 442 |
+
|
| 443 |
+
NO complex code execution. Use tools directly.
|
| 444 |
+
|
| 445 |
+
Take your time and think every step out, be confident and precise.
|
| 446 |
+
|
| 447 |
+
Google should be able to answer all these questions and you have access to it.
|
| 448 |
+
|
| 449 |
+
They are simple yet tricky questions, so be careful and double check your answers. Make sure to use google_search for any factual question.
|
| 450 |
+
|
| 451 |
+
always provide a final_answer in the format final_answer("your answer here") when you have the answer.
|
| 452 |
""")
|
| 453 |
)
|
| 454 |
break # Success, exit retry loop
|