microsoft / autogen

A programming framework for agentic AI 🤖
https://microsoft.github.io/autogen/
Creative Commons Attribution 4.0 International
31.9k stars 4.64k forks source link

[Feature Request]: partial error message from code executor #2060

Open Repomano opened 6 months ago

Repomano commented 6 months ago

Feature Request

Is it possible to include just a part of the error when a code is executed? For example if I have in a roleplay one of the two agents that executing the code finds: Traceback (most recent call last): File "/home/matt/anaconda3/envs/coder/lib/python3.11/site-packages/autogen/oai/completion.py", line 224, in _get_response response = openai_completion.create(request_timeout=request_timeout, *config) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/matt/anaconda3/envs/coder/lib/python3.11/site-packages/openai/api_resources/chat_completion.py", line 25, in create return super().create(args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/matt/anaconda3/envs/coder/lib/python3.11/site-packages/openai/api_resources/abstract/engine_apiresource.py", line 153, in create response, , api_key = requestor.request( ^^^^^^^^^^^^^^^^^^ File "/home/matt/anaconda3/envs/coder/lib/python3.11/site-packages/openai/api_requestor.py", line 226, in request resp, got_stream = self._interpret_response(result, stream)

Can I decide to send to the other agent just the last line? In this case: File "/home/matt/anaconda3/envs/coder/lib/python3.11/site-packages/openai/api_requestor.py", line 226, in request resp, got_stream = self._interpret_response(result, stream)

ekzhu commented 6 months ago

Just to clarify, do you mean you want the code executors to only return specific part of the call stack in error message? If that's the case, you can take a look at the code executors' implementations in autogen.coding and see if you can add a parameter to customize the error message format.

Let @jackgerrits and me know if you are stuck. We can also discuss if we should add this to our code executor roadmap #1421

Repomano commented 6 months ago

Yes, thanks, that's exactly what I was interested in, I think it's useful because in some cases when there are errors, for example when loading very large csv files, the error is in the column format "AcolumnBcolumnCcolumnD....ColumnZ is not considered intger " so even if you use a timeout you could run out of all your available per minute tokens with just one error message.

ekzhu commented 6 months ago

Thanks for confirming. Would you like to give it a try? A good place to start is LocalCommandLineExecutor inside autogen.coding.

Repomano commented 6 months ago

Yes I will try