Designing the task as an EDSL survey
We design the task as an EDSL survey about the survey to be converted: a series of questions prompting a language model to read and reformat the contents of a given survey. The formatted responses of the language model are readily usable components of a new EDSL survey that can be administered to AI agents and/or human audiences.Creating a meta-survey
We start by selecting appropriate question types for reformatting the contents of a given survey. EDSL comes with many common question types that we can choose from based on the form of the response that we want to get back from a model: multiple choice, checkbox, free text, linear scale, etc. Here we useQuestionList to return information about all the questions in the survey at once, as a list. We create a sequence of questions, using the response to one question as an input to the next question. This step-wise approach can improve performance by allowing a model to focus on distinct tasks, and also allow us to pinpoint modifications to instructions as needed (some models will perform better and need fewer instructions than others). Note that we use a {{ placeholder }} for the text of the survey to be reformatted that we want to add to the initial question, which allows us to reuse it with other content (e.g., another survey):
Survey in order to administer them together. We add a “memory” of each prior question in the survey so that the model will have the context and its answers on hand when answering each successive question:
Adding content to questions
Next we create aScenario object for the contents of a (non-EDSL) survey to be inserted in the first question. This allows us to reuse the questions with other content. Learn more about using scenarios to scale data labeling and other tasks.
Here we create a scenario for a Google Form (a customer feedback survey) that we have stored as a publicly-accessible PDF at Expected Parrot.
Code for posting a PDF to Expected Parrot (rerun with your own file):
Selecting language models
EDSL works with many popular language models that we can select to use in generating survey responses. You can provide your own API keys for models or activate remote inference to run surveys at the Expected Parrot server with any available models. Learn more about working with language models and using remote inference.Running a survey
Next we add the scenario and models to the survey and run it. This generates a dataset ofResults that we can access with built-in methods for analysis. Learn more about working with results.
We can filter, sort, select and print components in a table:
Creating a new EDSL survey
Now we can construct a new EDSL survey with the reformatted components of the original survey. This is done by creatingQuestion objects with the question components, passing them to a new Survey, and then optionally designing and assigning AI agents to answer the survey.
Here we select one of the model’s responses to use:
Designing AI agents
EDSL comes with methods for designing AI agent personas for language models to use in answering questions. AnAgent is created by passing a dictionary of relevant traits. It can then be assigned to a survey using the by() method when the survey is run (the same as we do with scenarios and models).
We can import existing data to create agents representing audiences of interest, or use EDSL to generate personas:
Note:Note that the personas can be (much) longer and include key/value pairs for any desired traits; we keep it simple here for demonstration purposes. Here we pass the personas to a list of agents and have them answer the survey:
