Sotopia - Getting Started

https://github.com/sotopia-lab/sotopia (opens in a new tab)

Simulate social interactions between AIs and humans

  • Enables human-AI interaction
    • use LLMAgent to create LLM-based social agents,
    • REST API-based interface for humans.
  • Preset social tasks, characters, and interactions
    • more than 200 social tasks, 40 characters, and 10k interaction episodes,
    • interactions between agents backed by both closed-source and open-source LLMs, and human participants,
    • evaluation of the performance based on multiple social dimensions.
  • Realistic social interaction
    • agents can talk, do non-verbal communication and performance physical actions,
    • characters have different personalities, backgrounds, and relationships,
    • agents can have different goals and motivations.
  • Create your own
    • modular design for easy extension,
    • subclass BaseAgent, ParallelSotopiaEnv, Evaluator to create your own agents, environments, and evaluators,
    • add your customized social tasks and characters.

Installation

💡
Check out Open in Colab for a quick tutorial

This package supports Python 3.10 and above.

Install the package

pip install sotopia

Set up Redis stack

Redis stack is a required dependency for using Sotopia. There are two ways to set up Redis stack:

Set up the log folder

Just make a folder to store the logs:

mkdir logs

Quick Start

You can view an episode demo with default parameters with the following:

import asyncio
from sotopia.samplers import UniformSampler
from sotopia.server import run_async_server
 
asyncio.run(
    run_async_server(
        model_dict={
            "env": "gpt-4",
            "agent1": "gpt-3.5-turbo",
            "agent2": "gpt-3.5-turbo",
        },
        sampler=UniformSampler(),
    )
)

or if you have cloned the repo, run

python examples/minimalist_demo.py