cs-icon.svg

ChatGPT

The ChatGPT connector enables you to generate content through chat responses and prompt responses using the OpenAI platform. The ChatGPT connector currently contains six actions: Chat, Chat with Vision, DALL-E 3 Image Generator, Function Calling, Function Calling Response, and Prompt.

Note: The gpt-4-vision-preview model is an Experimental Model with limited support. If deprecated, it may give errors, hence it cannot be used for production.

Details of each action are covered in their respective sections.

Prerequisites

To use the ChatGPT connector, you first need to add your ChatGPT account and authorize it with a valid API Key and Organization ID.

Generate API Key and Get Organization ID from the OpenAI platform

To generate an API Key and Organization ID in your OpenAI platform account, follow the steps given below:

  1. Log into your OpenAI platform account.
  2. Once you log in, you will be navigated to the API keys section as shown below. Click the + Create new secret key button to generate a new API Key.
    Create_New_Secret_key.png
  3. On the Create new secret key modal, enter a Name (Optional) and select the appropriate Permissions. Click the Create secret key button to generate a new secret key.
    Create_Secret_Key_Popup.png

    An API Key gets generated. Copy it to your clipboard and click the Done button to close the pop-up box.

    Copy_secret.png

    Note: Since the API Key is confidential, it is displayed only once. In case you do not copy it to your clipboard, you will need to create a new secret key.

  4. We will now see how to get the Organization ID. So from the left navigation panel, click Settings, and you will get the Organization ID.

    Copy the organization ID to your clipboard and paste it in the Organization ID field.

    Note: Make sure you save the API Key and Organization ID to your clipboard, as these will be used to connect your ChatGPT account to Automate in the next step.

Connect your ChatGPT Account to Automate

Let’s take a look at how to add your ChatGPT account using the Organization ID and API Key generated above. To do so, follow the steps given below:

  1. Click Configure Action Step from the left navigation panel.
  2. Click Action Step to configure third-party services.
  3. Within the Configure Action Step, click the ChatGPT connector.
    Select_Connector.png
  4. Under Choose an Action tab, select any one action from the list. Here we are selecting the Chat action.
    Chat_Action.png
  5. On the Configure Action page, click the + Add New Account button to add your ChatGPT account.
    Add_Account.png
  6. In the Authorize modal, enter a Title. Enter the API Key and Organization ID retrieved in the Generate API Key and get Organization ID from the OpenAI Platform step from your OpenAI platform account. Click the Authorize button.
    image26.png

Once done, you can go ahead and set up your ChatGPT account.

Set up the ChatGPT Connector

Perform the following steps to set up the ChatGPT action connector:

  1. From the left navigation panel, click Configure Action Step.
  2. Then, click Action Step to configure third-party services.
  3. Within Configure Action Step, click the ChatGPT connector.
    Select_the_Connector_ChatGPT.png

    Note: You can sort and search the connector(s) based on the filter.

  4. Under Choose an Action, you will see five actions: Chat, Chat with Vision, DALL-E 3 Image Generator, Function Calling, Function Calling Response, and Prompt.
    Select_Action.png

Let’s look at each of them in detail.

Action 1: Select the Chat action

The Chat action returns the chat response(s) from the OpenAI platform. To use the Chat action, follow the steps below:

  1. Under Choose an Action tab, select the Chat action.
  2. On the Chat Configure Action page, enter the details given below:
    1. Click + Add New Account button to connect your ChatGPT account as shown in the Connect your ChatGPT Account to Automate step.
      Add_Account.png
    2. Select the API Model from the drop-down list to generate content for the chat responses.

      Note: Different models are available to different users based on the account the user holds such as paid accounts. You must check the account access before selecting the model.

      Additional Resource: For more information about the API Models, please refer to ChatGPT API Models.

    3. Provide the Prompt Text to generate the chat response(s).
    4. Select the Role from the drop-down options to send to the API model request. By default, the role is set to user.

      Additional Resource: There are three types of roles provided by the OpenAI platform. The system role sets the response context, the assistant role provides the response content, and the user role asks the prompt.

      Select_Fields.png
    5. Click the Show Optional Fields toggle button to use these optional fields:
      1. Enter the Number of Tokens to generate the content. This must be within the range of 1 to 2048.
      2. Enter a value for the Randomness of Responses of the generated content. 0 being the most precise and 2 being the most random content predictions. This must be within the range of 0 to 2.
      3. Enter the Number of Chat Responses you want to be generated in the automation response. This must be within the range of 1 to 3.
      4. Provide the value to set the Frequency of Repeated Words. The most positive value is likely to avoid the use of repeated words. This must be within the range of -2 to 2.
      5. Provide the value to set the Presence of Repeated Responses. The most positive value is likely to generate a new response. This must be within the range of -2 to 2.
        Show_Optional_Fields.png
      6. With the Additional Prompt Text field, you can add multiple queries based on the Role. The output generates a combined response provided in the Prompt Text field and adds the response(s) for your queries afterwards.
      7. You can mark the Sanitize text checkbox to remove special characters or spaces from the chat response. Enabling this checkbox, eliminates any special characters or spaces in the chat response, resulting in a clean and compatible text.
        Additional_Prompt-Tex.png
    6. Click Proceed.
    7. Check if the details are correct. If yes, then click Test Action.
      Test_Action.png
    8. You will get the response(s). Once set, click Save and Exit.
      Save_and_Exit.png

