Generate Survey from PDF Document Using AI
This demo shows how an AI-powered service integrated into Survey Creator can help users create dynamic surveys based on PDF forms. Click the Upload PDF button and select a PDF document that you want to convert. Please note that the process may take some time, and only the first two pages from the document will be converted to prevent server overload. After the conversion is finished, you can refine the survey as needed and preview the final result.
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 generate a survey JSON schema based on a PDF document may look as shown below. Note the addition of the expected response format:
"Generate a SurveyJS JSON schema from the following pages: \n%PDF%\nReturn only an object in JSON format."
Once the AI service sends back a string with a survey JSON schema, assign it to Survey Creator's text
property. Refer to the Code tab for a code example.