Skip to main content
EDSL is an open-source library for simulating surveys and experiments with AI agents and large language models. Before running the code below please see instructions on getting started.

How it works

EDSL comes with a variety of question types that we can select from based on the desired form of the response (multiple choice, free text, etc.). We can also parameterize questions with content such as texts or images in order to ask questions about the content. We do this by creating a {{ placeholder }} in a question text, e.g., What are the key themes of this text: {{ scenario.text }} or What is in this image: {{ scenario.image }}, and then creating Scenario objects for the content to be added when the survey is run. This allows us to re-administer questions with different inputs all at once. A common use case for this is data labeling tasks designed as questions about individual data. Learn more about using scenarios and data labeling examples.

Example

For purposes of demonstration we use a PDF of the recent paper Automated Social Science: Language Models as Scientist and Subjects and conduct a survey consisting of several questions about the contents of it:
daca269258564126806cfd63b847573f
Posting a PDF to Expected Parrot using the FileStore module:
Info about the object we can use to retrieve it:
Here we retrieve it:
Here we create a ScenarioList for the individual pages, automatically extracting the text on each page (note that the keys can be renamed as desired using the rename() method):
We can select pages to use if we do not want to use all of them – e.g., here we filter just the first page to use with our survey:
Here we create a survey of questions that we will administer with the selected PDF page, using a {{ placeholder }} for the text extracted from the page:
Now we can add the scenario to the survey and run it:
We can see a list of all the components of results that are directly accessible:
We can select components of the results to inspect and print:

Posting to Expected Parrot

Expected Parrot is a platform for creating, storing and sharing LLM-based research. It is fully integrated with EDSL and accessible from your workspace or Expected Parrot account page. Learn more about creating an account and the platform. Here we demonstrate how to post this notebook: