AI-Powered Survey Design Chat
AI assistants can simplify tasks like content creation, coding, and data generation. In surveys, they help authors configure questionnaires faster by turning plain text prompts into ready-to-use survey definitions. In this demo, Survey Creator integrates an AI assistant instead of the standard Property Grid. The assistant generates survey JSON schemas based on your input. Enter a description of your survey, click Send, and within seconds the schema will appear in the Survey Creator's JSON Editor tab.
Implementation
This Survey Creator configuration consists of four main parts:
Language Model
Integration begins with deploying a language model and exposing an API for interaction. Refer to the documentation of the chosen model for setup instructions. This example uses the GPT-3.5 Turbo model deployed on the SurveyJS website.Chat Manager
A static class that provides an API for sending prompts and parsing responses. Before the user can send a prompt, the chat manager sends system messages to establish context. Each user prompt is accompanied by the current JSON schema and instructions for the required response format. See thechat_manager.js
file for details.Survey Creator Manager
A static class that provides an API for retrieving, validating, and assigning survey JSON schemas from and to Survey Creator. See thecreator_manager.js
file for details.Custom Property Grid Component
A custom component that replaces the default Property Grid with a chat window. It renders the conversation history, an input field, and a Send button, while using the chat manager and Survey Creator manager APIs to handle prompts and JSON schemas. To apply the component, register it under thesvc-property-grid
name usingReactElementFactory
in React and vanilla JS,AngularComponentFactory
in Angular, orComponentFactory
in Vue 3. Refer to theCustomPropertyGrid
component in code for implementation details.