Spaces:
Configuration error
Configuration error
oremaz
commited on
Commit
·
4a5fc45
1
Parent(s):
b5495d7
Update agent.py
Browse files
agent.py
CHANGED
|
@@ -400,6 +400,25 @@ code_agent = ReActAgent(
|
|
| 400 |
can_handoff_to=["ResearchAgent", "AnalysisAgent"]
|
| 401 |
)
|
| 402 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 403 |
class EnhancedGAIAAgent:
|
| 404 |
def __init__(self):
|
| 405 |
print("Initializing Enhanced GAIA Agent...")
|
|
@@ -417,32 +436,26 @@ class EnhancedGAIAAgent:
|
|
| 417 |
You are the main GAIA coordinator using ReAct reasoning methodology.
|
| 418 |
|
| 419 |
Your process:
|
| 420 |
-
1. THINK: Analyze the GAIA question thoroughly
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
- Do I need research, analysis, or calculations?
|
| 424 |
-
|
| 425 |
-
2. ACT: Use your specialist agents IF RELEVANT
|
| 426 |
-
- AnalysisAgent: ONLY for documents, images, files, or multimodal content
|
| 427 |
-
- ResearchAgent: ONLY for web search, scientific papers, factual information
|
| 428 |
-
- CodeAgent: ONLY for calculations, data processing, mathematical operations
|
| 429 |
-
|
| 430 |
-
3. OBSERVE: Review results from specialist agents
|
| 431 |
4. THINK: Determine if you need more information or can provide final answer
|
| 432 |
-
5. ACT: Either use another
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 433 |
|
| 434 |
-
|
| 435 |
-
For
|
| 436 |
-
|
|
|
|
|
|
|
| 437 |
""",
|
| 438 |
llm=text_llm,
|
| 439 |
-
tools=[
|
| 440 |
-
analysis_agent, # Agent spécialisé comme tool
|
| 441 |
-
research_agent, # Agent spécialisé comme tool
|
| 442 |
-
code_agent # Agent spécialisé comme tool
|
| 443 |
-
]
|
| 444 |
)
|
| 445 |
-
print("Coordinator agent initialized")
|
| 446 |
|
| 447 |
def solve_gaia_question(self, question_data: Dict[str, Any]) -> str:
|
| 448 |
question = question_data.get("Question", "")
|
|
|
|
| 400 |
can_handoff_to=["ResearchAgent", "AnalysisAgent"]
|
| 401 |
)
|
| 402 |
|
| 403 |
+
# Créer des outils à partir des agents
|
| 404 |
+
analysis_tool = FunctionTool.from_defaults(
|
| 405 |
+
fn=lambda query, files=None: analysis_agent.chat(query),
|
| 406 |
+
name="AnalysisAgent",
|
| 407 |
+
description="Advanced multimodal analysis using enhanced RAG"
|
| 408 |
+
)
|
| 409 |
+
|
| 410 |
+
research_tool = FunctionTool.from_defaults(
|
| 411 |
+
fn=lambda query: research_agent.chat(query),
|
| 412 |
+
name="ResearchAgent",
|
| 413 |
+
description="Research agent for scientific and general research"
|
| 414 |
+
)
|
| 415 |
+
|
| 416 |
+
code_tool = FunctionTool.from_defaults(
|
| 417 |
+
fn=lambda query: code_agent.chat(query),
|
| 418 |
+
name="CodeAgent",
|
| 419 |
+
description="Advanced calculations and data processing"
|
| 420 |
+
)
|
| 421 |
+
|
| 422 |
class EnhancedGAIAAgent:
|
| 423 |
def __init__(self):
|
| 424 |
print("Initializing Enhanced GAIA Agent...")
|
|
|
|
| 436 |
You are the main GAIA coordinator using ReAct reasoning methodology.
|
| 437 |
|
| 438 |
Your process:
|
| 439 |
+
1. THINK: Analyze the GAIA question thoroughly
|
| 440 |
+
2. ACT: Use your specialist tools IF RELEVANT
|
| 441 |
+
3. OBSERVE: Review results from specialist tools
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 442 |
4. THINK: Determine if you need more information or can provide final answer
|
| 443 |
+
5. ACT: Either use another tool or provide final precise answer
|
| 444 |
+
6. FORMAT: Ensure answer is EXACT GAIA format (number only, word only, etc.)
|
| 445 |
+
|
| 446 |
+
|
| 447 |
+
IMPORTANT: Use tools strategically - only when their specific expertise is needed.
|
| 448 |
+
For simple questions, you can answer directly without using any tools.
|
| 449 |
|
| 450 |
+
CRITICAL: Your final answer must be EXACT and CONCISE as required by GAIA format:
|
| 451 |
+
- For numbers: provide only the number (e.g., "42" or "3.14")
|
| 452 |
+
- For strings: provide only the exact string (e.g., "Paris" or "Einstein")
|
| 453 |
+
- For lists: use comma separation (e.g., "apple, banana, orange")
|
| 454 |
+
- NO explanations, NO additional text, ONLY the precise answer
|
| 455 |
""",
|
| 456 |
llm=text_llm,
|
| 457 |
+
tools=[analysis_tool, research_tool, code_tool]
|
|
|
|
|
|
|
|
|
|
|
|
|
| 458 |
)
|
|
|
|
| 459 |
|
| 460 |
def solve_gaia_question(self, question_data: Dict[str, Any]) -> str:
|
| 461 |
question = question_data.get("Question", "")
|