Metadata-Version: 2.4
Name: sotopia
Version: 0.1.3
Summary: A platform for simulating and evaluating social interaction.
Author-email: Hao Zhu <prokilchu@gmail.com>, Xuhui Zhou <xuhuiz@cs.cmu.edu>
License: MIT License
License-File: LICENSE
Requires-Python: <3.13,>=3.10
Requires-Dist: aact
Requires-Dist: absl-py<3.0.0,>=2.0.0
Requires-Dist: beartype<0.20.0,>=0.14.0
Requires-Dist: gin-config<0.6.0,>=0.5.0
Requires-Dist: hiredis>=3.0.0
Requires-Dist: langchain-openai<0.2,>=0.1.8
Requires-Dist: langchain<0.4.0,>=0.2.5
Requires-Dist: lxml<6.0.0,>=4.9.3
Requires-Dist: openai<2.0.0,>=1.11.0
Requires-Dist: pettingzoo==1.24.3
Requires-Dist: pydantic<3.0.0,>=2.5.0
Requires-Dist: redis-om<0.4.0,>=0.3.0
Requires-Dist: rich<14.0.0,>=13.6.0
Requires-Dist: together<1.4.0,>=0.2.4
Provides-Extra: anthropic
Requires-Dist: anthropic; extra == 'anthropic'
Provides-Extra: api
Requires-Dist: fastapi[standard]; extra == 'api'
Requires-Dist: modal; extra == 'api'
Requires-Dist: streamlit; extra == 'api'
Requires-Dist: uvicorn; extra == 'api'
Requires-Dist: websockets; extra == 'api'
Provides-Extra: cohere
Requires-Dist: cohere; extra == 'cohere'
Provides-Extra: examples
Requires-Dist: datasets; extra == 'examples'
Requires-Dist: pandas; extra == 'examples'
Requires-Dist: scipy; extra == 'examples'
Requires-Dist: torch; extra == 'examples'
Requires-Dist: transformers; extra == 'examples'
Provides-Extra: google-generativeai
Requires-Dist: google-generativeai; extra == 'google-generativeai'
Provides-Extra: groq
Requires-Dist: groq; extra == 'groq'
Provides-Extra: test
Requires-Dist: pytest; extra == 'test'
Requires-Dist: pytest-asyncio; extra == 'test'
Requires-Dist: pytest-cov; extra == 'test'
Description-Content-Type: text/markdown

<div style="width: 100%;">
  <img src="figs/title.png" style="width: 100%;" alt="sotopia"></img>
</div>

<h1 align="center">Sotopia: an Open-ended Social Learning Environment</h1>

<div align="center">

[![pypi](https://img.shields.io/pypi/v/sotopia.svg)](https://pypi.python.org/pypi/sotopia)
[![versions](https://img.shields.io/pypi/pyversions/sotopia.svg)](https://github.com/sotopia/sotopia)
[![CI](https://img.shields.io/github/actions/workflow/status/sotopia-lab/sotopia/tests.yml?branch=main&logo=github&label=CI)](https://github.com/sotopia-lab/sotopia/actions?query=branch%3Amain)
[![codecov](https://codecov.io/github/sotopia-lab/sotopia/graph/badge.svg?token=00LRQFX0QR)](https://codecov.io/github/sotopia-lab/sotopia)
[![Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/14hJOfzpA37PRUzdlFgiqVzUGIhhngqnz?usp=sharing)

[![Project Page](https://img.shields.io/badge/Project-Page-green.svg)](https://www.sotopia.world/projects/sotopia)
[![Paper PDF](https://img.shields.io/badge/Paper-PDF-red.svg)](https://arxiv.org/abs/2310.11667)
[![Dataset](https://img.shields.io/badge/%F0%9F%A4%97-Sotopia%20Dataset-yellow)](https://huggingface.co/datasets/cmu-lti/sotopia)
[![Demo](https://img.shields.io/badge/%F0%9F%A4%97-Sotopia%20Demo-orange)](https://huggingface.co/spaces/cmu-lti/sotopia-space/)



</div>

## News

* [05/2024] Sotopia was presented at ICLR 2024 as a spotlight ⭐!


## Introduction

Sotopia is an open-ended social learning environment that allows agents to interact with each other and the environment. The environment is designed to be a platform for evaluating and faciliating social intelligence in language agents. The environment is designed to be open-ended, meaning that the environment can be easily extended to include new environments and new agents. The environment is also designed to be scalable, meaning that the environment can be easily scaled to include a large number of agents and environments.



```bibtex
@inproceedings{zhou2024sotopia,
  title = {SOTOPIA: Interactive Evaluation for Social Intelligence in Language Agents},
  author = {Zhou*, Xuhui and Zhu*, Hao and Mathur, Leena and Zhang, Ruohong and Qi, Zhengyang and Yu, Haofei and Morency, Louis-Philippe and Bisk, Yonatan and Fried, Daniel and Neubig, Graham and Sap, Maarten},
  journal = {ICLR},
  year = {2024},
  url = {https://openreview.net/forum?id=mM7VurbA4r},
}
```

## Help
See [documentation](https://docs.sotopia.world) for more details.

## Get started

### Install locally
We recommend using a virtual environment, e.g. with anaconda3: `conda create -n sotopia python=3.11; conda activate sotopia;`.

Then:
`python -m pip install sotopia; sotopia install`

This will setup the necessary environment variables and download the necessary data.

> [!TIP]
> Having trouble installing? Or don't want to install redis for now? We are working on a public redis server for you to use. Stay tuned!

OpenAI key is required to run the code. Please set the environment variable `OPENAI_API_KEY` to your key. The recommend way is to add the key to the conda environment:
```bash
conda env config vars set OPENAI_API_KEY=your_key
```

## Easy Sample Server
You can view an episode demo with default parameters with the following:
```python
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-4o-mini",
            "agent2": "gpt-4o-mini",
        },
        sampler=UniformSampler(),
    )
)
```
or run
```bash
python examples/minimalist_demo.py
```
