<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>article How to: Getting started with the OpenAI Connector in Qlik Automate in Official Support Articles</title>
    <link>https://community.qlik.com/t5/Official-Support-Articles/How-to-Getting-started-with-the-OpenAI-Connector-in-Qlik/ta-p/2077315</link>
    <description>&lt;P&gt;This article provides an overview of getting started with the OpenAI&amp;nbsp;connector&amp;nbsp;in Qlik Automate.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The OpenAI connector offers developers a range of powerful natural language processing capabilities. It allows for tasks such as text generation, translating between languages, analyzing sentiment, summarizing content, and building question-answering systems. These features enable you to bring additional value to your existing automations.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;Content:&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;LI-TOC indent="15" liststyle="none" maxheadinglevel="4"&gt;&lt;/LI-TOC&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Authentication&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H3&gt;
&lt;P&gt;Create a new automation and search for the OpenAI connector in the block library on the left side. Drag a block inside the automation editor canvas, and make sure to select the block to show the block configuration menu on the right side of the editor. Open the Connect tab in the configuration menu and provide your OpenAI API key.&amp;nbsp;Visit your&amp;nbsp;&lt;A href="https://platform.openai.com/account/api-keys" target="_blank" rel="noopener"&gt;API Keys&lt;/A&gt;&amp;nbsp;page to retrieve the API key you'll use in your requests.&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="connections tab openAI connector.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/187183i9278A11F20679997/image-size/large?v=v2&amp;amp;px=999" role="button" title="connections tab openAI connector.png" alt="connections tab openAI connector.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;H3&gt;&amp;nbsp;&lt;/H3&gt;
&lt;H3&gt;&lt;SPAN&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;&lt;SPAN class="TextRun SCXW109066101 BCX0" data-contrast="auto"&gt;&lt;SPAN class="NormalTextRun SCXW109066101 BCX0"&gt;Working with OpenAI blocks&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="LineBreakBlob BlobObject DragDrop SCXW109066101 BCX0"&gt;&lt;SPAN class="SCXW109066101 BCX0"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/H3&gt;
&lt;P&gt;Once the connection to your OpenAI account has been created, you can start building an automation that uses the connector.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The available blocks are:&lt;/P&gt;
&lt;UL class="lia-list-style-type-circle"&gt;
&lt;LI&gt;&lt;STRONG&gt;List Models&lt;/STRONG&gt;: This block returns a list of available models, including their names, descriptions, and capabilities.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Retrieve Model&lt;/STRONG&gt;: This block returns detailed information about a specific model, including its parameters, training data, and performance metrics.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Chat Completion&lt;/STRONG&gt;: This block generates a model response using a model. The request body includes the messages, model, and other parameters. The response body includes the generated model response. More information about each parameter in this block can be found at the end of this article.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Chat Completion Message&lt;/STRONG&gt;: This block generates a message that can be passed into the &lt;STRONG&gt;Message&lt;/STRONG&gt; parameter of the &lt;STRONG&gt;Chat Completion&lt;/STRONG&gt; block. The Message parameter requires a list of messages, but this block outputs a JSON object. To convert it into a list, use a Variable block of type &lt;STRONG&gt;List&lt;/STRONG&gt; and append the output of this block to that list variable. The list variable created using the Variable block should then be populated with the output from the &lt;STRONG&gt;Chat Completion Message&lt;/STRONG&gt; block.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Function Tool:&amp;nbsp;&lt;/STRONG&gt;This block is used to configure a tool parameter of type &lt;STRONG&gt;function&lt;/STRONG&gt; in the &lt;STRONG&gt;Chat Completion&lt;/STRONG&gt; block. Since the block returns a JSON object, you’ll need to convert it into a list before using it. To do that, use a Variable block of type &lt;STRONG&gt;List&lt;/STRONG&gt; and append the output of this block to the list variable. Then, reference that List variable in the Chat Completion block.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Raw API Request&lt;/STRONG&gt;: This&amp;nbsp;block allows you to make a generic request to the OpenAI API and allows you to configure the HTTP method and query or body parameters.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Raw API List Request&lt;/STRONG&gt;:&amp;nbsp;This&amp;nbsp;block lets you perform a generic GET request to the OpenAI API and returns the results as a list over which you can loop.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;For more details on the API, please refer to the following&amp;nbsp;&lt;A href="https://platform.openai.com/docs/api-reference" target="_blank" rel="noopener"&gt;link&lt;/A&gt;.&lt;/P&gt;
&lt;BLOCKQUOTE class="quote"&gt;At the time of writing this article, the Images and Audio endpoints in the OpenAI API are in beta state but can be used through the Raw API Request blocks.&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Tips and limitations&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H3&gt;
&lt;P&gt;Below are a couple of tips and limitations to keep in mind when working with the OpenAI connector in automations.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;If the usage quota is exceeded with the Free OpenAI account, the following error message will be displayed. Upgrading to a paid OpenAI account will resolve the issue.&lt;BR /&gt;&lt;LI-CODE lang="markup"&gt;{
    "error": {
        "message": "You exceeded your current quota, please check your plan and billing details.",
        "type": "insufficient_quota",
        "param": null,
        "code": null
    }
}​&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;&amp;nbsp;For an overview of the rate limitations in the OpenAI API, please refer to this&amp;nbsp;&lt;A style="font-family: inherit; background-color: #ffffff;" href="https://platform.openai.com/docs/guides/rate-limits/overview" target="_blank" rel="noopener"&gt;documentation&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Raw API Request&lt;/STRONG&gt; block:&amp;nbsp;&lt;SPAN&gt;This connector &lt;/SPAN&gt;&lt;SPAN&gt;does not support the OpenAI API with the content type Multipart/form-data. Following API are not supported in the&amp;nbsp;&lt;STRONG&gt;Raw API Request&lt;/STRONG&gt; block&lt;/SPAN&gt;
&lt;UL class="lia-list-style-type-circle"&gt;
&lt;LI&gt;&lt;SPAN&gt;Upload file.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt; Create an image edit.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Create image variation.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Create transcription.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Create a translation.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;No paging for list blocks&lt;/STRONG&gt;: Since the OpenAI API has no support for paging, all records a list block in an automation retrieves are returned in a single API response by OpenAI.&amp;nbsp;The &lt;STRONG&gt;List Models&lt;/STRONG&gt; and the &lt;STRONG&gt;Raw API List Request&lt;/STRONG&gt; blocks are examples of list blocks.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3&gt;&lt;FONT style="--darkreader-inline-color: #6ecf9e;" color="#339966" data-darkreader-inline-color=""&gt;&lt;STRONG&gt;A Deep Dive into Chat Completion Block&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H3&gt;
&lt;P&gt;&lt;STRONG&gt;Chat completion&amp;nbsp;&lt;/STRONG&gt;block: The &lt;STRONG&gt;model&lt;/STRONG&gt;&amp;nbsp;and &lt;STRONG&gt;messages&lt;/STRONG&gt; parameter, the only required parameters in this block, allow us to produce a random answer. A minimum prerequisite for a more insightful response is a &lt;STRONG&gt;Messages, M&lt;/STRONG&gt;&lt;STRONG&gt;odel&lt;/STRONG&gt;, and &lt;STRONG&gt;Max Completion Tokens&lt;/STRONG&gt;&amp;nbsp;input parameter. Other input variables may be employed to narrow down the response.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;Messages:&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;This parameter expects a list of messages representing the conversation so far.
&lt;DIV class="flex flex-col text-sm pb-25"&gt;
&lt;ARTICLE class="text-token-text-primary w-full focus:outline-none [--shadow-height:45px] has-data-writing-block:pointer-events-none has-data-writing-block:-mt-(--shadow-height) has-data-writing-block:pt-(--shadow-height) [&amp;amp;:has([data-writing-block])&amp;gt;*]:pointer-events-auto scroll-mt-[calc(var(--header-height)+min(200px,max(70px,20svh)))]" dir="auto" tabindex="-1" data-turn="assistant" data-scroll-anchor="true" data-testid="conversation-turn-204" data-turn-id="request-6980aff4-7bf4-832a-90a5-ecf6b3d70e62-8"&gt;
&lt;DIV class="text-base my-auto mx-auto pb-10 [--thread-content-margin:--spacing(4)] @w-sm/main:[--thread-content-margin:--spacing(6)] @w-lg/main:[--thread-content-margin:--spacing(16)] px-(--thread-content-margin)"&gt;
&lt;DIV class="[--thread-content-max-width:40rem] @w-lg/main:[--thread-content-max-width:48rem] mx-auto max-w-(--thread-content-max-width) flex-1 group/turn-messages focus-visible:outline-hidden relative flex w-full min-w-0 flex-col agent-turn" tabindex="-1"&gt;
&lt;DIV class="flex max-w-full flex-col grow"&gt;
&lt;DIV class="min-h-8 text-message relative flex w-full flex-col items-end gap-2 text-start break-words whitespace-normal [.text-message+&amp;amp;]:mt-1" dir="auto" data-message-model-slug="gpt-5-2" data-message-id="3df325ab-c1e3-45a7-af0e-d7e671eae7b3" data-message-author-role="assistant"&gt;
&lt;DIV class="flex w-full flex-col gap-1 empty:hidden first:pt-[1px]"&gt;
&lt;DIV class="markdown prose dark:prose-invert w-full wrap-break-word dark markdown-new-styling"&gt;
&lt;P data-end="261" data-start="83"&gt;Use the &lt;STRONG data-end="118" data-start="91"&gt;Chat Completion Message&lt;/STRONG&gt; block to generate a message. Since that block returns a JSON object, you must convert it into a list before passing it to this parameter. To do this, create a &lt;STRONG data-end="296" data-start="284"&gt;Variable&lt;/STRONG&gt;&amp;nbsp;of type &lt;STRONG data-end="319" data-start="311"&gt;List&lt;/STRONG&gt; and append the output of the &lt;STRONG data-end="376" data-start="349"&gt;Chat Completion Message&lt;/STRONG&gt; block to that list variable. Finally, use this List variable as the input for the parameter.&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/ARTICLE&gt;
&lt;/DIV&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;STRONG&gt;Model: &lt;/STRONG&gt;&lt;/STRONG&gt;This is the parameter in this block that specifies which model to use for generating completions.&amp;nbsp;&lt;SPAN&gt;You can use the lookup functionality or the&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://platform.openai.com/docs/api-reference/models/list" target="_blank" rel="noopener"&gt;List models API&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;to see all available models or see OpenAI's&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://platform.openai.com/docs/models/overview" target="_blank" rel="noopener"&gt;Model overview&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;for their descriptions.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;Example value: &lt;EM&gt;"text-davinci-003"&amp;nbsp;&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Max Completion Tokens&lt;/STRONG&gt;: Specifies the maximum number of tokens in the generated completion response. More information about how the token count is calculated by OpenAI can be found here: &lt;A style="background-color: #ffffff;" href="https://platform.openai.com/tokenizer" target="_self"&gt;Tokenizer&lt;/A&gt;.&lt;/P&gt;
Example: &lt;EM&gt;50&lt;/EM&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;SPAN&gt;The following parameters are optional in most use cases but could be used to fine-tune the response:&lt;/SPAN&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;Tools:&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;A list of tools that the model can invoke. At present, only &lt;STRONG style="font-family: inherit;" data-end="73" data-start="60"&gt;functions&lt;/STRONG&gt;&lt;SPAN&gt; are supported as tools.&amp;nbsp;&lt;/SPAN&gt;Use the &lt;STRONG style="font-family: inherit;" data-end="126" data-start="109"&gt;Function Tool&lt;/STRONG&gt;&lt;SPAN&gt; block to define a function. This block returns a JSON object, which must then be converted into a list. To do so, create a &lt;STRONG style="font-family: inherit;" data-end="265" data-start="253"&gt;Variable&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;of type &lt;/SPAN&gt;&lt;STRONG style="font-family: inherit;" data-end="288" data-start="280"&gt;List&lt;/STRONG&gt;&lt;SPAN&gt; and add the output of the &lt;/SPAN&gt;&lt;STRONG style="font-family: inherit;" data-end="332" data-start="315"&gt;Function Tool&lt;/STRONG&gt;&lt;SPAN&gt; block to that list variable.&amp;nbsp;Finally, use this List variable as the input of this parameter.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;Tool Choice:&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;Controls which (if any) function is called by the model.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;none &lt;/FONT&gt;&lt;SPAN&gt;means the model will not invoke any functions and will generate a regular message instead.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;auto &lt;/FONT&gt;&lt;SPAN&gt;allows the model to decide whether to produce a message or call one or more functions.&lt;/SPAN&gt;
&lt;P data-end="246" data-start="190"&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;FONT face="courier new,courier"&gt;required&amp;nbsp;&lt;/FONT&gt;forces the model to call at least one function. You can also enforce a specific function by setting:&amp;nbsp;&lt;FONT face="courier new,courier"&gt;{ "type": "function", "function": { "name": "my_function" } }&lt;/FONT&gt;&lt;EM&gt;,&lt;/EM&gt; which compels the model to call that exact function.&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;none&amp;nbsp;&lt;/FONT&gt;&lt;SPAN&gt;is the default when no tools are present.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;auto&amp;nbsp;&lt;/FONT&gt;&lt;SPAN&gt;is the default if tools are present.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Logit Bias&lt;/STRONG&gt;:&amp;nbsp;The `logit bias` parameter in the OpenAI API enables you to prioritize certain tokens over others when generating text. For instance, by assigning a higher bias to "cat" (e.g., 3.0) and lower biases to other tokens like "dog" (e.g., 1.5) and "bird" (e.g., -2.0), you can influence the model to generate more content related to cats.&lt;BR /&gt;&lt;BR /&gt;Example: &lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;"cat": 3.0,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;"dog": 1.5,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;"bird": -2.0&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;Number Of Completions:&lt;/STRONG&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;Specifies the number of completions to generate.&lt;BR /&gt;&lt;BR /&gt;Example: &lt;EM&gt;3&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt;Presence Penalty&lt;/SPAN&gt;: &lt;/STRONG&gt;&lt;/STRONG&gt;Adjusts the model's likelihood of generating repetitive phrases. Higher values (e.g., 0.8) make the output more focused and deterministic, while lower values (e.g., 0.2) make it more creative.&lt;BR /&gt;&lt;BR /&gt;Example: &lt;EM&gt;0.6&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Temperature&lt;/STRONG&gt;:&amp;nbsp;Controls the randomness of the output. Higher values (e.g., 0.8) make the output more random, while lower values (e.g., 0.2) make it more focused and deterministic.&lt;BR /&gt;&lt;BR /&gt;Example: &lt;EM&gt;0.6&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG style="font-family: inherit;"&gt;Top p:&lt;/STRONG&gt;&lt;SPAN&gt; Controls the diversity of the generated output by setting a probability threshold. &lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;top_p &lt;/FONT&gt;&lt;SPAN&gt;(or &lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;nucleus&lt;/FONT&gt;&lt;SPAN&gt;) selects the most likely tokens until the cumulative probability exceeds the threshold.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;Example:&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;0.8&amp;nbsp;&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;STRONG&gt;User:&amp;nbsp;&lt;/STRONG&gt;&lt;/STRONG&gt;Specifies an optional user ID or string that can be used to customize the model's behavior based on the user.&lt;BR /&gt;&lt;BR /&gt;Example: &lt;EM&gt;"12345"&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;STRONG&gt;Response Format:&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;/STRONG&gt;Defines the format of the model’s response output. Setting it to &lt;FONT face="courier new,courier"&gt;{ "type": "json_schema", "json_schema": { ... } }&lt;/FONT&gt; &lt;SPAN&gt;enables &lt;/SPAN&gt;&lt;STRONG style="font-family: inherit;" data-end="150" data-start="128"&gt;Structured Outputs&lt;/STRONG&gt;&lt;SPAN&gt;, ensuring the model strictly adheres to the provided JSON schema.&amp;nbsp;&lt;/SPAN&gt;Setting it to &lt;FONT face="courier new,courier"&gt;{ "type": "json_object" }&lt;/FONT&gt; &lt;SPAN&gt;enables the legacy JSON mode, which guarantees that the model’s response is valid JSON but does not enforce a specific schema structure.&amp;nbsp;&lt;/SPAN&gt;For models that support it, using &lt;STRONG style="font-family: inherit;" data-end="451" data-start="436"&gt;json_schema&lt;/STRONG&gt;&lt;SPAN&gt; is recommended.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3&gt;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;How to use Structured Outputs with Chat Completion Block&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/H3&gt;
&lt;P&gt;Structured Outputs is an advanced OpenAI feature that ensures AI responses always adhere to a JSON schema you define. This guide demonstrates step-by-step how to use the &lt;STRONG&gt;Chat Completion&lt;/STRONG&gt; block in Qlik Automate to implement Structured Outputs using a practical math tutoring example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;What are Structured Outputs?&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;Structured Outputs guarantee that OpenAI models return responses in a specific JSON format you define, eliminating the need for post-processing validation or retries. Unlike JSON mode (which only ensures valid JSON), Structured Outputs enforce &lt;STRONG&gt;schema adherence&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Supported Models&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;Structured Outputs require: &lt;EM&gt;gpt-4o-mini&lt;/EM&gt;, &lt;EM&gt;gpt-4o-mini-2024-07-18&lt;/EM&gt;, and &lt;EM&gt;gpt-4o-2024-08-06&lt;/EM&gt; model snapshots and later.&lt;/P&gt;
&lt;P&gt;This example demonstrates how to create a Qlik automation that uses Structured Outputs to provide step-by-step math solutions with guaranteed formatting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;Step 1: Define Your Response Schema&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/H4&gt;
&lt;P&gt;Before configuring the Chat Completion block, define the JSON schema that describes the exact structure of the response.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Math Reasoning Schema:&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;{
  "type": "json_schema",
  "json_schema": {
    "name": "math_reasoning",
    "schema": {
      "type": "object",
      "properties": {
        "steps": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "explanation": {
                "type": "string"
              },
              "output": {
                "type": "string"
              }
            },
            "required": [
              "explanation",
              "output"
            ],
            "additionalProperties": false
          }
        },
        "final_answer": {
          "type": "string"
        }
      },
      "required": [
        "steps",
        "final_answer"
      ],
      "additionalProperties": false
    },
    "strict": true
  }
}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This schema requires:&lt;/P&gt;
&lt;UL class="lia-list-style-type-circle"&gt;
&lt;LI&gt;A &lt;FONT face="courier new,courier"&gt;steps &lt;/FONT&gt;array containing objects with &lt;FONT face="courier new,courier"&gt;explanation &lt;/FONT&gt;and &lt;FONT face="courier new,courier"&gt;output &lt;/FONT&gt;fields&lt;/LI&gt;
&lt;LI&gt;A &lt;FONT face="courier new,courier"&gt;final_answer&lt;/FONT&gt; string&lt;/LI&gt;
&lt;LI&gt;All fields are required&lt;/LI&gt;
&lt;LI&gt;No additional properties are allowed&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;Step 2: Create the Automation&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/H4&gt;
&lt;OL&gt;
&lt;LI&gt;Go to your Qlik Sense tenant and create a new automation.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Search for the &lt;STRONG&gt;OpenAI&lt;/STRONG&gt; connector in the block library.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Drag the &lt;STRONG&gt;Chat Completion Message&lt;/STRONG&gt; block into the automation canvas.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Open the &lt;STRONG&gt;Connection&lt;/STRONG&gt; tab in the configuration panel on the right, and either choose an existing connection or enter a new key.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Select the &lt;STRONG&gt;Chat Completion Message&lt;/STRONG&gt; block to display the configuration panel on the right.&lt;BR /&gt;&lt;BR /&gt;This produces one message object (role + content) each time it runs.&lt;BR /&gt;&lt;BR /&gt;Configure the role (system/user/assistant) and the message text.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Use a &lt;STRONG&gt;Variable&lt;/STRONG&gt; block of type &lt;STRONG&gt;List&lt;/STRONG&gt; to collect messages:&lt;BR /&gt;&lt;BR /&gt;Create a list variable (e.g. &lt;FONT face="courier new,courier"&gt;chatMessages&lt;/FONT&gt;).&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Repeat step 5 for all messages you need in the conversation.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Add each Chat Completion Message block output as an item to &lt;FONT face="courier new,courier"&gt;chatMessages&lt;/FONT&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;Step 3: Configure the Chat Completion Block&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/H4&gt;
&lt;OL&gt;
&lt;LI&gt;Drag a &lt;STRONG&gt;Chat Completion&lt;/STRONG&gt; block into the automation.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;In the &lt;STRONG&gt;Inputs&lt;/STRONG&gt; tab of the Chat Completion block, set the following:&lt;BR /&gt;&lt;BR /&gt;
&lt;OL class="lia-list-style-type-lower-alpha"&gt;
&lt;LI&gt;&lt;STRONG&gt;Model&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;Set to: &lt;EM&gt;gpt-4o-mini&lt;/EM&gt;, &lt;EM&gt;gpt-4o-mini-2024-07-18&lt;/EM&gt;, &lt;EM&gt;gpt-4o-2024-08-06&lt;/EM&gt;&lt;SPAN&gt; (or later). Required for Structured Outputs support.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Messages&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;SPAN&gt;Map this to the &lt;/SPAN&gt;&lt;EM style="font-family: inherit;"&gt;list variable&lt;/EM&gt;&lt;SPAN&gt; (e.g., &lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;chatMessages&lt;/FONT&gt;&lt;SPAN&gt;) that you populated using the Chat Completion Message blocks.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;If you prefer not to use a variable, you can still input a literal JSON array manually, but the variable approach ensures dynamic message construction.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;Example manual array:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;[
  {
    "role": "system",
    "content": "You are a helpful math tutor. Guide the user through solving math problems step by step. Provide clear explanations and show all work."
  },
  {
    "role": "user",
    "content": "How can I solve 8x + 7 = -23?"
  }
]&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Response Format (Critical for Structured Outputs)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Set the &lt;FONT face="courier new,courier"&gt;response_format &lt;/FONT&gt;parameter to include your schema:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;{
  "type": "json_schema",
  "json_schema": {
    "name": "math_reasoning",
    "schema": {
      "type": "object",
      "properties": {
        "steps": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "explanation": {
                "type": "string"
              },
              "output": {
                "type": "string"
              }
            },
            "required": [
              "explanation",
              "output"
            ],
            "additionalProperties": false
          }
        },
        "final_answer": {
          "type": "string"
        }
      },
      "required": [
        "steps",
        "final_answer"
      ],
      "additionalProperties": false
    },
    "strict": true
  }
}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Add an object formula on top of this JSON schema to convert it into a proper JSON object.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Important:&lt;/STRONG&gt; Set &lt;FONT face="courier new,courier"&gt;"strict": true &lt;/FONT&gt;to enable Structured Outputs mode.&lt;/P&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Step 4: Run the Automation&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;After the Chat Completion block executes, the response is parsed and available in a structured format. You can then use the structured output to build the formatted message and send it over Slack or email.&lt;/P&gt;
&lt;P&gt;You can find the demo automation attached to this article (&lt;EM&gt;open-ai-structured-output.json&lt;/EM&gt;).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Best Practices&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;UL class="lia-list-style-type-circle"&gt;
&lt;LI&gt;&lt;STRONG&gt;Keep schemas simple&lt;/STRONG&gt;: Start with basic schemas before adding complexity.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Use descriptions&lt;/STRONG&gt;: Add clear descriptions to all properties.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Provide examples&lt;/STRONG&gt;: Include examples in your system prompt.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Test schemas&lt;/STRONG&gt;: Validate with sample prompts before production.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Version control&lt;/STRONG&gt;: Track schema changes for consistency.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Handle refusals&lt;/STRONG&gt;: Always check for model refusals in responses.&lt;/LI&gt;
&lt;/UL&gt;
&lt;H4&gt;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;Resources&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/H4&gt;
&lt;UL class="lia-list-style-type-circle"&gt;
&lt;LI&gt;&lt;A href="https://developers.openai.com/api/docs/guides/structured-outputs" target="_blank" rel="noopener"&gt;OpenAI Structured Outputs Documentation&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://json-schema.org/" target="_blank" rel="noopener"&gt;JSON Schema Specification&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://developers.openai.com/api/docs/api-reference/chat/create" target="_blank" rel="noopener"&gt;OpenAI Chat Completions API&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;</description>
    <pubDate>Thu, 05 Mar 2026 10:55:26 GMT</pubDate>
    <dc:creator>Jayarams</dc:creator>
    <dc:date>2026-03-05T10:55:26Z</dc:date>
    <item>
      <title>How to: Getting started with the OpenAI Connector in Qlik Automate</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/How-to-Getting-started-with-the-OpenAI-Connector-in-Qlik/ta-p/2077315</link>
      <description>&lt;P&gt;This article provides an overview of getting started with the OpenAI&amp;nbsp;connector&amp;nbsp;in Qlik Automate.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The OpenAI connector offers developers a range of powerful natural language processing capabilities. It allows for tasks such as text generation, translating between languages, analyzing sentiment, summarizing content, and building question-answering systems. These features enable you to bring additional value to your existing automations.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;Content:&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;LI-TOC indent="15" liststyle="none" maxheadinglevel="4"&gt;&lt;/LI-TOC&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Authentication&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H3&gt;
&lt;P&gt;Create a new automation and search for the OpenAI connector in the block library on the left side. Drag a block inside the automation editor canvas, and make sure to select the block to show the block configuration menu on the right side of the editor. Open the Connect tab in the configuration menu and provide your OpenAI API key.&amp;nbsp;Visit your&amp;nbsp;&lt;A href="https://platform.openai.com/account/api-keys" target="_blank" rel="noopener"&gt;API Keys&lt;/A&gt;&amp;nbsp;page to retrieve the API key you'll use in your requests.&lt;/P&gt;
&lt;P class="lia-indent-padding-left-30px"&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="connections tab openAI connector.png" style="width: 999px;"&gt;&lt;img src="https://community.qlik.com/t5/image/serverpage/image-id/187183i9278A11F20679997/image-size/large?v=v2&amp;amp;px=999" role="button" title="connections tab openAI connector.png" alt="connections tab openAI connector.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;H3&gt;&amp;nbsp;&lt;/H3&gt;
&lt;H3&gt;&lt;SPAN&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;&lt;SPAN class="TextRun SCXW109066101 BCX0" data-contrast="auto"&gt;&lt;SPAN class="NormalTextRun SCXW109066101 BCX0"&gt;Working with OpenAI blocks&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class="LineBreakBlob BlobObject DragDrop SCXW109066101 BCX0"&gt;&lt;SPAN class="SCXW109066101 BCX0"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/H3&gt;
&lt;P&gt;Once the connection to your OpenAI account has been created, you can start building an automation that uses the connector.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The available blocks are:&lt;/P&gt;
&lt;UL class="lia-list-style-type-circle"&gt;
&lt;LI&gt;&lt;STRONG&gt;List Models&lt;/STRONG&gt;: This block returns a list of available models, including their names, descriptions, and capabilities.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Retrieve Model&lt;/STRONG&gt;: This block returns detailed information about a specific model, including its parameters, training data, and performance metrics.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Chat Completion&lt;/STRONG&gt;: This block generates a model response using a model. The request body includes the messages, model, and other parameters. The response body includes the generated model response. More information about each parameter in this block can be found at the end of this article.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Chat Completion Message&lt;/STRONG&gt;: This block generates a message that can be passed into the &lt;STRONG&gt;Message&lt;/STRONG&gt; parameter of the &lt;STRONG&gt;Chat Completion&lt;/STRONG&gt; block. The Message parameter requires a list of messages, but this block outputs a JSON object. To convert it into a list, use a Variable block of type &lt;STRONG&gt;List&lt;/STRONG&gt; and append the output of this block to that list variable. The list variable created using the Variable block should then be populated with the output from the &lt;STRONG&gt;Chat Completion Message&lt;/STRONG&gt; block.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Function Tool:&amp;nbsp;&lt;/STRONG&gt;This block is used to configure a tool parameter of type &lt;STRONG&gt;function&lt;/STRONG&gt; in the &lt;STRONG&gt;Chat Completion&lt;/STRONG&gt; block. Since the block returns a JSON object, you’ll need to convert it into a list before using it. To do that, use a Variable block of type &lt;STRONG&gt;List&lt;/STRONG&gt; and append the output of this block to the list variable. Then, reference that List variable in the Chat Completion block.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Raw API Request&lt;/STRONG&gt;: This&amp;nbsp;block allows you to make a generic request to the OpenAI API and allows you to configure the HTTP method and query or body parameters.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Raw API List Request&lt;/STRONG&gt;:&amp;nbsp;This&amp;nbsp;block lets you perform a generic GET request to the OpenAI API and returns the results as a list over which you can loop.&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;For more details on the API, please refer to the following&amp;nbsp;&lt;A href="https://platform.openai.com/docs/api-reference" target="_blank" rel="noopener"&gt;link&lt;/A&gt;.&lt;/P&gt;
&lt;BLOCKQUOTE class="quote"&gt;At the time of writing this article, the Images and Audio endpoints in the OpenAI API are in beta state but can be used through the Raw API Request blocks.&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Tips and limitations&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H3&gt;
&lt;P&gt;Below are a couple of tips and limitations to keep in mind when working with the OpenAI connector in automations.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;If the usage quota is exceeded with the Free OpenAI account, the following error message will be displayed. Upgrading to a paid OpenAI account will resolve the issue.&lt;BR /&gt;&lt;LI-CODE lang="markup"&gt;{
    "error": {
        "message": "You exceeded your current quota, please check your plan and billing details.",
        "type": "insufficient_quota",
        "param": null,
        "code": null
    }
}​&lt;/LI-CODE&gt;&lt;/LI&gt;
&lt;LI&gt;&amp;nbsp;For an overview of the rate limitations in the OpenAI API, please refer to this&amp;nbsp;&lt;A style="font-family: inherit; background-color: #ffffff;" href="https://platform.openai.com/docs/guides/rate-limits/overview" target="_blank" rel="noopener"&gt;documentation&lt;/A&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Raw API Request&lt;/STRONG&gt; block:&amp;nbsp;&lt;SPAN&gt;This connector &lt;/SPAN&gt;&lt;SPAN&gt;does not support the OpenAI API with the content type Multipart/form-data. Following API are not supported in the&amp;nbsp;&lt;STRONG&gt;Raw API Request&lt;/STRONG&gt; block&lt;/SPAN&gt;
&lt;UL class="lia-list-style-type-circle"&gt;
&lt;LI&gt;&lt;SPAN&gt;Upload file.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt; Create an image edit.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Create image variation.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Create transcription.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;Create a translation.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;No paging for list blocks&lt;/STRONG&gt;: Since the OpenAI API has no support for paging, all records a list block in an automation retrieves are returned in a single API response by OpenAI.&amp;nbsp;The &lt;STRONG&gt;List Models&lt;/STRONG&gt; and the &lt;STRONG&gt;Raw API List Request&lt;/STRONG&gt; blocks are examples of list blocks.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3&gt;&lt;FONT style="--darkreader-inline-color: #6ecf9e;" color="#339966" data-darkreader-inline-color=""&gt;&lt;STRONG&gt;A Deep Dive into Chat Completion Block&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H3&gt;
&lt;P&gt;&lt;STRONG&gt;Chat completion&amp;nbsp;&lt;/STRONG&gt;block: The &lt;STRONG&gt;model&lt;/STRONG&gt;&amp;nbsp;and &lt;STRONG&gt;messages&lt;/STRONG&gt; parameter, the only required parameters in this block, allow us to produce a random answer. A minimum prerequisite for a more insightful response is a &lt;STRONG&gt;Messages, M&lt;/STRONG&gt;&lt;STRONG&gt;odel&lt;/STRONG&gt;, and &lt;STRONG&gt;Max Completion Tokens&lt;/STRONG&gt;&amp;nbsp;input parameter. Other input variables may be employed to narrow down the response.&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;Messages:&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;This parameter expects a list of messages representing the conversation so far.
&lt;DIV class="flex flex-col text-sm pb-25"&gt;
&lt;ARTICLE class="text-token-text-primary w-full focus:outline-none [--shadow-height:45px] has-data-writing-block:pointer-events-none has-data-writing-block:-mt-(--shadow-height) has-data-writing-block:pt-(--shadow-height) [&amp;amp;:has([data-writing-block])&amp;gt;*]:pointer-events-auto scroll-mt-[calc(var(--header-height)+min(200px,max(70px,20svh)))]" dir="auto" tabindex="-1" data-turn="assistant" data-scroll-anchor="true" data-testid="conversation-turn-204" data-turn-id="request-6980aff4-7bf4-832a-90a5-ecf6b3d70e62-8"&gt;
&lt;DIV class="text-base my-auto mx-auto pb-10 [--thread-content-margin:--spacing(4)] @w-sm/main:[--thread-content-margin:--spacing(6)] @w-lg/main:[--thread-content-margin:--spacing(16)] px-(--thread-content-margin)"&gt;
&lt;DIV class="[--thread-content-max-width:40rem] @w-lg/main:[--thread-content-max-width:48rem] mx-auto max-w-(--thread-content-max-width) flex-1 group/turn-messages focus-visible:outline-hidden relative flex w-full min-w-0 flex-col agent-turn" tabindex="-1"&gt;
&lt;DIV class="flex max-w-full flex-col grow"&gt;
&lt;DIV class="min-h-8 text-message relative flex w-full flex-col items-end gap-2 text-start break-words whitespace-normal [.text-message+&amp;amp;]:mt-1" dir="auto" data-message-model-slug="gpt-5-2" data-message-id="3df325ab-c1e3-45a7-af0e-d7e671eae7b3" data-message-author-role="assistant"&gt;
&lt;DIV class="flex w-full flex-col gap-1 empty:hidden first:pt-[1px]"&gt;
&lt;DIV class="markdown prose dark:prose-invert w-full wrap-break-word dark markdown-new-styling"&gt;
&lt;P data-end="261" data-start="83"&gt;Use the &lt;STRONG data-end="118" data-start="91"&gt;Chat Completion Message&lt;/STRONG&gt; block to generate a message. Since that block returns a JSON object, you must convert it into a list before passing it to this parameter. To do this, create a &lt;STRONG data-end="296" data-start="284"&gt;Variable&lt;/STRONG&gt;&amp;nbsp;of type &lt;STRONG data-end="319" data-start="311"&gt;List&lt;/STRONG&gt; and append the output of the &lt;STRONG data-end="376" data-start="349"&gt;Chat Completion Message&lt;/STRONG&gt; block to that list variable. Finally, use this List variable as the input for the parameter.&lt;/P&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/ARTICLE&gt;
&lt;/DIV&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;STRONG&gt;Model: &lt;/STRONG&gt;&lt;/STRONG&gt;This is the parameter in this block that specifies which model to use for generating completions.&amp;nbsp;&lt;SPAN&gt;You can use the lookup functionality or the&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://platform.openai.com/docs/api-reference/models/list" target="_blank" rel="noopener"&gt;List models API&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;to see all available models or see OpenAI's&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://platform.openai.com/docs/models/overview" target="_blank" rel="noopener"&gt;Model overview&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;for their descriptions.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;Example value: &lt;EM&gt;"text-davinci-003"&amp;nbsp;&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Max Completion Tokens&lt;/STRONG&gt;: Specifies the maximum number of tokens in the generated completion response. More information about how the token count is calculated by OpenAI can be found here: &lt;A style="background-color: #ffffff;" href="https://platform.openai.com/tokenizer" target="_self"&gt;Tokenizer&lt;/A&gt;.&lt;/P&gt;
Example: &lt;EM&gt;50&lt;/EM&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&lt;SPAN&gt;The following parameters are optional in most use cases but could be used to fine-tune the response:&lt;/SPAN&gt;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;Tools:&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;A list of tools that the model can invoke. At present, only &lt;STRONG style="font-family: inherit;" data-end="73" data-start="60"&gt;functions&lt;/STRONG&gt;&lt;SPAN&gt; are supported as tools.&amp;nbsp;&lt;/SPAN&gt;Use the &lt;STRONG style="font-family: inherit;" data-end="126" data-start="109"&gt;Function Tool&lt;/STRONG&gt;&lt;SPAN&gt; block to define a function. This block returns a JSON object, which must then be converted into a list. To do so, create a &lt;STRONG style="font-family: inherit;" data-end="265" data-start="253"&gt;Variable&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;of type &lt;/SPAN&gt;&lt;STRONG style="font-family: inherit;" data-end="288" data-start="280"&gt;List&lt;/STRONG&gt;&lt;SPAN&gt; and add the output of the &lt;/SPAN&gt;&lt;STRONG style="font-family: inherit;" data-end="332" data-start="315"&gt;Function Tool&lt;/STRONG&gt;&lt;SPAN&gt; block to that list variable.&amp;nbsp;Finally, use this List variable as the input of this parameter.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;Tool Choice:&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;Controls which (if any) function is called by the model.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;none &lt;/FONT&gt;&lt;SPAN&gt;means the model will not invoke any functions and will generate a regular message instead.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;auto &lt;/FONT&gt;&lt;SPAN&gt;allows the model to decide whether to produce a message or call one or more functions.&lt;/SPAN&gt;
&lt;P data-end="246" data-start="190"&gt;&lt;EM&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;FONT face="courier new,courier"&gt;required&amp;nbsp;&lt;/FONT&gt;forces the model to call at least one function. You can also enforce a specific function by setting:&amp;nbsp;&lt;FONT face="courier new,courier"&gt;{ "type": "function", "function": { "name": "my_function" } }&lt;/FONT&gt;&lt;EM&gt;,&lt;/EM&gt; which compels the model to call that exact function.&lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;none&amp;nbsp;&lt;/FONT&gt;&lt;SPAN&gt;is the default when no tools are present.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;auto&amp;nbsp;&lt;/FONT&gt;&lt;SPAN&gt;is the default if tools are present.&lt;/SPAN&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Logit Bias&lt;/STRONG&gt;:&amp;nbsp;The `logit bias` parameter in the OpenAI API enables you to prioritize certain tokens over others when generating text. For instance, by assigning a higher bias to "cat" (e.g., 3.0) and lower biases to other tokens like "dog" (e.g., 1.5) and "bird" (e.g., -2.0), you can influence the model to generate more content related to cats.&lt;BR /&gt;&lt;BR /&gt;Example: &lt;BR /&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;{&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;"cat": 3.0,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;"dog": 1.5,&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;"bird": -2.0&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT face="courier new,courier"&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;&lt;SPAN&gt;&lt;STRONG&gt;Number Of Completions:&lt;/STRONG&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;Specifies the number of completions to generate.&lt;BR /&gt;&lt;BR /&gt;Example: &lt;EM&gt;3&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;STRONG&gt;&lt;SPAN&gt;Presence Penalty&lt;/SPAN&gt;: &lt;/STRONG&gt;&lt;/STRONG&gt;Adjusts the model's likelihood of generating repetitive phrases. Higher values (e.g., 0.8) make the output more focused and deterministic, while lower values (e.g., 0.2) make it more creative.&lt;BR /&gt;&lt;BR /&gt;Example: &lt;EM&gt;0.6&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Temperature&lt;/STRONG&gt;:&amp;nbsp;Controls the randomness of the output. Higher values (e.g., 0.8) make the output more random, while lower values (e.g., 0.2) make it more focused and deterministic.&lt;BR /&gt;&lt;BR /&gt;Example: &lt;EM&gt;0.6&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG style="font-family: inherit;"&gt;Top p:&lt;/STRONG&gt;&lt;SPAN&gt; Controls the diversity of the generated output by setting a probability threshold. &lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;top_p &lt;/FONT&gt;&lt;SPAN&gt;(or &lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;nucleus&lt;/FONT&gt;&lt;SPAN&gt;) selects the most likely tokens until the cumulative probability exceeds the threshold.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;Example:&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;0.8&amp;nbsp;&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;STRONG&gt;User:&amp;nbsp;&lt;/STRONG&gt;&lt;/STRONG&gt;Specifies an optional user ID or string that can be used to customize the model's behavior based on the user.&lt;BR /&gt;&lt;BR /&gt;Example: &lt;EM&gt;"12345"&lt;BR /&gt;&lt;BR /&gt;&lt;/EM&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;&lt;STRONG&gt;Response Format:&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;&lt;/STRONG&gt;Defines the format of the model’s response output. Setting it to &lt;FONT face="courier new,courier"&gt;{ "type": "json_schema", "json_schema": { ... } }&lt;/FONT&gt; &lt;SPAN&gt;enables &lt;/SPAN&gt;&lt;STRONG style="font-family: inherit;" data-end="150" data-start="128"&gt;Structured Outputs&lt;/STRONG&gt;&lt;SPAN&gt;, ensuring the model strictly adheres to the provided JSON schema.&amp;nbsp;&lt;/SPAN&gt;Setting it to &lt;FONT face="courier new,courier"&gt;{ "type": "json_object" }&lt;/FONT&gt; &lt;SPAN&gt;enables the legacy JSON mode, which guarantees that the model’s response is valid JSON but does not enforce a specific schema structure.&amp;nbsp;&lt;/SPAN&gt;For models that support it, using &lt;STRONG style="font-family: inherit;" data-end="451" data-start="436"&gt;json_schema&lt;/STRONG&gt;&lt;SPAN&gt; is recommended.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H3&gt;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;How to use Structured Outputs with Chat Completion Block&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/H3&gt;
&lt;P&gt;Structured Outputs is an advanced OpenAI feature that ensures AI responses always adhere to a JSON schema you define. This guide demonstrates step-by-step how to use the &lt;STRONG&gt;Chat Completion&lt;/STRONG&gt; block in Qlik Automate to implement Structured Outputs using a practical math tutoring example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;What are Structured Outputs?&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;Structured Outputs guarantee that OpenAI models return responses in a specific JSON format you define, eliminating the need for post-processing validation or retries. Unlike JSON mode (which only ensures valid JSON), Structured Outputs enforce &lt;STRONG&gt;schema adherence&lt;/STRONG&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Supported Models&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;Structured Outputs require: &lt;EM&gt;gpt-4o-mini&lt;/EM&gt;, &lt;EM&gt;gpt-4o-mini-2024-07-18&lt;/EM&gt;, and &lt;EM&gt;gpt-4o-2024-08-06&lt;/EM&gt; model snapshots and later.&lt;/P&gt;
&lt;P&gt;This example demonstrates how to create a Qlik automation that uses Structured Outputs to provide step-by-step math solutions with guaranteed formatting.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;Step 1: Define Your Response Schema&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/H4&gt;
&lt;P&gt;Before configuring the Chat Completion block, define the JSON schema that describes the exact structure of the response.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Math Reasoning Schema:&lt;/STRONG&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;{
  "type": "json_schema",
  "json_schema": {
    "name": "math_reasoning",
    "schema": {
      "type": "object",
      "properties": {
        "steps": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "explanation": {
                "type": "string"
              },
              "output": {
                "type": "string"
              }
            },
            "required": [
              "explanation",
              "output"
            ],
            "additionalProperties": false
          }
        },
        "final_answer": {
          "type": "string"
        }
      },
      "required": [
        "steps",
        "final_answer"
      ],
      "additionalProperties": false
    },
    "strict": true
  }
}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This schema requires:&lt;/P&gt;
&lt;UL class="lia-list-style-type-circle"&gt;
&lt;LI&gt;A &lt;FONT face="courier new,courier"&gt;steps &lt;/FONT&gt;array containing objects with &lt;FONT face="courier new,courier"&gt;explanation &lt;/FONT&gt;and &lt;FONT face="courier new,courier"&gt;output &lt;/FONT&gt;fields&lt;/LI&gt;
&lt;LI&gt;A &lt;FONT face="courier new,courier"&gt;final_answer&lt;/FONT&gt; string&lt;/LI&gt;
&lt;LI&gt;All fields are required&lt;/LI&gt;
&lt;LI&gt;No additional properties are allowed&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;Step 2: Create the Automation&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/H4&gt;
&lt;OL&gt;
&lt;LI&gt;Go to your Qlik Sense tenant and create a new automation.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Search for the &lt;STRONG&gt;OpenAI&lt;/STRONG&gt; connector in the block library.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Drag the &lt;STRONG&gt;Chat Completion Message&lt;/STRONG&gt; block into the automation canvas.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Open the &lt;STRONG&gt;Connection&lt;/STRONG&gt; tab in the configuration panel on the right, and either choose an existing connection or enter a new key.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Select the &lt;STRONG&gt;Chat Completion Message&lt;/STRONG&gt; block to display the configuration panel on the right.&lt;BR /&gt;&lt;BR /&gt;This produces one message object (role + content) each time it runs.&lt;BR /&gt;&lt;BR /&gt;Configure the role (system/user/assistant) and the message text.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Use a &lt;STRONG&gt;Variable&lt;/STRONG&gt; block of type &lt;STRONG&gt;List&lt;/STRONG&gt; to collect messages:&lt;BR /&gt;&lt;BR /&gt;Create a list variable (e.g. &lt;FONT face="courier new,courier"&gt;chatMessages&lt;/FONT&gt;).&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Repeat step 5 for all messages you need in the conversation.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;Add each Chat Completion Message block output as an item to &lt;FONT face="courier new,courier"&gt;chatMessages&lt;/FONT&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4&gt;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;Step 3: Configure the Chat Completion Block&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/H4&gt;
&lt;OL&gt;
&lt;LI&gt;Drag a &lt;STRONG&gt;Chat Completion&lt;/STRONG&gt; block into the automation.&lt;BR /&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;In the &lt;STRONG&gt;Inputs&lt;/STRONG&gt; tab of the Chat Completion block, set the following:&lt;BR /&gt;&lt;BR /&gt;
&lt;OL class="lia-list-style-type-lower-alpha"&gt;
&lt;LI&gt;&lt;STRONG&gt;Model&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;Set to: &lt;EM&gt;gpt-4o-mini&lt;/EM&gt;, &lt;EM&gt;gpt-4o-mini-2024-07-18&lt;/EM&gt;, &lt;EM&gt;gpt-4o-2024-08-06&lt;/EM&gt;&lt;SPAN&gt; (or later). Required for Structured Outputs support.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Messages&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;&lt;SPAN&gt;Map this to the &lt;/SPAN&gt;&lt;EM style="font-family: inherit;"&gt;list variable&lt;/EM&gt;&lt;SPAN&gt; (e.g., &lt;/SPAN&gt;&lt;FONT face="courier new,courier"&gt;chatMessages&lt;/FONT&gt;&lt;SPAN&gt;) that you populated using the Chat Completion Message blocks.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;If you prefer not to use a variable, you can still input a literal JSON array manually, but the variable approach ensures dynamic message construction.&lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;Example manual array:&lt;/SPAN&gt;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;[
  {
    "role": "system",
    "content": "You are a helpful math tutor. Guide the user through solving math problems step by step. Provide clear explanations and show all work."
  },
  {
    "role": "user",
    "content": "How can I solve 8x + 7 = -23?"
  }
]&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;P&gt;&lt;STRONG&gt;Response Format (Critical for Structured Outputs)&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Set the &lt;FONT face="courier new,courier"&gt;response_format &lt;/FONT&gt;parameter to include your schema:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;{
  "type": "json_schema",
  "json_schema": {
    "name": "math_reasoning",
    "schema": {
      "type": "object",
      "properties": {
        "steps": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "explanation": {
                "type": "string"
              },
              "output": {
                "type": "string"
              }
            },
            "required": [
              "explanation",
              "output"
            ],
            "additionalProperties": false
          }
        },
        "final_answer": {
          "type": "string"
        }
      },
      "required": [
        "steps",
        "final_answer"
      ],
      "additionalProperties": false
    },
    "strict": true
  }
}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Add an object formula on top of this JSON schema to convert it into a proper JSON object.&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Important:&lt;/STRONG&gt; Set &lt;FONT face="courier new,courier"&gt;"strict": true &lt;/FONT&gt;to enable Structured Outputs mode.&lt;/P&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Step 4: Run the Automation&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;P&gt;After the Chat Completion block executes, the response is parsed and available in a structured format. You can then use the structured output to build the formatted message and send it over Slack or email.&lt;/P&gt;
&lt;P&gt;You can find the demo automation attached to this article (&lt;EM&gt;open-ai-structured-output.json&lt;/EM&gt;).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;H4&gt;&lt;FONT color="#339966"&gt;&lt;STRONG&gt;Best Practices&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/H4&gt;
&lt;UL class="lia-list-style-type-circle"&gt;
&lt;LI&gt;&lt;STRONG&gt;Keep schemas simple&lt;/STRONG&gt;: Start with basic schemas before adding complexity.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Use descriptions&lt;/STRONG&gt;: Add clear descriptions to all properties.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Provide examples&lt;/STRONG&gt;: Include examples in your system prompt.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Test schemas&lt;/STRONG&gt;: Validate with sample prompts before production.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Version control&lt;/STRONG&gt;: Track schema changes for consistency.&lt;/LI&gt;
&lt;LI&gt;&lt;STRONG&gt;Handle refusals&lt;/STRONG&gt;: Always check for model refusals in responses.&lt;/LI&gt;
&lt;/UL&gt;
&lt;H4&gt;&lt;STRONG&gt;&lt;FONT color="#339966"&gt;Resources&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/H4&gt;
&lt;UL class="lia-list-style-type-circle"&gt;
&lt;LI&gt;&lt;A href="https://developers.openai.com/api/docs/guides/structured-outputs" target="_blank" rel="noopener"&gt;OpenAI Structured Outputs Documentation&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://json-schema.org/" target="_blank" rel="noopener"&gt;JSON Schema Specification&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://developers.openai.com/api/docs/api-reference/chat/create" target="_blank" rel="noopener"&gt;OpenAI Chat Completions API&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Thu, 05 Mar 2026 10:55:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/How-to-Getting-started-with-the-OpenAI-Connector-in-Qlik/ta-p/2077315</guid>
      <dc:creator>Jayarams</dc:creator>
      <dc:date>2026-03-05T10:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to: Getting started with the OpenAI Connector in Qlik Application Automation</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/How-to-Getting-started-with-the-OpenAI-Connector-in-Qlik/tac-p/2422160#M13273</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;First, thank you for the article.&lt;/P&gt;
&lt;P&gt;I am currently working on the subject and I notice that some new blocks are now availables, like :&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;- Chat Completion&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;- Chat Completion Message&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;- Chat Completion Function&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;Any chance to find an article about this ?&lt;/P&gt;
&lt;P&gt;Thank you&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Antoine L.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Feb 2024 09:54:45 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/How-to-Getting-started-with-the-OpenAI-Connector-in-Qlik/tac-p/2422160#M13273</guid>
      <dc:creator>Antoine04</dc:creator>
      <dc:date>2024-02-22T09:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to: Getting started with the OpenAI Connector in Qlik Application Automation</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/How-to-Getting-started-with-the-OpenAI-Connector-in-Qlik/tac-p/2422875#M13282</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/110933"&gt;@Antoine04&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Let me look into this for you.&lt;/P&gt;
&lt;P&gt;All the best,&lt;BR /&gt;Sonja&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 23 Feb 2024 11:47:19 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/How-to-Getting-started-with-the-OpenAI-Connector-in-Qlik/tac-p/2422875#M13282</guid>
      <dc:creator>Sonja_Bauernfeind</dc:creator>
      <dc:date>2024-02-23T11:47:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to: Getting started with the OpenAI Connector in Qlik Application Automation</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/How-to-Getting-started-with-the-OpenAI-Connector-in-Qlik/tac-p/2422974#M13286</link>
      <description>&lt;P&gt;&lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/110933"&gt;@Antoine04&lt;/a&gt;&amp;nbsp;We don't have the article at the moment for the above blocks.&lt;/P&gt;
