[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tool_call error handling #176

Open
rparcus opened this issue Sep 11, 2024 · 1 comment
Open

tool_call error handling #176

rparcus opened this issue Sep 11, 2024 · 1 comment

Comments

@rparcus
Copy link
Contributor
rparcus commented Sep 11, 2024

Hi, I'd like to propose a small change to how we handle tool call errors.

Currently if a tool callback raises or returns an {:error, message}, the tool message result is marked with is_error: true and the retry mechanism kicks in. If the error cannot be resolved, we soon reach the Exceeded max failure count error. At that point no tool call response is seems to be appended to the chain. If we try to add more messages ourselves (e.g. when the user writes again), we then see:

[error]Error during chat call. Reason: "An assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'. 
The following tool_call_ids did not have response messages: call_r4igz6MU7ca0eIRWxUcgAM4S"
[error] Error running LLMChain: "An assistant message with 'tool_calls' must be followed by tool messages 
responding to each 'tool_call_id'. 
The following tool_call_ids did not have response messages: call_r4igz6MU7ca0eIRWxUcgAM4S"

I'm not sure if this is intended behavior. Also, I'm not sure what would be the best way to recover from this state, but all ideas I came up with sound overly complicated.

Instead, if I do not allow the callbacks to crash and purely return a string explaining that there was an error and the we should retry calling, then the model is able to manage things for us. It decides to retry a few times on its own and communicates with the user through the whole process, after x times it gives up.

Proposal:

I would like to have the best of both words:

  • keep the ability to use error tuples and the automatic retries (we do not need to tell users about every little retry).
  • append an error response to the chain so that the llm or the user can decide what to do, instead of "blocking" the chain.

In any case, I'd be available to work on this, no matter what the solution should be.
Thanks!

@brainlid
Copy link
Owner

Thank you for identifying the issue. You're exactly right that it should append an error message to the chain so it could be resumed.

Do you want to take a stab at a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants