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 aScenarioList 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:
Running a survey
To run the survey, we add the scenarios with theby() method and then call the run() method:
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:
