Creating an Azure OpenAI connection
To communicate with Azure OpenAI, create a connection to the Azure OpenAI analytics source.
Data received from these connections can be used in the load script and in chart expressions, to enhance your Qlik Sense analytics apps or scripts.
Before you start
Within your Microsoft Azure account, the Azure OpenAI service is located within Azure's Cognitive Services, and is not enabled by default. Contact Microsoft if you need assistance with getting the Azure OpenAI service enabled.
Available connector configurations
Set up your Azure OpenAI analytics connection with one of the following configurations.
OpenAI Completions API - Rows
This configuration sends each row of data as a question to the completions API (in small batches to improve performance). Each response will be stored as text in a table with the same number of rows as the input.
This configuration can be used in both the load script and chart expressions.
OpenAI Chat Completions API - Rows
This configuration sends each row of data as a request to the OpenAI Chat Completions API. In this case, the requests are made with the “user” message role, and each row of data from Qlik is sent as a separate request.
This configuration can be used in both the load script and chart expressions.
Creating the connection
You can create a connection to the Azure OpenAI analytics connector from the Create page of the Analytics activity center, or from the Data load editor in an app you have already created. Follow the steps below to create a connection.
For information about how to set the parameter values, see Azure OpenAI Service REST API reference.
Do the following:
-
Create a new Qlik Sense app or script and open Data load editor or Script.
-
Click Create new connection.
-
Under Space, select the space where the connection will be located.
-
Under Analytics sources, click Azure OpenAI.
-
Choose the Configuration needed. For more information about each available option, see Available connector configurations.
-
Enter your Azure OpenAI API Key.
- Enter the Azure API Version. This field is already populated with the current default.
-
Adjust any of the other default parameter values as required.
For additional descriptions of the parameters, see Configurable settings.
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. -
Click Create.
The data connection is saved to the space where the app is created, so it can be reused in other Qlik Sense apps or scripts.
Once you have created the connection, you can use it to load data to send to OpenAI. Additionally, you can use it in chart expressions. For more information, see Select and load data from an Azure OpenAI connection and Using Azure OpenAI connections in visualization expressions.
Configurable settings
The settings in the following table can be configured in the connection dialog.
Field | Description |
---|---|
Select Configuration | Under Configuration, select the configuration for the connector. For more information, see Available connector configurations. |
Authorization | Enter the Azure OpenAI API Key. For more information, see Azure OpenAI Service REST API reference. |
Azure OpenAI Request |
|
OpenAI Request |
|
Association |
Specify an Association Field, a field from the input data table containing a unique identifier. It is required to include this field in the source data when making an endpoint request for the results table returned to be associated with the source field table using a key. The designated field will be returned as a field in the response and enable the response to be associated with the source data in the data model. This can be any field with a unique ID, either from the source data or as part of the table load process. |
Name | The name of the connection. The default name is used if you do not enter a name. |