Skip to main content
In EDSL this can be done by including fields for metadata in scenarios that you create for the data/content you are using with a survey. When the scenarios are added to the survey and it is run, columns for the metadata fields are automatically included in the results that are generated.

Example

In the steps below we create and run a simple EDSL survey that uses scenarios to add metadata to the results. The steps consist of:
  • Constructing a survey of questions about some data (mock news stories)
  • Creating a scenario (dictionary) for each news story
  • Adding the scenarios to the survey and running it
  • Inspecting the results

Technical setup

Before running the code below, please ensure that you have installed the EDSL libary 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.

Constructing questions

We start by constructing some questions with a {{ placeholder }} for data that we will add to the question texts. EDSL comes with a variety of question types that we can choose from based on the form of the response that we want to get back from the model:

Creating a survey

Next we pass the questions to a survey in order to administer them together:

Parameterizing questions with scenarios

Next we create a ScenarioList with a Scenario consisting of a key/value for each piece of data that we want to add to the questions at the {{ placeholder }}, with additional key/values for metadata that we want to keep with the results that are generated when the survey is run. EDSL comes with a variety of methods for generating scenarios from different data sources (PDFs, CSVs, images, tables, lists, etc.); here we generate scenarios from a dictionary:
We can inspect the scenarios that have been created:
ScenarioList scenarios: 10; keys: [‘author’, ‘headline’, ‘date’];

Running a survey

To run the survey, we add the scenarios with the by() method and then call the run() method:
This generates a dataset of Results that we can access with built-in methods for analysis. To see a list of all the components of results:
For example, we can filter, sort, select and print components of results in a table:

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 post the scenarios, survey and results from above, and this notebook:
To update an object at Expected Parrot:
This is equivalent: