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. Thank you to Sophia Kazinnik for this idea and helpful suggestions!

Importing the tool

Selecting a model

See a list of available models at the model pricing and performance page
Here we select a model to use
LanguageModel

Creating some contexts for our survey

Here we identify some example contexts to use in administering our survey

Adding contexts to question texts

We can apply contexts by creating versions of our questions where each context is inserted directly into the question texts as a Scenario of the question

Adding context to agent traits

Another method is to specify agent traits and survey contexts via Agent traits instead of the question texts

Adding contexts to question texts and agent traits

Here we use both Agent traits and Scenario contexts in the question texts:

Compare prompts

We can compare the prompts that we used which are accessible as fields of the results: