Skip to main content
  1. We format the questions as EDSL Question objects of various types: QuestionYesNo, QuestionMultipleChoice, QuestionCheckBox, QuestionNumerical, QuestionFreeText.
  2. We show how to combine the questions in a Survey to administer them to agents at once. This can also be done with any subset of the questions.
  3. We create dictionaries of the questions and answer codebook for convenience in working with this data.

Companion notebooks

This notebook is designed to be used with 2 companion notebooks:

Reference & contact

Documentation for the EDSL package is available at https://docs/expectedparrot.com. You can also find example code, tutorials and notebooks for a variety of use cases. Please let us know if you have any questions or encounter issues working with this data:

Technical setup

EDSL is compatible with Python 3.9-3.12. See instructions on installing the EDSL library and storing API keys for the language models that you want to use. In examples below where no model is specified, EDSL will use gpt-5.2 by default (an API key for OpenAI is required). We also show how to use different models.

Formatting questions in EDSL

The code below formats each of the questions in the CES 2022 Pre-election Questionnaire as an EDSL Question object of the relevant type. Note:
  • Each original “grid” question is formatted as independent multiple choice questions.
  • Some questions require parameters to be added (e.g., $CurrentGovName). This can be done with Scenario objects which we demonstrate how to do at the end of this notebook.

Combining questions into a Survey

A Survey object is created by passing a list of Question objects. Learn more about constructing surveys in EDSL.

Dictionary of question short names & texts

Here we create a dictionary of the question short names and texts, for convenience in working with the data:

Answer codebook

Here we create a codebook of the question short names and the numbers and texts of the answer options, for convenience in working with the data and responses. Note that most answer option numbers are consecutive (1,2,3,…) but some are not.

Parameterizing questions with data

Here we show how to construct Scenario objects for data that we want to input in question texts. This allows us to administer multiple versions of questions efficiently. Learn more about working with scenarios. Values in the CES questions requiring inputs:
Here we create scenarios for a set of questions, add them to the survey when we run it, and inspect the results:
We modify the relevant question texts to use bracketed parameters:

Creating AI agents for survey respondents

Learn more about working with the CES data in Creating AI agents for survey respondents <>__, where we demonstrate how to use the EDSL module Conjure to import survey data and create AI agents based on responsesd