Spaces:
Configuration error
Configuration error
oremaz
commited on
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -478,7 +478,6 @@ analysis_tool = FunctionTool.from_defaults(
|
|
| 478 |
**Input format:** Provide the query and mention any relevant files or context."""
|
| 479 |
)
|
| 480 |
|
| 481 |
-
|
| 482 |
code_tool = FunctionTool.from_defaults(
|
| 483 |
fn=code_function,
|
| 484 |
name="CodeAgent",
|
|
@@ -516,29 +515,42 @@ class EnhancedGAIAAgent:
|
|
| 516 |
# Agent coordinateur principal qui utilise les agents spécialisés comme tools
|
| 517 |
self.coordinator = ReActAgent(
|
| 518 |
name="GAIACoordinator",
|
| 519 |
-
description="Main GAIA coordinator that uses
|
| 520 |
system_prompt="""
|
| 521 |
You are the main GAIA coordinator using ReAct reasoning methodology.
|
|
|
|
|
|
|
| 522 |
|
| 523 |
-
|
| 524 |
-
|
| 525 |
-
|
| 526 |
-
|
| 527 |
-
4. REPEAT: Continue until you have the final answer.
|
| 528 |
|
| 529 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 530 |
|
| 531 |
-
|
| 532 |
-
|
| 533 |
-
|
| 534 |
-
|
| 535 |
-
-
|
| 536 |
-
-
|
|
|
|
|
|
|
|
|
|
| 537 |
llm=proj_llm,
|
| 538 |
tools=[analysis_tool, research_tool, code_tool],
|
| 539 |
-
max_steps
|
| 540 |
verbose = True,
|
| 541 |
callback_manager=callback_manager,
|
|
|
|
| 542 |
)
|
| 543 |
|
| 544 |
async def format_gaia_answer(self, raw_response: str, original_question: str) -> str:
|
|
|
|
| 478 |
**Input format:** Provide the query and mention any relevant files or context."""
|
| 479 |
)
|
| 480 |
|
|
|
|
| 481 |
code_tool = FunctionTool.from_defaults(
|
| 482 |
fn=code_function,
|
| 483 |
name="CodeAgent",
|
|
|
|
| 515 |
# Agent coordinateur principal qui utilise les agents spécialisés comme tools
|
| 516 |
self.coordinator = ReActAgent(
|
| 517 |
name="GAIACoordinator",
|
| 518 |
+
description="Main GAIA coordinator that uses specialized capabilities as intelligent tools",
|
| 519 |
system_prompt="""
|
| 520 |
You are the main GAIA coordinator using ReAct reasoning methodology.
|
| 521 |
+
|
| 522 |
+
You have access to THREE specialist tools:
|
| 523 |
|
| 524 |
+
**1. AnalysisAgent** - Advanced multimodal document analysis specialist
|
| 525 |
+
- Use for: PDF, Word, CSV, image file analysis
|
| 526 |
+
- Capabilities: Extract data from tables/charts, cross-reference documents, semantic search
|
| 527 |
+
- When to use: Questions with file attachments, document analysis, data extraction
|
|
|
|
| 528 |
|
| 529 |
+
**2. Research Tool** - Intelligent research specialist with automatic routing
|
| 530 |
+
- Use for: External knowledge, current events, scientific papers
|
| 531 |
+
- Capabilities: Auto-routes between ArXiv (scientific) and web search (general), extracts full content
|
| 532 |
+
- When to use: Questions requiring external knowledge, factual verification, current information
|
| 533 |
+
|
| 534 |
+
**3. CodeAgent** - Advanced computational specialist using ReAct reasoning
|
| 535 |
+
- Use for: Mathematical calculations, data processing, logical operations
|
| 536 |
+
- Capabilities: Generates and executes Python code, handles complex computations, step-by-step problem solving
|
| 537 |
+
- When to use: Precise calculations, data manipulation, mathematical problem solving
|
| 538 |
|
| 539 |
+
IMPORTANT: Use tools strategically - only when their specific expertise is needed.
|
| 540 |
+
For simple questions, you can answer directly without using any tools.
|
| 541 |
+
|
| 542 |
+
CRITICAL: Your final answer must be EXACT and CONCISE as required by GAIA format:
|
| 543 |
+
- For numbers: provide only the number (e.g., "42" or "3.14")
|
| 544 |
+
- For strings: provide only the exact string (e.g., "Paris" or "Einstein")
|
| 545 |
+
- For lists: use comma separation (e.g., "apple, banana, orange")
|
| 546 |
+
- NO explanations, NO additional text, ONLY the precise answer
|
| 547 |
+
""",
|
| 548 |
llm=proj_llm,
|
| 549 |
tools=[analysis_tool, research_tool, code_tool],
|
| 550 |
+
max_steps=10,
|
| 551 |
verbose = True,
|
| 552 |
callback_manager=callback_manager,
|
| 553 |
+
|
| 554 |
)
|
| 555 |
|
| 556 |
async def format_gaia_answer(self, raw_response: str, original_question: str) -> str:
|