Skip to main content

Technical setup

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.

Constructing questions about the data

We start by constructing questions about the content we want to analyze. 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 (multiple choice, linear scale, free text, etc.). Here we use QuestionFreeText to get the caller names and emails and QuestionList to list out any questions and requests of the callers, with a {{ placeholder }} for a transcript:

Creating a survey

We combine the questions into a Survey in order to administer them all together:

Adding context to questions

Next we import a dataset of transcripts to add to the questions, creating a Scenario dictionary for each transcript. EDSL provides methods for importing content from many different data sources, including PDFs, CSVs, docs, images, tables, lists, dicts, etc. Here we use a CSV of texts, retrieved from Expected Parrot:
We can inspect the scenarios (and rename or edit them as desired):

Designing an AI agent to answer the survey

We can create a persona for an AI Agent that a language model will use to answer the questions, and give it instructions on the task:
Learn more about designing AI agents.

Selecting a language model

We can select one or more specific models to generate the responses (if no model is specified the default model is used). Information about models is available here. To check a list of service providers:
To check the current default model:
Here we select a model:
Learn more about specifying language models.

Getting responses

We generate responses by adding the scenarios, agent and model to the survey and then calling the run() method:
This generates a dataset of Results that we can begin analyzing. EDSL comes with built-in methods for analyzing results. For example, we can print the responses in a table:

Quantifying responses

We can use the lists of caller questions and requests to quantify them (how often do they appear in the calls?). We start by prompting an agent to synthesize the lists into comprehensive lists that we can use as question options for new questions:
We can use the condensed lists as options for new questions quantifying the topics:
We can use the results of the initial survey as scenarios of our follow-on questions. The to_scenario_list() method lets us do this in a single step:
_ScenarioRowProxy

Visualizations

We can turn the results into a dataframe and inspect the totals:
../_images/notebooks_summarizing_transcripts_42_0.png

Exporting results

We can export the results as a CSV:
File written to customer_calls_analysis.csv Please see our documentation page for examples of other methods and use cases!

Posting content to Expected Parrot