Implementing User Confirmation Flow in ChatGPT Plugin

I need assistance in setting up a user confirmation flow for the ChatGPT plugin.

According to the plugin documentation,

  • When a user asks a relevant question, the model may choose to invoke an API call from your plugin if it seems relevant; for POST requests, we require that developers build a user confirmation flow.

I don’t mind chatGPT making calls to our plugin whenever the user’s intention matches the plugin description. However, because some operation in our plugin is resource intensive. I’d like the user sending a confirmation instruction to trigger our plugin creating the particular resource. To accomplish this, I used a component property called “user_instruction” in my OpenAPI specification and provided the following description: “The user’s specific instruction for [my plugin] to execute an immediate action. It must be one of the following phrases: go for it, just do it, make it happen. If the user doesn’t provide this instruction, leave it blank. Do not automatically generate this instruction.”

Despite these guidelines, ChatGPT occasionally populates the request with “go for it” for the “user_instruction”, even when the user hasn’t given this instruction in the chat. Other times the “user_instruction” is not populated as expected. This behavior makes it impossible for me to obtain user’s confirmation.

Can anyone provide guidance on correctly implementing a user confirmation flow for the ChatGPT plugin?

2 Likes

I have found “do not do something” generally does not work well. It might seem too complicated for ChatGPT to remember. If I were you, I would try to make ChatGPT confirm with the user directly, and do not limit it to specific words or phrases. Something like this in the model instruction:

Because doing xxx is an expensive operation, you need to get explicit user confirmation first. After the user has confirmed, call the ‘doXXX’ API.

2 Likes

Yeah, negatives are sometimes hard for it to parse if there’s other conflicting language/tokens around it. I would try rewording the prompt as @CreatiCode suggested. Please do let us know if you get it sorted.

1 Like

Thank you for the suggestion. It helped me understand better about the manifest file. Unfortunately, after adding these sentences in the “description_for_model” field of the manifest JSON, it still did not work.

Because XXX is an expensive operation, you must get explicit user confirmation before call the XXX plugin API. Only after the user has confirmed, you will call the XXX plugin API.

What finally worked was: in the OpenAPI schema, I made the property “user_instruction” required property in the POST request body, and use enum to define the specific phrases of this property. In the property description, I wrote something like:

“The user provided specific command for XXX plugin to take an immediate action.”

Before user prompt with any of those enum phrases, ChatGPT kept asking user for confirmation, and tell user what those enum phrases are, which is really nice.

2 Likes

Thank you very much. I have replied in above for the result so far.

I will continue test to make sure the consistency of ChatGPT behavior over time, which can be a problem sometimes.

1 Like

No problem. Thank you for sharing your plug-in experience with us. It’s helpful to know what to expect going in.

I tried the required property in the POST body, Melinda, but the plugin automatically populates user_instruction :frowning: Will keep on trying different approaches.

Here’s my POST…

post:
      operationId: createMetadata
      summary: Create metadata
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - user_instruction
              properties:
                user_instruction:
                  type: string
                  description: "The plugin user must explicitly confirm they would like to proceed. Do not automatically generate this instruction."
                  enum:
                    - "Yes"
                    - "Continue"
                    - "Proceed"
                    - "Go ahead"

I have a similar issue. My CustomGPT keeps trying to make calls with hallucinated required fields.