I’m building a chatbot that uses function calling. Before executing a function, the agent asks the user for confirmation (human-in-the-loop).
It works great if the user confirms. If the user denies the proposed function, should I still keep the function’s message in the message history?
Problem is, if I leave the message there, the model seems to think the function was executed - even if the the following human message is something like no, don’t do that.
Thanks!
Welcome to the forum.
For your use case, is there a benefit to retaining message history in that way?
Could you remove the reply or replace it with a placeholder for example and see if that works better?
Thanks!
The benefit is if the user modifies the proposed function. We don’t want to lose the information from the rejected proposal. I’ll try with a placeholder and post back here if that works.
Update: placeholder strategy works shockingly well.
Instead of appending the rejected assistant message to the message history, I append the following as a user message:
You suggested the following function, but I rejected it:
<function_json>
Then I append another user message with the user’s rejection text.
This feels a bit janky, but can’t find any issues yet.
1 Like