-
Notifications
You must be signed in to change notification settings - Fork 710
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
How to deal with agents not calling the appropriate tools #178
Comments
You can use |
The best way is to put a much detailed doc string in the tool functions. Because that doc string is passed to the llm along with the tool and it tells llm the functionality of that tool and when to call it and also about the required arguments to call that particular tool. https://gorilla.cs.berkeley.edu/leaderboard.html So try with a different model which is good at it. |
Thank you for the suggestion. I tried it and there's the issue where it eventually gets into an infinite loop of the model always calling the Do you know how I should set it up for the example I shared? |
Thanks a lot for your response. I have been improving the tool documentation and it has helped greatly. Still, it will not ensure the right tools are always called. It would be nice to have a method in the |
You shouldn't use tool_choice for the example mentioned because it's only suitable for the cases when you want your llm to always call some tool. But that's not your case. You want to call different tools for different prompts. |
What do you meant by |
By that, I mean feeding the tool call/response to the conversation. In my example, I'd prepend the tool response from |
but the agent will automatically append the tool message to the conversation. You have to make sure that the tool return the response in a well formatted way understandable by the LLM |
|
Question
I'm building agents that run within Github actions (repo).
I have the problem that the agents do not always call the appropriate tools, even when the instructions request them to do so.
Here's an example:
There are instances where the agent only runs the
create_pull_request_review
tool and hallucinates the PR changes (I'm using o3-mini).Any suggestions?
I had success by removing the specific tools from the agent, running them manually, and providing the tool response as part of the input message. Still, I'd prefer if the agent were to follow the instructions.
When the tools are wrapped with the
@function_tool
decorator we can only get a string response from the original function (when callingFunctionTool.on_invoke_tool
), so this workaround is still oddThe text was updated successfully, but these errors were encountered: