iamgreggarcia / codesherpa

A code interpreter and ChatGPT plugin.
MIT License
254 stars 34 forks source link

I'm sorry, I used the incorret function name 'python'. #31

Open ugh82 opened 1 year ago

ugh82 commented 1 year ago

When it runs the function call

{"function_call": {"name": "python", "arguments": "import pandas as pd\n\n# Read the CSV file\nfile_path = "static/uploads/test.csv"\ndf = pd.read_csv(file_path)\n\n# Get the columns of the CSV file\ncolumns = df.columns.tolist()\n\ncolumns"}}

I get the following error I'm sorry, I used the incorret function name 'python'.

Using GTP-3.5

ugh82 commented 1 year ago

This is issue only with GPT-3.5

iamgreggarcia commented 1 year ago

Thanks for the feedback @ugh82 ! You are correct, and this a more general problem with the gpt-3.5-turbo-0613 and gpt-3.5-turbo-16k-0613 models.

Historically the gpt-3 models aren't amenable to system messages the way gpt-4 are. So while the gpt-3 models have the same functions parameter passed to it (i.e., the codesherpa functions it can call for code execution) as gpt-4, it doesn't always call the right function name despite some additional context in the system message.

I'll add some more helpful info to the README that includes this information.

bestK commented 1 year ago

I tried the code in GPT-3 and it worked.

let requestBody = functionArgumentsStr;
if (functionName == 'python') {
  functionName = 'repl_repl_post'
  requestBody = JSON.stringify({ language: "python", code: `${functionArgumentsStr}` })
}
kpchen commented 1 year ago

I just encountered the same issue with gpt3.5