Action 2: Select the Chat with Vision action

With the Chat with Vision action, you can generate response(s) for images, providing a descriptive response of an image. To use the Chat with Vision action, follow the steps below:

Note: The Chat with Vision action generates a text response based on the URL provided, whereas the DALL-E 3 Image Generator action generates an image URL based on the Prompt text.

  1. Under Choose an Action tab, select the Chat with Vision action.
  2. On the Chat with Vision Configure Action page, enter the details given below:
    1. Click + Add New Account button to connect your ChatGPT account as shown in the Connect your ChatGPT Account to Automate step.
      Add_Account.png
    2. Select the API Model from the drop-down list for response predictions. You can select, the gpt-4-vision-preview API model. This model will be available as gpt-4-vision after production support.

      Additional Resource: For more information about the API Models, please refer to ChatGPT API Models.

    3. Provide the Prompt Text to generate response(s). Click + Add Prompt Text to enter multiple prompts.

      Note: For the Role as system or assistant, you will see the Prompt Text box to enter the text to generate response. If you select the Role as user, you can select the type of prompt content, i.e. Text or Image.

    4. If you select Role as user then follow the below steps:

      1. Under the Prompt Input section, click + Add Prompt Input button.
      2. In the Select Prompt Type drop-down, select the type of content, i.e. Text or Image to generate a response.
      3. Enter the Prompt Value. You can enter a text prompt or a valid image URL to generate a response.
        All_Fields.png
    5. Click the Show Optional Fields toggle button to use these optional fields:
      1. Enter the Number of Chat Responses you want to be generated in the automation response. This must be within the range of 1 to 3.
      2. Enter the Number of Tokens to generate the content. This must be within the range of 1 to 2048.
      3. Enter a value for the Randomness of Responses of the generated content. 0 being the most precise and 2 being the most random content predictions. This must be within the range of 0 to 2.
      4. Provide the value to set the Frequency of Repeated Words. The most positive value is likely to avoid the use of repeated words. This must be within the range of -2 to 2.
      5. Provide the value to set the Presence of Repeated Responses. The most positive value is likely to generate a new response. This must be within the range of -2 to 2.
      6. You can mark the Sanitize text checkbox to remove special characters or spaces from the chat response. Enabling this checkbox, eliminates any special characters or spaces in the chat response, resulting in a clean and compatible text.
        Show_Optional_FIleds.png
    6. Click Proceed.
    7. Check if the details are correct. If yes, then click Test Action.
      Test_Action.png
    8. You will get the response(s). Once set, click Save and Exit.
      Save_And_Exit.png

    Action 3: Select the DALL-E 3 Image Generator action

    The DALL-E 3 Image Generator action allows you to generate an image based on the text prompt and returns a URL for the generated image as a response from the OpenAI platform. To use the DALL-E3 Image Generator action, follow the steps below:

    1. Under Choose an Action tab, select the DALL-E 3 Image Generator action.
    2. On the DALL-E 3 Image Generator Configure Action page, enter the details given below:
      1. Click + Add New Account button to connect your ChatGPT account as shown in the Connect your ChatGPT Account to Automate step.
        Add_Account_Dalle_3.png
      2. Provide the Prompt Text for generating an image.
      3. In the Select Image Size drop-down, choose the resolution for the image generation. This generates an image in the selected size.
      4. In the Select Style drop-down, choose the style for the image generation. By default, the image is generated in Vivid style.
      5. In the Select Quality drop-down, choose the quality for the image generation. By default, the image is generated in Standard quality.
        Select_Fields.png
    3. Click Proceed.
    4. Check if the details are correct. If yes, then click Test Action.
      Test_Action.png
    5. You will get the response(s). Once set, click Save and Exit.
      Save_Exit_Button.png

    You have the option to utilize the URL of the generated image within your Contentstack entries. Additionally, you can automate the process of adding the image to your entries.

    Action 4: Select the Function Calling action

    The Function Calling action allows you to generate the responses based on a configured Sub Automation. Within the Function Calling action, you have the flexibility to include various sub-automations, which ChatGPT will analyze to generate and return responses accordingly. To use the Function Calling action, follow the steps below:

    1. Under Choose an Action tab, select the Function Calling action.
    2. On the Function Calling Configure Action page, enter the details given below:
      1. Click + Add New Account button to connect your ChatGPT account as shown in the Connect your ChatGPT Account to Automate step.
        Add_New_Account.png
      2. Select the API Model from the drop-down list for response predictions.

        Additional Resource: For more information about the API Models, please refer to ChatGPT API Models.

      3. Provide the Prompt Text to generate response(s). Click + Add Prompt Text to add multiple prompts.

        Note: For the Role as system or assistant, you see the Prompt Text box to enter the text to generate response. If you select the Role as user, you can select the type of prompt content, i.e. Text or Image.

      4. Under the Prompt Input section, click + Add Prompt Text button.
      5. Select the Role and enter the Input Query. You can enter an input query i.e., Translate to German language.
      6. Click + Add Sub Automation to add multiple sub automations.
        Select_Fields.png
      7. Click the Show Optional Fields toggle button to use these optional fields:
        1. Enter the Number of Tokens to generate the content. This must be within the range of 1 to 2048.
        2. Enter a value for the Randomness of Responses of the generated content. 0 being the most precise and 2 being the most random content predictions. This must be within the range of 0 to 2.
        3. You can mark the Sanitize text checkbox to remove special characters or spaces from the chat response. Enabling this checkbox, eliminates any special characters or spaces in the chat response, resulting in a clean and compatible text.
      8. Click Proceed.
      9. Check if the details are correct. If yes, then click Test Action.
        ChatGPT_Function_Calling_Test_Action
      10. You will get the response(s). Once set, click Save and Exit.
        ChatGPT_Function_Calling_Save_Exit

      Action 5: Select the Function Calling Response action

      With the Function Calling Response action, you can format the output from the Function Calling action and the Sub Automation. To use the Function Calling Response action, follow the steps below:

      1. Under Choose an Action tab, select the Function Calling Response action.
      2. On the Function Calling Response Configure Action page, enter the details given below:
        1. Click + Add New Account button to connect your ChatGPT account as shown in the Connect your ChatGPT Account to Automate step.
          Add_Account.png
        2. Select the API Model from the drop-down list for response predictions.

          Additional Resource: For more information about the API Models, please refer to ChatGPT API Models.

        3. In the Function Calling Response field, select the output from the previous Function Calling action step.
        4. In the Sub Automation Response field, select the output from the sub automation.
          Select_Fields.png
      3. Click the Show Optional Fields toggle button to use these optional fields:
        1. Enter the Number of Tokens to generate the content. This must be within the range of 1 to 2048.
        2. Enter a value for the Randomness of Responses of the generated content. 0 being the most precise and 2 being the most random content predictions. This must be within the range of 0 to 2.
        3. You can mark the Sanitize text checkbox to remove special characters or spaces from the chat response. Enabling this checkbox, eliminates any special characters or spaces in the chat response, resulting in a clean and compatible text.
          Show_Optional_Fields.png
      4. Click Proceed.
      5. Check if the details are correct. If yes, then click Test Action.
        ChatGPT_Function_Calling_Response_Test_Action
      6. You will get the response(s). Once set, click Save and Exit.
        ChatGPT_Function_Calling_Response_Save_Exit

      Action 6: Select the Prompt action

      The Prompt action returns the generated response(s) for the prompt provided via an automation in Automate. To use the Prompt action, follow the steps below:

      1. Under Choose an Action tab, select the Prompt action.
      2. On the Prompt Configure Action page, enter the details given below:
        1. Click + Add New Account button to connect your ChatGPT account as shown in the Connect your ChatGPT Account to Automate step.
          Add_Account.png
        2. Select the API Model from the drop-down list for response predictions.

          Additional Resource: For more information about the API Models, please refer to ChatGPT API Models.

        3. Provide the Prompt Text to generate response(s).
          Select_Fields.png
        4. Click the Show Optional Fields toggle button to use these optional fields:
          1. Enter the Number of Prompt Responses you want to be generated in the automation response. This must be within the range of 1 to 3.
          2. Enter the Number of Tokens to generate the content. This must be within the range of 1 to 2048.
          3. Enter a value for the Randomness of Responses of the generated content. 0 being the most precise and 2 being the most random content predictions. This must be within the range of 0 to 2.
          4. Provide the User Identifier name which helps the OpenAI platform to monitor and detect abuse.
          5. Provide the value to set the Frequency of Repeated Words. The most positive value is likely to avoid the use of repeated words. This must be within the range of -2 to 2.
          6. Provide the value to set the Presence of Repeated Responses. The most positive value is likely to generate a new response. This must be within the range of -2 to 2.
          7. You can mark the Sanitize text checkbox to remove special characters or spaces from the chat response. Enabling this checkbox, eliminates any special characters or spaces in the chat response, resulting in a clean and compatible text.
            Show_Optional_Fields.png
      3. Click Proceed.
      4. Check if the details are correct. If yes, then click Test Action.
        Test_Action.png
      5. You will get the response(s). Once set, click Save and Exit.
        ChatGPT-Prompt-Output.png

      This sets the ChatGPT action connector.

Additional Resources: Refer to the ChatGPT Use Cases guide for the two use cases to translate texts via the Function Calling action and generate image URLs via the DALL-E 3 Image Generator action.

Was this article helpful?
^