Generate Choice Options Using AI

AI-powered services have become ubiquitous in the modern digital world. Chatbots and assistants, such as ChatGPT, DeepSeek, and Microsoft Copilot, help users with writing and coding; voice recognition services transcribe speech to text; neural networks generate images based on descriptions. This demo shows how you can integrate an AI service into Survey Creator to generate choice options for Dropdown, Radio Button Group, and Checkboxes questions based on the provided question title. Click one of the questions on the design surface and select AIGenerate choices by title or Generate more choices. Another AI-based feature that may be useful for survey authors is spell correction. To test this functionality, make an error in a question title or choice option text and select AIFix grammar errors.

AI service integration starts with deploying a language model to your application and exposing an API for interaction with that model. Refer to tutorials dedicated to the model of your choice for instructions. This example uses the GPT-3.5 Turbo model deployed on the SurveyJS website.

A deployed AI model receives text prompts and responds with text completions. Your client-side code should construct the text prompts and send them to the model. For example, a prompt to fix spelling errors may look as shown below. Note the addition of the expected response format:

"Fix grammar errors in the 'choices' and 'title' fields: { title: "...", choices: [ ... ] }. Use JSON format as output."

Once the AI service sends back a text completion with a JSON object, update the required question properties (title and choices in this demo). Refer to the Code tab for a code example.

Your cookie settings

We use cookies on our site to make your browsing experience more convenient and personal. In some cases, they are essential to making the site work properly. By clicking "Accept All", you consent to the use of all cookies in accordance with our Terms of Use & Privacy Statement. However, you may visit "Cookie settings" to provide a controlled consent.

Your renewal subscription expires soon.

Since the license is perpetual, you will still have permanent access to the product versions released within the first 12 month of the original purchase date.

If you wish to continue receiving technical support from our Help Desk specialists and maintain access to the latest product updates, make sure to renew your subscription by clicking the "Renew" button below.

Your renewal subscription has expired.

Since the license is perpetual, you will still have permanent access to the product versions released within the first 12 month of the original purchase date.

If you wish to continue receiving technical support from our Help Desk specialists and maintain access to the latest product updates, make sure to renew your subscription by clicking the "Renew" button below.