Skip to main content
Before running the code below, please see instructions on getting started using EDSL.

Identify concepts

We start by creating a general question prompting the respondent (a language model) to identify concepts in a given text. 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. QuestionList may be appropriate where we want the response to be formatted as a list of strings:
We might also want to ask some other questions about our data at the same time (a data labeling task). For example:
We parameterize the questions in order to run them for each of our texts. This is done with Scenario objects that we can create using EDSL or import from other sources (CSV, PDF, PNG, MP4, DOC, tables, lists, dicts, etc.). Here we import a setof recent tweets by President Biden:
10
ScenarioList scenarios: 10; keys: [‘text’]; Next we combine the questions into a survey in order to administer them together (asynchronously by default, or according to any skip/stop rules or other logic that we want to add–learn more about Survey methods in our documentation):
We add the scenarios to the survey and then run it with the default model (currently gpt-5.2) to generate a dataset of results:
EDSL comes with built-in methods for working with results in a variety of forms (data tables, SQL queries, dataframes, JSON, CSV). We can call the columns method to see a list of all the components that we can analyze:
We can select and print specific components to inspect in a table:
If our concepts lists are too long, we can run another question prompting a model to condense it. We can specify the number of concepts that we want to get:
[‘keynote address’, ‘U.S. Holocaust Memorial Museum’, ‘Annual Days of Remembrance’, ‘Washington, D.C.’, ‘nation of immigrants’, ‘nation of dreamers’, ‘Cinco de Mayo’, ‘freedom’, ‘Medicare’, ‘Social Security’, ‘economic plan’, ‘Medicare solvency’, ‘Social Security solvency’, ‘fair share’, ‘Army Black Knights’, ‘West Point’, ‘Commander-in-Chief Trophy’, ‘United States’, ‘Holocaust Remembrance Day’, ‘six million Jews’, ‘Nazis’, ‘darkest chapters’, ‘lessons of the Shoah’, ‘responsibility’, ‘Never Again’, ‘Presidential Medal of Freedom’, ‘faith in freedom’, “America’s faith”, ‘better tomorrow’, ‘Teaching’, ‘Calling’, ‘Educator’, ‘White House’, ‘Teacher State Dinner’, ‘Jill and I’, ‘warm wishes’, ‘Orthodox Christian communities’, ‘Easter’, ‘Lord bless and keep you’, ‘Easter Sunday’, ‘year ahead’, ‘Dreamers’, ‘health care’, ‘Affordable Care Act’, ‘DACA recipients’, ‘affordable health coverage’, ‘Administration’, ‘American comeback’, ‘175,000 new jobs’, ‘Congressional Republicans’, ‘cut taxes’, ‘billionaires’, ‘special interests’, ‘job creation’, ‘economy’, ‘families’]
Note:Note that we can call the run() method on either a survey of questions or an individual question:

Identify criteria for each concept

Similar to our first step, next we can run a question prompting the model to generate criteria for each concept. We could use QuestionFreeText to generate criteria in an unstructured narrative:
For this question, the scenarios are the concepts that we generated:
ScenarioList scenarios: 10; keys: [‘concept’];

Identify the concepts in each text and evaluate based on the criteria

Finally, we can use the concepts and the criteria to run another question where we prompt the model to evaulate each text. Question types QuestionLinearScale, QuestionRank or QuestionNumerical may be appropriate where we want to return a score:
Here we want to use both the texts and the concepts and corresponding criteria together as scenarios of the question:
We can filter the results based on the responses–e.g., here we just show the non-zero scores:

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:
We can also post this notebook:
To update an object at Expected Parrot: