autogen icon indicating copy to clipboard operation
autogen copied to clipboard

[Feature Request]: Gemini Branch - "execute_code_blocks" function to include "py" as supported language along "python" or "Python"

Open mcwongmc opened this issue 11 months ago • 1 comments

Is your feature request related to a problem? Please describe.

First thanks for the great work of adopting gemini branch @BeibinLi and autogen team, really appreciate that!

Issue: In using the gemini branch of autogen and running the code executor, there is a langauge check function "execute_code_blocks" in the file: autogen/coding/local_commandline_code_executor.py line 162 and 163:

            elif lang in ["python", "Python"]:
                filename = f"{filename_uuid}.py"

Given gemini's weaker instruction-following ability compared to GPT-4, I find that sometimes gemini will reply the language as "py", instead of "python" or "Python" . Then a language error will arise and the execution will stop.

Currently, I solve it by explicitly telling agents in the message that "say python, don't say py when describing language".

Just to see whether it is worthwhile to add "py" into the "execute_code_blocks" function validation list. I bet lower ability models do have similar "py" issues as well.

Once again thanks Autogen team for the great lovely work!

Describe the solution you'd like

autogen/coding/local_commandline_code_executor.py line 162 and 163:

            elif lang in ["python", "Python"]:
                filename = f"{filename_uuid}.py"

add "py" into the "execute_code_blocks" function validation list

Additional context

No response

mcwongmc avatar Mar 20 '24 07:03 mcwongmc