Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
77462e2
create stone_pickaxe
XianzheFan Dec 24, 2024
976a440
help each other to make 3 stone pickaxes and add codeOutput to memory
XianzheFan Dec 25, 2024
ec73201
add theory of mind (goal inference)
XianzheFan Dec 25, 2024
c854d11
Delete examples/experimental/minecraft_agents/agent_output_log_202412…
XianzheFan Dec 27, 2024
81e21cc
Delete examples/experimental/minecraft_agents/agent_output_log_202412…
XianzheFan Dec 27, 2024
1bb4b99
Delete examples/experimental/minecraft_agents/agent_output_log_202412…
XianzheFan Dec 27, 2024
6a67143
add theory of mind (goal inference)
XianzheFan Dec 27, 2024
fe355fd
toml files for different tasks
XianzheFan Dec 28, 2024
f3c914b
added some new ToM questions
XianzheFan Jan 9, 2025
3e99c74
improve log
XianzheFan Jan 10, 2025
1b29ee2
read images from google cloud storage; add openai_api_predict_async
XianzheFan Jan 11, 2025
a5e0b26
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 12, 2025
7a2dff4
add chest_no_task_division
XianzheFan Jan 13, 2025
b3c0bad
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 13, 2025
e6c037b
add boat_no_division.toml
XianzheFan Jan 15, 2025
93fa00f
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 15, 2025
483ef2b
add stone_pickaxe & wooden pickaxe (no task division)
XianzheFan Jan 16, 2025
5876b37
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 16, 2025
9375428
add door_no_task_division.toml
XianzheFan Jan 16, 2025
f9142bb
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 16, 2025
3d4ead0
Automatically generate TOML files
XianzheFan Jan 19, 2025
2759cf2
[autofix.ci] apply automated fixes
autofix-ci[bot] Jan 19, 2025
f6dee68
update toml
XianzheFan May 13, 2025
3b6a01a
Update readme.md
XianzheFan May 13, 2025
cc0c337
Update readme.md
XianzheFan May 13, 2025
4ec83d0
Update README.md
XianzheFan May 13, 2025
0192111
Update readme.md
XianzheFan May 13, 2025
4f21bfe
Update README.md
XianzheFan May 13, 2025
b896692
Delete pyproject.toml
XianzheFan May 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 12 additions & 78 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,87 +1,21 @@
<div style="width: 100%;">
<img src="figs/title.png" style="width: 100%;" alt="sotopia"></img>
</div>
# User Guide

<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},
}
```
cd examples/experimental/minecraft_agents
uvicorn group_discussion_agents:app --reload --port 8080
```

## 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!
Enter `Minecraft Java Edition`, select `Singleplayer`, `1.20.1 version`, and `Survival Mode`, then click `Open to LAN 55916`.

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
```
// Open a new terminal
cd examples/experimental/minecraft_agents
export OPENAI_API_KEY=sk- // Enter your OpenAI API key here
uv run aact run-dataflow group_discussion_agents.toml
```

## 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
Download https://anonymous.4open.science/r/SoMi-ToM-1-580, then go to the main folder.

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
node src/agent/index.js
```
77 changes: 77 additions & 0 deletions examples/experimental/minecraft_agents/generate_toml.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import pandas as pd

xlsx_file = "examples\\experimental\\group_discussion_agents\\toml_generation.xlsx"
df = pd.read_excel(xlsx_file)

toml_template = '''redis_url = "redis://localhost:6379/0"
extra_modules = ["examples.experimental.group_discussion_agents.group_discussion_agents"]

[[nodes]]
node_name = "Jack"
node_class = "llm_agent"

[nodes.node_args]
query_interval = 15
output_channel = "Jack"
input_text_channels = ["Jane", "John"]
input_tick_channel = "tick/secs/1"
goal = """{goal_jack}"""
model_name = "gpt-4o-2024-11-20"
agent_name = "Jack"

[[nodes]]
node_name = "Jane"
node_class = "llm_agent"

[nodes.node_args]
query_interval = 19
output_channel = "Jane"
input_text_channels = ["Jack", "John"]
input_tick_channel = "tick/secs/1"
goal = """{goal_jane}"""
model_name = "gpt-4o-2024-11-20"
agent_name = "Jane"

[[nodes]]
node_name = "John"
node_class = "llm_agent"

[nodes.node_args]
query_interval = 23
output_channel = "John"
input_text_channels = ["Jack", "Jane"]
input_tick_channel = "tick/secs/1"
goal = """{goal_john}"""
model_name = "gpt-4o-2024-11-20"
agent_name = "John"

[[nodes]]
node_name = "record"
node_class = "record"

[nodes.node_args]
jsonl_file_path = "log.jsonl"

[nodes.node_args.record_channel_types]
"Jack" = "agent_action"
"Jane" = "agent_action"
"John" = "agent_action"

[[nodes]]
node_name = "tick"
node_class = "tick"
'''

for index, row in df.iterrows():
goal_jack = row["Jack"]
goal_jane = row["Jane"]
goal_john = row["John"]
filename = row["Filename"]

toml_content = toml_template.format(
goal_jack=goal_jack, goal_jane=goal_jane, goal_john=goal_john
)

output_filename = f"group_discussion_agents_{filename}.toml"
with open(output_filename, "w") as f:
f.write(toml_content)
Loading