Skip to content

Design, conduct and analyze results of AI-powered surveys and experiments. Simulate social science and market research with large numbers of AI agents and LLMs.

License

Notifications You must be signed in to change notification settings

expectedparrot/edsl

Repository files navigation

Expected Parrot Domain-Specific Language (EDSL)

The Expected Parrot Domain-Specific Language (EDSL) package makes it easy to conduct computational social science and market research with AI. Use it to design surveys and experiments, collect responses from humans and large language models, and perform data labeling and many other research tasks. Results are formatted as specified datasets and come with built-in methods for analyzing, visualizing and sharing.

edsl.png

Getting started

Requirements

  • Python 3.9 - 3.12
  • API keys for language models. You can use your own keys or an Expected Parrot key that provides access to all available models. See instructions on managing keys and model pricing and performance information.

Coop

An integrated platform for running experiments, sharing workflows and launching hybrid human/AI surveys.

Community

Contact

Hello, World!

A quick example:

# Import a question type
from edsl import QuestionMultipleChoice, Agent, Model

# Construct a question
q = QuestionMultipleChoice(
    question_name = "color",
    question_text = "What is your favorite primary color?",
    question_options = ["Red", "Yellow", "Blue"]
)

# Design an agent
a = Agent(traits = {"persona":"You are a botanist."})

# Select a model
m = Model("gemini-1.5-flash")

# Administer the question
results = q.by(a).by(m).run()

# Inspect the results
results.select("color")

Output:

answer.color comment.color_comment
Blue It's the color of so many beautiful flowers, from forget-me-nots to hydrangeas.
Plus, it reminds me of a clear, cool spring day, perfect for exploring the wild.

See results at Coop