Skip to main content
EDSL is an open-source library for simulating surveys, experiments and other research with AI agents and large language models. Before running the code below, please ensure that you have installed the EDSL library and either activated remote inference from your Expected Parrot account or stored API keys for the language models that you want to use with EDSL. Please also see our documentation page for tips and tutorials on getting started using EDSL.

What is a Scenario?

A Scenario is a dictionary of one or more key/value pairs representing data or content to be added to questions; a ScenarioList is a list of Scenario objects. Scenario keys are used as question parameters that get replaced with the values when the scenarios are added to the questions, allowing you to create variants of questions efficiently. Learn more about creating and working with scenarios here and here.

What is Expected Parrot?

Expected Parrot is a platform for creating, storing and sharing LLM-based research. It is fully integrated with EDSL, allowing you to post, download and update objects directly from your workspace and at the platform. It also provides access to features for working with EDSL remotely at the Expected Parrot server. Learn more about these features in the remote inference and remote caching sections of the documentation page.

What is FileStore?

FileStore is a module for storing and sharing data files at Expected Parrot to use in EDSL projects, such as survey data, PDFs, CSVs or images. In particular, it is designed for storing files to be used as as scenarios, and allows you to include code for easily retrieving and processing the files in your EDSL project, as we do in the examples below!

Example

In the example below we create scenarios for some data (a table at a Wikipedia page) and inspect them. Then we store the scenarios as a CSV and post it to Expected Parrot using FileStore. Then we retrieve the file and recreate the scenarios, and use them in a survey. We also post the survey, results and this notebook to the platform for reference. We start by creating importing the tools that we will use:

Creating a scenario list for a Wikipedia table

EDSL comes with many methods for automatically generating scenarios for various data sources, such as PDFs, CSVs, docs, images, lists, dicts, etc. Here we use a method to automatically create a scenario list for a Wikipedia table, passing the URL and the number of the table on the page:
We can inspect the scenario list that has been created:
We can rename the keys for convenience:
We can save the scenarios to a CSV:
File written to billboard_100_1980s.csv

Posting data to Expected Parrot

Here we post the CSV to Expected Parrot using FileStore (note that the file type is automatically inferred):
We can post a FileStore object to Expected Parrot by calling the push() method on it. We can optionally pass a description and a visibility setting - public, unlisted (by default) or private:
We can print the details of the posted object, including the URL and uuid that we will need to retrieve it later:

Retrieving a file and recreating scenarios

Here we retrieve the file:
This is equivalent:
Here we recreate scenarios:

Using scenarios in a survey

We can use the scenarios with a survey by creating placeholders in the questions for the scenario keys, and adding the scenarios to the survey when we run it:
We can filter, sort, select and print any components of the results that are generated. Note that the results include columns for all scenario keys, whether used in question texts or not:

Posting a notebook to Expected Parrot

Here we post the contents of this notebook to Expected Parrot for anyone to access:
To update an object: