Spaces:
Sleeping
Sleeping
modify
Browse files
app.py
CHANGED
|
@@ -371,25 +371,25 @@ class SlpMultiAgent:
|
|
| 371 |
)
|
| 372 |
print("Using OpenAI model (Gemini not available)")
|
| 373 |
|
| 374 |
-
#
|
| 375 |
research_agent = CodeAgent(
|
| 376 |
-
tools=[GoogleSearchTool(),
|
| 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", "
|
| 379 |
-
max_steps=
|
| 380 |
name="ResearchAgent",
|
| 381 |
verbosity_level=0,
|
| 382 |
-
description="
|
| 383 |
)
|
| 384 |
|
| 385 |
solver_agent = CodeAgent(
|
| 386 |
-
tools=[MathTool(),
|
| 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="
|
| 393 |
)
|
| 394 |
|
| 395 |
manager_agent = CodeAgent(
|
|
@@ -405,7 +405,7 @@ class SlpMultiAgent:
|
|
| 405 |
additional_authorized_imports=["re", "math", "json", "pandas", "numpy", "requests", "time", "os", "tempfile", "uuid"],
|
| 406 |
planning_interval=1,
|
| 407 |
verbosity_level=0,
|
| 408 |
-
max_steps=
|
| 409 |
final_answer_checks=[check_reasoning]
|
| 410 |
)
|
| 411 |
|
|
@@ -421,31 +421,35 @@ class SlpMultiAgent:
|
|
| 421 |
lambda: manager_agent.run(f"""
|
| 422 |
Question: {short_question}
|
| 423 |
|
| 424 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 425 |
|
| 426 |
-
Available tools
|
| 427 |
-
- google_search(query
|
| 428 |
-
- math_calculator(expression
|
| 429 |
-
- file_processor(action
|
| 430 |
-
- knowledge_base(topic
|
| 431 |
|
| 432 |
-
|
| 433 |
-
-
|
| 434 |
-
-
|
|
|
|
| 435 |
|
| 436 |
-
|
| 437 |
-
1.
|
| 438 |
-
2.
|
| 439 |
-
3.
|
| 440 |
|
| 441 |
-
|
| 442 |
|
| 443 |
-
|
| 444 |
<code>
|
| 445 |
-
final_answer("your
|
| 446 |
</code>
|
| 447 |
-
|
| 448 |
-
Be concise and direct.
|
| 449 |
""")
|
| 450 |
)
|
| 451 |
break # Success, exit retry loop
|
|
|
|
| 371 |
)
|
| 372 |
print("Using OpenAI model (Gemini not available)")
|
| 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=2,
|
| 380 |
name="ResearchAgent",
|
| 381 |
verbosity_level=0,
|
| 382 |
+
description="Simple research with Google Search."
|
| 383 |
)
|
| 384 |
|
| 385 |
solver_agent = CodeAgent(
|
| 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=2,
|
| 390 |
name="SolverAgent",
|
| 391 |
verbosity_level=0,
|
| 392 |
+
description="Simple problem solving with math and search."
|
| 393 |
)
|
| 394 |
|
| 395 |
manager_agent = CodeAgent(
|
|
|
|
| 405 |
additional_authorized_imports=["re", "math", "json", "pandas", "numpy", "requests", "time", "os", "tempfile", "uuid"],
|
| 406 |
planning_interval=1,
|
| 407 |
verbosity_level=0,
|
| 408 |
+
max_steps=2,
|
| 409 |
final_answer_checks=[check_reasoning]
|
| 410 |
)
|
| 411 |
|
|
|
|
| 421 |
lambda: manager_agent.run(f"""
|
| 422 |
Question: {short_question}
|
| 423 |
|
| 424 |
+
CRITICAL INSTRUCTIONS:
|
| 425 |
+
1. Use tools DIRECTLY, not in code execution
|
| 426 |
+
2. For factual questions: Use google_search() tool immediately
|
| 427 |
+
3. For math: Use math_calculator() tool directly
|
| 428 |
+
4. DO NOT write complex code - use tools instead
|
| 429 |
+
5. DO NOT call ResearchAgent() or SolverAgent() in code
|
| 430 |
|
| 431 |
+
Available tools:
|
| 432 |
+
- google_search(query): Search the web
|
| 433 |
+
- math_calculator(expression): Calculate math
|
| 434 |
+
- file_processor(action, data): Handle files
|
| 435 |
+
- knowledge_base(topic): Get knowledge
|
| 436 |
|
| 437 |
+
SIMPLE APPROACH:
|
| 438 |
+
- Call the appropriate tool
|
| 439 |
+
- Get the result
|
| 440 |
+
- Provide final_answer()
|
| 441 |
|
| 442 |
+
Example for factual question:
|
| 443 |
+
1. Call google_search("your query")
|
| 444 |
+
2. Extract answer from results
|
| 445 |
+
3. Call final_answer("the answer")
|
| 446 |
|
| 447 |
+
NO complex code execution. Use tools directly.
|
| 448 |
|
| 449 |
+
ALWAYS end with:
|
| 450 |
<code>
|
| 451 |
+
final_answer("your answer here")
|
| 452 |
</code>
|
|
|
|
|
|
|
| 453 |
""")
|
| 454 |
)
|
| 455 |
break # Success, exit retry loop
|