microsoft / autogen

A programming framework for agentic AI. Discord: https://aka.ms/autogen-dc. Roadmap: https://aka.ms/autogen-roadmap
https://microsoft.github.io/autogen/
Creative Commons Attribution 4.0 International
28.13k stars 4.11k forks source link

[Issue]: Cant find working directory #2918

Open shaleenrajkaur opened 3 weeks ago

shaleenrajkaur commented 3 weeks ago

Describe the issue

Basically i'm uploading a .csv file- hoping to ask questions with it. The setup is with 2 agents - user proxy and assistant. Now my userproxy is unable to read the file, giving me this error FileNotFoundError: [Errno 2] No such file or directory: '/workspace/20230312_mock_data.csv'

Below is the code i used: user_proxy = autogen.UserProxyAgent( name="User", human_input_mode="NEVER", max_consecutive_auto_reply=10, is_termination_msg=lambda x: x.get("content", "") and x.get("content", "").rstrip().endswith("TERMINATE"), code_execution_config={"work_dir": "coding"}, llm_config=llm_config, system_message=""" Always install the pandas library and load the dataset into a pandas dataframe. Reply TERMINATE if the task has been solved at full satisfaction. Otherwise, reply CONTINUE, or the reason why the task is not solved yet.""", ) return user_prox

Steps to reproduce

Below is the code i used: user_proxy = autogen.UserProxyAgent( name="User", human_input_mode="NEVER", max_consecutive_auto_reply=10, is_termination_msg=lambda x: x.get("content", "") and x.get("content", "").rstrip().endswith("TERMINATE"), code_execution_config={"work_dir": "coding"}, llm_config=llm_config, system_message=""" Always install the pandas library and load the dataset into a pandas dataframe. Reply TERMINATE if the task has been solved at full satisfaction. Otherwise, reply CONTINUE, or the reason why the task is not solved yet.""", ) return user_prox

Screenshots and logs

n/a

Additional Information

pyautogen 0.2.28

StamKavid commented 2 weeks ago

Hello @shaleenrajkaur.

I think you have to work with the dir.

Try something like this, it depends on the path that you are in and you are calling the "app.py" function.

Multiple CSVs [os.path.join(os.path.join(os.getcwd(), "//workspace"), f) for f in os.listdir(os.path.join(os.getcwd(), "//workspace")) if f.endswith('.csv')]

Hope that helps.