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

Replace Multi Turn tool use with automatic detection #230

Open
Nixellion opened this issue Nov 18, 2024 · 1 comment
Open

Replace Multi Turn tool use with automatic detection #230

Nixellion opened this issue Nov 18, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@Nixellion
Copy link
Contributor

I've been experimenting locally with adjusting HomeLLM to my needs. And one thing I realized is that I don't think Multi Turn conversation should be a checkbox. It can and should be auto detected. If "to_say" is empty after tools were processed, it means LLM output only tools and they were stripped out of the response. If needed, this can be made more strict, by comparing the original response before stripping tool calls and after.

If it's empty then in all cases, in my opinion anyway, the code should be requesting an LLM for confirmation speech.

Because, at least unless it's used specifically with HomeLLM trained model, there's always a chance that, regardless of the instructions, a model can output it either way - with some speech or just function calls without any speech text.

I ran experiments with and without Multi Turn check box, and here is what I got:

  • Multi Turn ON:
    • Asking an LLM a question that does not require a tool call, like "how are you doing?" often results in an error, because it expects a tool call and there's none in the response
    • Asking it to perform an action can produce a correct result, with LLM calling a tool and then generating a to_say text separately
    • Sometimes an LLM can produce a tool call with some text regardless, in which case it may not be required to waste time generating to_say response
  • Multi Turn OFF:
  • Asking an LLM a question that does not require a tool call makes it return a to_say response correctly
  • Asking it to perform an action often results in just tool calls, and no text is spoken back
  • Asking it to perform an action may result in correct response that includes tool calls and spoken text

All of this cases are solved (in my testing at least) by removing the Multi Turn checkbox, and replacing it with logic described above.

I'm not doing a PR as the code is not in a state to be pushed and includes some other changes I made just for myself, but if needed I can recreate these changes from scratch and make a PR.

@Nixellion Nixellion added the enhancement New feature or request label Nov 18, 2024
@simcop2387
Copy link
Contributor

I've seen similar with multi-turn tool use myself, the logic you've describe for doing better makes sense to me too. The main time I've found it useful is for when I'm testing telling the model to do multiple things in one utterance which isn't common, but is a really useful lift in capability over other assistant devices (i.e. "Turn off the following lights: kitchen lights, living room lights, ...") but because it breaks things when a tool isn't selected it does make it basically unusable for a general setup.

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

No branches or pull requests

2 participants