Closed programmarchy closed 1 year ago
Yeah, it's inconsistent when you use the default turbo model but it's also the cheapest to use (so far, it costs me < $0.5 for testing and personal use)
Switching to gpt4 makes it way more consistent.
I'm thinking of ways to modify prompt or add more validation to re-prompt if it is incorrect. Feel free to open a PR with ideas to make it more consistent and reliable.
I will improve the error message in the meantime.
This is hacky, but would you be opposed to something like:
function parseArgs(fnCall, context: { content }) {
if (typeof fnCall.arguments === 'string') {
return { description: content, content: fnCall.arguments };
} else {
return JSON.parse(fnCall.arguments);
}
}
I would rather fail than prompt for a command which doesn't work or has any possibility of causing issues while running. The latter is more frustrating than failing fast.
So, I don't think that would work. I think we should focus on improving reliability or allowing quick iterations.
Agree with what you said, but the interesting thing is the command was correct (convert hero.jpg -resize 180x180 thumbnail.jpg
), it just wasn't formatted according to the output spec. My guess is that ChatGPT knew the command to run, but not how to describe it, so it broke the output spec to return only the command. I suppose there's not a way to know that for sure, though. Perhaps we could give it more leeway in the description field by allowing null or adding something like "if you cannot describe the command, return an empty string" with the hope that it follows the output spec more closely.
That sounds like a good idea. Wanna open a PR with some tests to the functions file to improve the output?
Someone made a pull request to improve this. Would you mind running a couple test on your end?
So I tested it with your commands - it seems to work more reliably so closing this issue for now. Feel free to re-open if you find examples that do not work.
I noticed with this prompt:
Sometimes I would get an exception:
But sometimes the command would succeed.
Added some logging, and appears that sometimes
fnCall.arguments
is a string instead of an object{ description, content }
.Here's my log: