Open ADC - Prompting (with and without AI)
| Summary | This article describes the use and implementation of prompting capabilities in the Open ADC - written by Jordan Grindle |
| Applies to | AskiaDesign 5.5.3 and above |
| Written for | Scriptwriters and survey authors |
| Keywords | ADC; javascript; control; design; askiadesign; ai; prompt; |
This article provides information on the new prompt feature added to the Open ADC. Examples are provided in a QEX file within this article.
- This feature works only with open-ended questions.
- Limitation - prompting only works with one open-end on the same screen.
- Limitation - prompting only works with CAWI surveys. CATI/CAPI is not supported.
Definition
The prompt function of the Open ADC allows survey scripters to integrate prompt messages to interviewers while they are fufilling open-ended responses to allow for a more dynamic and succinct experience. This allows for prompts to be fufilled in two ways:
- Non-AI Method: Internally, through a dummy question in the QEX.
- AI Method: Through an AI prompt model. Originally provided through an LLM such as Ipsos Facto, the feature can easily accomodate other AI model providers.
Prompts will be returned through a bubble above the respondents' input area:
The frequency and total number of prompts can be customised through a number of options included in the ADC. The timing of prompts includes pauses after a respondent stops typing to ensure a quality experience.
Note on using AI Generated Prompts
The Open ADC must establish API authorisation to contact the AI model of your choosing when using AI generated prompts. This means the "Query a web service" routing must be implemented in your survey so your API calls are performed in a way to keep your authentication tokens secure and private.
If you are using the 'Survey Question' Prompt Model, the following step isn't necessary.
Implementing your Routing (when using AI)
When using an AI model to generate prompts, you must create a "Query a web service" routing so your API call remains server-side for securing your API key/token. Here is a quick example:
The main items to consider in the Header section are:
HTTP Verb: It should be set to POST
URL: The link/URL to your preferred AI model's API
Headers: These are Key/Value pairs and will be different depending on your AI provider. Below is the typical Authorization header format.
Key: “Authorization”
Value: “Bearer TOKENVALUE”
* The TOKENVALUE would be provided by your AI provider.
The Body section contains the content that will be returned when a POST is called to the API. It must contain the requisite AI model you are trying to contact. Since our example is calling from the 'Ipsos Facto' LLM, the Body will look like this:
{
"model": "gpt-4o",
"messages": [
{
"role": "user",
"content": "Given this question '{%= CurrentQuestion.LongCaption %}' and this response '{%= (CurrentQuestion.Value).Substring(2) %}' and using the language in the response, provide a short one sentence to prompt for more detail. Do not provide reasoning or explanation."
}
]
}
The "AI Helper" Variable
You'll also need to include an "AI Helper" vairable in your survey, merged on the same screen as your open end in order for the data between the API and the respondent to communicate effectively. In this example, the helper variable will be called Q2Prompt. This variable must be merged, but not visible on the same screen as your designated open end in order for the prompt functions to return correctly.
You can see that routing execution points to our helper variable. while the "Script on Success/Error" point to the syntax CurrentQuestion, this being Q2 (the question the respondent will see):
Next is to make sure that it is properly merged and hidden. To ensure that respondents cannot see your helper variable, assign it a CSS class that has the "display:none" style applied to it, like so:
Finally, point to your helper variable in the ADC properties The ADC should be attached to your open end, not your helper variable. In this instance it is attached to Q2, not Q2Prompt).
What's Next?
If you are looking to incorporate your own AI model to utilize prompts but do not know where to begin, we have a supplimentary article explaining the basics in detail using Openrouter.ai.
Prompt Options
| Prompt Question | If the "Survey Question" prompt model is selected, this will point to your dummy variable containing your prompt items. |
| AI Response Question | Question shortcut to be used for dictating which question will be designated as the "AI Helper" variable to hold prompts from the API. |
| Number of Prompts to return | The number of prompts to return to the respondent |
| Seconds between prompts | The time interval between prompts after respondent stops typing (0 = disabled) |
| Min number of characters | The minimum number of characters to be entered before a prompt is triggered (0 = disabled) |
| Trigger prompt on space | An option to trigger a prompt when the respondent hits the space bar |
| Trigger prompt punctuation | An option to trigger a prompt when the respondent hits a punctuation point - e.g. '?' '!' ',' '.' ';' etc. |
| Prompt delay | An option to include a timed delay (in seconds) between prompts triggered by all prompt listeners (timed, space or punctuation key presses). If left undefined, the script will default to a 1 second delay. This helps to prevent "double prompting" if multiple listeners are used simultaneously. |
| Hide Next | Hide the Next button until a prompt is triggered. If selected, navigation using the Enter key will be disabled. |