Skip to main content Skip to complementary content

Tutorial – Using the OpenAI analytics connector in Qlik Cloud

This tutorial teaches you how to work with the OpenAI analytics connector to enhance your Qlik Sense apps with contextual depth from generative AI models. Specifically, it shows you how to use the connector with two different configurations.

You can integrate your OpenAI analytic connection directly into your data model so that data generated by it is pre-loaded into the app. Alternatively, you can use it in chart expressions. The tutorial shows you how to get set up for working with the connector, and how to create connections with two different configurations. From there, it guides you through basic examples of how to incorporate the functionality into your Qlik Sense apps.

The examples in this tutorial can also be used for working with the Azure OpenAI analytics connector.

Interactive sheet showing how the OpenAI connector can be used to enhance analytics content

Interactive Qlik Sense app for using OpenAI to interact with app data. A single selection is made in the app, which triggers the OpenAI chart expression to be evaluated and provide a reponse on how to address the selected customer comment

Set up your OpenAI platform account and Qlik Cloud environment

Before you can work with the OpenAI analytics connector, you need to complete several steps. These include:

  • Create an OpenAI platform account

  • Obtain an OpenAI API key

  • Enable analytic connection functionality in Qlik Cloud

For full details, see Getting started with the OpenAI platform.

Information noteIf you are instead using the Azure OpenAI analytics connector, follow the setup provided in the Azure OpenAI connector documentation. See Creating an Azure OpenAI connection.

Create the connections

Create connections to the OpenAI analytics connector from the hub or from the Data load editor. Once you have created the connections, you are ready to start working directly with the OpenAI platform through the load script or in chart objects.

Information noteIf you are instead using the Azure OpenAI analytics connector, follow the setup provided in the Azure OpenAI connector documentation. See Creating an Azure OpenAI connection.
  1. Create a new connection to OpenAI from the Data load editor or the hub. In the Data load editor, the OpenAI connector is found under Analytics sources.

  2. Select the Configuration to use. Use one configuration for each connection that you make. For this tutorial, make a separate connection for each of the examples:

    • Example 1: OpenAI Completions API (GPT-3) - Rows

    • Example 2: OpenAI Completions API (GPT-3) - JSON Tables

    • Example 3: OpenAI Chat Completions API (GPT-3.5, GPT-4) - Rows

    • Interactive example: OpenAI Chat Completions API (GPT-3.5, GPT-4) - Rows

  3. Authenticate yourself on the connection by entering the OpenAI API key you generated in the preparations section of this tutorial.

  4. Adjust the default parameter values to suit your needs.

    Information noteYou will almost always need to alter the Max Tokens parameter value in order for the connection to function properly for your needs. This parameter controls the size of the response that will be generated.
  5. Add an Association Field to link the connection output to the data model of one or your apps. This will depend on which examples you work on.

    • For connections used in examples 1 to 3, enter RowId.

    • For the interactive example, leave this parameter blank.

  6. For the Name parameter, enter a distinct name value for each connection you create, indicating the configuration the connection uses. You will need to use these parameter values when working in the load script or with chart expressions.

    For the purposes of the tutorial examples, use:

    • Example 1: OpenAI Connection for Rows Completions (GPT-3)

    • Example 2: OpenAI Connection for JSON Tables Completions (GPT-3)

    • Example 3: Chat_Completions_GPT_3.5_4_Rows

    • Interactive example: Interactive_Chat_Completions_GPT_3.5_4_Rows

  7. Click Create.

Examples

Once you have created the connection with this configuration, you can use it in your load script and in chart expressions to communicate with OpenAI models.

An example of each process is shown in the following lessons.

These examples are designed to be stand-alone and can be completed independently of one another.

Did this page help you?

If you find any issues with this page or its content – a typo, a missing step, or a technical error – let us know how we can improve!