huytofu92 commited on
Commit
333a8cc
·
1 Parent(s): 204b035

Final Agent form

Browse files
Files changed (3) hide show
  1. app.py +8 -0
  2. mini_agents.py +4 -2
  3. prompts/prompts.yaml +2 -2
app.py CHANGED
@@ -102,6 +102,14 @@ class BasicAgent:
102
  new_rows.append(new_row)
103
 
104
  # Append all new rows at once
 
 
 
 
 
 
 
 
105
  if new_rows:
106
  df_agent_steps = pd.concat([df_agent_steps, pd.DataFrame(new_rows)], ignore_index=True)
107
 
 
102
  new_rows.append(new_row)
103
 
104
  # Append all new rows at once
105
+ final_row = {
106
+ 'task_id': task_id,
107
+ 'step_class': 'FinalAnswerStep',
108
+ 'model_input_messages': [question],
109
+ 'model_output_message': fixed_answer,
110
+ 'model_output': fixed_answer,
111
+ }
112
+ new_rows.append(final_row)
113
  if new_rows:
114
  df_agent_steps = pd.concat([df_agent_steps, pd.DataFrame(new_rows)], ignore_index=True)
115
 
mini_agents.py CHANGED
@@ -99,6 +99,7 @@ arithmetic_agent = CodeAgent(
99
  model=arithmetic_model,
100
  tools=[operate_two_numbers, convert_number],
101
  max_steps=4,
 
102
  additional_authorized_imports=AUTHORIZED_IMPORTS,
103
  name="arithmetic_agent",
104
  description="This agent is responsible for performing arithmetic operations on two numbers."
@@ -114,6 +115,7 @@ pandas_agent = CodeAgent(
114
  model=pandas_model,
115
  tools=[load_dataframe_from_csv, load_dataframe_from_excel, to_dataframe, to_json, get_dataframe_data, get_dataframe_column, get_dataframe_row, get_dataframe_groupby],
116
  max_steps=4,
 
117
  additional_authorized_imports=AUTHORIZED_IMPORTS,
118
  name="pandas_agent",
119
  description="This agent is responsible for converting data to a dataframe, performing pandas operations on such dataframe and converting the dataframe back to a json or a csv file."
@@ -167,10 +169,10 @@ class MasterAgentWrapper:
167
  managed_agents=[audio_agent, vlm_agent, arithmetic_agent, pandas_agent],
168
  tools=self.base_tools, # Initialize without browser tools
169
  add_base_tools=False,
170
- max_steps=16,
171
  additional_authorized_imports=AUTHORIZED_IMPORTS,
172
  verbosity_level=logging.INFO,
173
- planning_interval=3,
174
  prompt_templates=PROMPT_TEMPLATE["master_agent"],
175
  name="master_agent",
176
  description="This agent is responsible for managing audio, vlm, arithmetic and pandas agents."
 
99
  model=arithmetic_model,
100
  tools=[operate_two_numbers, convert_number],
101
  max_steps=4,
102
+ planning_interval=4,
103
  additional_authorized_imports=AUTHORIZED_IMPORTS,
104
  name="arithmetic_agent",
105
  description="This agent is responsible for performing arithmetic operations on two numbers."
 
115
  model=pandas_model,
116
  tools=[load_dataframe_from_csv, load_dataframe_from_excel, to_dataframe, to_json, get_dataframe_data, get_dataframe_column, get_dataframe_row, get_dataframe_groupby],
117
  max_steps=4,
118
+ planning_interval=4,
119
  additional_authorized_imports=AUTHORIZED_IMPORTS,
120
  name="pandas_agent",
121
  description="This agent is responsible for converting data to a dataframe, performing pandas operations on such dataframe and converting the dataframe back to a json or a csv file."
 
169
  managed_agents=[audio_agent, vlm_agent, arithmetic_agent, pandas_agent],
170
  tools=self.base_tools, # Initialize without browser tools
171
  add_base_tools=False,
172
+ max_steps=17, #One final plan step, 16 intermediate steps
173
  additional_authorized_imports=AUTHORIZED_IMPORTS,
174
  verbosity_level=logging.INFO,
175
+ planning_interval=4,
176
  prompt_templates=PROMPT_TEMPLATE["master_agent"],
177
  name="master_agent",
178
  description="This agent is responsible for managing audio, vlm, arithmetic and pandas agents."
prompts/prompts.yaml CHANGED
@@ -23,8 +23,8 @@ system_prompt: |-
23
  All information in the 'Observation:' sequence will be available as input for the next step.
24
  In the end you have to return a final answer using the `final_answer` tool.
25
 
26
- It is advised to have at least 2 steps in your plan. One step is not sufficient.
27
- It is also advised to double check your answer before calling the `final_answer` tool.
28
 
29
  You are also given access to a list of tools: these tools are basically Python functions which you can call with code.
30
  Here are a few examples using notional tools:
 
23
  All information in the 'Observation:' sequence will be available as input for the next step.
24
  In the end you have to return a final answer using the `final_answer` tool.
25
 
26
+ It is advised to have at least 3 steps in your plan. One or two steps is not sufficient.
27
+ It is advised to double check your answer before calling the `final_answer` tool.
28
 
29
  You are also given access to a list of tools: these tools are basically Python functions which you can call with code.
30
  Here are a few examples using notional tools: