shroominic / codeinterpreter-api

👾 Open source implementation of the ChatGPT Code Interpreter
https://discord.gg/Vaq25XJvvW
MIT License
3.76k stars 402 forks source link

BUG: the arguments is not valid JSON #149

Open wenxuan1017 opened 9 months ago

wenxuan1017 commented 9 months ago

When python code in "arguments", it would post this error.

Error in CodeInterpreterSession: ValueError - An output parsing error occurred. In order to pass this error back to the agent and have it try again, pass handle_parsing_errors=True to the AgentExecutor. This is the error: Could not parse tool input:{'name': 'python', 'arguments': "import pandas as pd\n\n# Read the CSV file\ndf = pd.read_csv('test_table.csv')\n\n# Display the first 10 rows of the table\ndf.head(10)"} because the arguments is not valid JSON.

I used Azure openai api, both gpt-4 and gpt-35-turbo i had tried. langchain==0.0349 could you help me

jawadchughtai6 commented 8 months ago

Yep, facing the same issue

jawadchughtai6 commented 8 months ago

@shroominic Can you please assist with this? Thanks!

shroominic commented 8 months ago

hey not fully sure whats causing this issue but codeinterpreterapi==0.0.14 seems to be more stable

macmus82 commented 7 months ago

Not able t run this too same issue :(

twiecki commented 7 months ago

Same issue.

twiecki commented 7 months ago

I think this is due to deprecated API.

https://github.com/shroominic/codeinterpreter-api/blob/main/src/codeinterpreterapi/_patch_parser.py#L109 overwrites the deprecated OpenAIFunctionsAgent: https://api.python.langchain.com/en/latest/agents/langchain.agents.openai_functions_agent.base.OpenAIFunctionsAgent.html#

So the patch just gets ignored. Not sure how this could be fixed however.