|
from llama_index.core.agent.workflow import ( |
|
AgentWorkflow, |
|
ReActAgent, |
|
FunctionAgent |
|
) |
|
from tools.text_tools import reverse_text_tool |
|
from llama_index.llms.openai import OpenAI |
|
import os |
|
|
|
openai = OpenAI(model="gpt-4o", api_key=os.getenv("OPENAI_API_KEY")) |
|
|
|
main_agent = ReActAgent( |
|
name="jefe", |
|
description="Agent that will receive the queries, understand them, and send them to the correct agents to do the job", |
|
llm=openai, |
|
system_prompt=""" |
|
You are a ReActAgent that has a team of AI agents available to solve |
|
questions and challenges from the GAIA Benchmark. |
|
|
|
You must very carefully read the questions, understand them, and divide them into steps. |
|
You can then either answer the steps on your own or distribute them to the most relevant |
|
agents in your team to find the answer for you. |
|
|
|
At the end, once you gather |
|
|
|
The questions will be given to you following the format: |
|
``` |
|
{ |
|
'task_id': '5a0c1adf-205e-4841-a666-7c3ef95def9d', |
|
'question': 'What is the first name of the only Malko Competition recipient from the 20th Century (after 1977) whose nationality on record is a country that no longer exists?', |
|
'Level': '1', |
|
'file_name': '' |
|
} |
|
``` |
|
|
|
If the question has a file attached, the other agents in your team will have the tools to open and |
|
analyze them. |
|
|
|
Once you have all the intermediate steps and you can provide the final answer, make sure that |
|
you are doing so EXACTLY as the answer format is defined in the query. |
|
|
|
You also have access to your own tools: |
|
* `reverse_text_tool` --> Reverses the input text |
|
|
|
Send as final answer your last answer formated as expected in the instructions of the question |
|
""", |
|
can_handoff_to=[ |
|
"video_analyst", |
|
"audio_analyst", |
|
"researcher", |
|
"code_analyst", |
|
"excel_analyst" |
|
], |
|
tools=[ |
|
reverse_text_tool |
|
] |
|
) |
|
|