gorilla-llm / gorilla-cli

LLMs for your CLI
https://gorilla.cs.berkeley.edu/
Apache License 2.0
1.22k stars 73 forks source link

Recover from errors #63

Open abitrolly opened 1 month ago

abitrolly commented 1 month ago

When gorilla fails to provide a correct answer, as in #62, I want to it to iterate on the error to fix its mistake.

Given the failure from #62.

➜  ~ gorilla how many terminal commands I execute each day on average   
🦍  history | awk '{print $2}' | sort | uniq -c | sort -rn | awk '{ total += $1; count++ } END { print total/count }'
awk: cmd. line:1: fatal: division by zero attempted

What I want to see is it catching non-zero exit code, then reasoning a bit what happened, and proposing to run more commands to (finally) resolve the problem (and learn for the future).

<expletive>, looks like the command had failed. Let me try to figure out why it could happen.
1. The division by zero is most likely caused by `count` being 0 in `print total/count` expression
2. The count is zero when `awk` ...
3. This is most likely caused by ...
4. Which is caused by ...
5. Which is caused by `history` not returning expected sequence
I expect `history` to return data in this format.

10090  ldd ocp
10091  ldd `which ocp`
10092  which node

Do you want me to run `history` inspect if it works as expected? (Y/n)