&lt;DIV class="x_elementToProof" data-ogsc="rgb(0, 0, 0)"&gt;We will either write a new article or update the existing&amp;nbsp;article with the information on those blocks. We will keep you updated on this.&lt;/DIV&gt;</description>
      <pubDate>Fri, 23 Feb 2024 14:29:27 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/How-to-Getting-started-with-the-OpenAI-Connector-in-Qlik/tac-p/2422974#M13286</guid>
      <dc:creator>Jayarams</dc:creator>
      <dc:date>2024-02-23T14:29:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to: Getting started with the OpenAI Connector in Qlik Application Automation</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/How-to-Getting-started-with-the-OpenAI-Connector-in-Qlik/tac-p/2423385#M13297</link>
      <description>&lt;P&gt;Hello to both of you,&lt;/P&gt;
&lt;P&gt;Thanks for reply. Can't wait to see it !&lt;/P&gt;
&lt;P&gt;I have to say I already try it and it works in my case, but would be nice to have the best practices on how to configure it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Regards&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2024 08:57:38 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/How-to-Getting-started-with-the-OpenAI-Connector-in-Qlik/tac-p/2423385#M13297</guid>
      <dc:creator>Antoine04</dc:creator>
      <dc:date>2024-02-26T08:57:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to: Getting started with the OpenAI Connector in Qlik Automate</title>
      <link>https://community.qlik.com/t5/Official-Support-Articles/How-to-Getting-started-with-the-OpenAI-Connector-in-Qlik/tac-p/2525462#M16170</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.qlik.com/t5/user/viewprofilepage/user-id/28597"&gt;@Sonja_Bauernfeind&lt;/a&gt;,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm wondering if a new article or documentation update about the new OpenAI blocks in Automate will be published soon. I haven't been able to find any recent information, and I'm currently running into an issue where either the endpoint isn't recognized, or the variable for the Chat Completion block isn't being populated correctly.&lt;BR /&gt;&lt;BR /&gt;Kind regards,&lt;/P&gt;&lt;P&gt;Michiel&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jul 2025 08:50:36 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Official-Support-Articles/How-to-Getting-started-with-the-OpenAI-Connector-in-Qlik/tac-p/2525462#M16170</guid>
      <dc:creator>MichielHofsteenge</dc:creator>
      <dc:date>2025-07-28T08:50:36Z</dc:date>
    </item>
  </channel>
</rss>

