Hi everyone,
I’m using GPT-5-mini with function calling to insert new records into a database.
The intended flow is:
-
The AI generates a proposal with all the details.
-
The user replies “yes” or “no”.
-
If “yes”, the function (e.g.
create_record
) is called and the record is inserted.
The issue is that when the user replies “yes”, the model keeps regenerating the proposal and asking for confirmation again, instead of calling the function right away. This creates an endless confirmation loop.
Simplified example of what happens:
-
AI: “Here’s the proposal. Do you confirm?”
-
User: “yes”
-
AI: “Here’s the proposal. Do you confirm?” (again, with slightly different wording)
-
… and so on.
I’m curious how others handle this problem. Specifically:
-
Do you use a server-side state flag to distinguish between “proposal awaiting confirmation” and “new request”?
-
Do you pass that state into the model context, or handle the logic entirely outside the model without involving the AI?
-
Do you have prompt examples or architectural patterns that prevent the model from treating a confirmation as a new generic input?
Any advice or concrete examples would be greatly appreciated.
Thanks!