Hello, I am trying to build a data analysis agent. the configuration of the agent and that task goes similar to the following:
@agent
def data_senior_analyst(self) -> Agent:
code_interprter = CodeInterpreterTool()
csv_tool = FileReadTool(file_path=os.path.join(self.data_dir, "sourcing_historical_data.csv"]))
return Agent(
config=self.agents_config["Data Senior Analyst"],
tools=[csv_tool,code_interprter],
allow_delegation=False,
verbose=True,
allow_code_execution=True
)
@task
def historical_data_analysis_task(self) -> Task:
return Task(
config=self.tasks_config["Historical Data Analysis Task"],
agent=self.data_senior_analyst(),
output_file= os.path.join(self.result_dir,"Analysis from Historical Data.md")
)
But I am noticing that agent works fine, meaning it generates and executes python code to analyze the csv according to the task configuration and all, only on small files, if my files starts to include 10000 rows I see the agent start calling chat completion api’s and fails because of the prompt size limitation, I see error as the following:
LiteLLM.Info: If you need to debug this error, use `litellm._turn_on_debug()'.
Error during LLM call: litellm.BadRequestError: AzureException BadRequestError - Error code: 400 - {‘error’: {‘message’: “Invalid ‘messages[2].content’: string too long. Expected a string with maximum length 1048576, but got a string with length 6775328 instead.”, ‘type’: ‘invalid_request_error’, ‘param’: ‘messages[2].content’, ‘code’: ‘string_above_max_length’, ‘callstack’: ’ File “/usr/local/bin/gunicorn”, line 8, in \n sys.exit(run())\nat File “/usr/local/lib/python3.11/site-packages/gunicorn/app/wsgiapp.py”, line 66, in run\n WSGIApplication(“%(prog)s [OPTIONS] [APP_MODULE]”, prog=prog).run()\nat File “/usr/local/lib/python3.11/site-packages/gunicorn/app/base.py”, line 235, in run\n super().run()\nat File “/usr/local/lib/python3.11/site-packages/gunicorn/app/base.py”, line 71, in run\n …