Skip to content

Commit

Permalink
Merge branch 'doc/install-instructions' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
ProKil committed Jun 18, 2024
2 parents ce78c03 + aa75d30 commit e753eb1
Show file tree
Hide file tree
Showing 34 changed files with 2,181 additions and 2,300 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,26 @@ jobs:
runs-on: ubuntu-latest
strategy:
max-parallel: 5
matrix:
python-version: ["3.10", "3.11", "3.12"]

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: 3.11.2
python-version: ${{ matrix.python-version }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install dependencies
run: |
curl -sSL https://install.python-poetry.org | python3
poetry install --all-extras
poetry lock
poetry install --with test -E chat
- name: Type-checking package with mypy
run: |
# Run this mypy instance against our main package.
poetry run pip install types-protobuf==4.24.0.4
poetry run mypy --install-types --non-interactive sotopia
poetry run mypy --install-types --non-interactive sotopia-chat
poetry run mypy --strict .
38 changes: 38 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Upload Python Package

on:
release:
types: [published]

permissions:
contents: read

jobs:
release:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11.2
- name: Install dependencies
run: |
curl -sSL https://install.python-poetry.org | python3
- name: Get release version
run: echo "RELEASE_VERSION=$(poetry version | awk '{print $2}')" >> $GITHUB_ENV

- name: Build and publish Python package
run: poetry publish --build
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }}
3 changes: 2 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ jobs:
- name: Install dependencies
run: |
curl -sSL https://install.python-poetry.org | python3
poetry install --all-extras
poetry lock
poetry install --with test -E chat
- name: Test with pytest
env: # Or as an environment variable
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ If you want to try it out on Google Colab first, please check out our Colab Tuto
<ol>
<li> Basic
<ol>
<li> <a href="https://colab.research.google.com/drive/14hJOfzpA37PRUzdlFgiqVzUGIhhngqnz?usp=sharing">1.1 Playing with Sotopia in a Google Colab Notebook</a> </li>
<li> <a href="https://colab.research.google.com/drive/1Gi2U3cA0KG1nekw1A0N0DZpx6gKrj8Nc?usp=sharing">1.2 Browsing sotopia data</a> </li>
<li> <a href="https://colab.research.google.com/github/sotopia-lab/sotopia/blob/main/notebooks/tutorials/1.1-setup.ipynb">1.1 Playing with Sotopia in a Google Colab Notebook</a> </li>
<li> <a href="https://colab.research.google.com/github/sotopia-lab/sotopia/blob/main/notebooks/tutorials/1.2-browse-data.ipynb">1.2 Browsing sotopia data</a> </li>
</ol>
</li>
<li>
Expand Down
Binary file modified docs/bun.lockb
Binary file not shown.
6 changes: 5 additions & 1 deletion docs/pages/examples.md → docs/pages/examples.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { Callout } from 'nextra/components'

# Example Scripts For Using The Library

## Example 1: Evaluating existing episodes
<Callout type="info" emoji="ℹ️">
Before running examples, please install extra dependencies with `pip install sotopia[examples]` or `poetry install -E examples` if you are using poetry.
</Callout>

```python
python examples/evaluate_existing_episodes.py --tag=<tag to upload to the database> --model=<the model used to re-evaluate the existing episodes> --batch_size=<batch size used for evaluation> --push-to-db
Expand Down
99 changes: 64 additions & 35 deletions docs/pages/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Lumiflex } from 'uvcanvas'
import { Button } from "../components/ui/button"
import { MoveRight } from "lucide-react"
import { Accordion, AccordionItem, AccordionContent, AccordionTrigger } from "../components/ui/accordion"
import { Steps } from 'nextra/components'
import { Steps, Callout } from 'nextra/components'
import { Tabs, TabsContent, TabsList, TabsTrigger } from "../components/ui/tabs"


Expand Down Expand Up @@ -32,15 +32,17 @@ https://github.com/sotopia-lab/sotopia

## Installation

<div className='mt-3 space-x-3 flex flex-row items-center'>
<Link target="_blank" href="https://colab.research.google.com/drive/14hJOfzpA37PRUzdlFgiqVzUGIhhngqnz?usp=sharing">
<Callout>

<div className='space-x-3 flex flex-row items-center'>
<span className='font-bold'> Check out </span>
<Link target="_blank" href="https://colab.research.google.com/github/sotopia-lab/sotopia/blob/main/notebooks/tutorials/1.1-setup.ipynb">
<img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"/> </Link>
<span className='font-bold'> for a quick tutorial </span>
</div>

### Basic Usage

This package supports Python 3.11 and above.
This package supports Python 3.10 and above.
</Callout>



Expand Down Expand Up @@ -82,6 +84,19 @@ pip install sotopia
```
</AccordionContent>
</AccordionItem>
<AccordionItem value="item-4">
<AccordionTrigger>What if I want to run examples and sotopia-chat?</AccordionTrigger>
<AccordionContent>
<p>Install the package with the following command:</p>
```bash
pip install sotopia[examples, chat]
```
if you are using poetry, you can install the package with:
```bash
poetry install -E examples -E chat
```
</AccordionContent>
</AccordionItem>
</Accordion>

#### Set up Redis stack
Expand All @@ -103,38 +118,47 @@ Redis stack is a required dependency for using Sotopia. There are two ways to se
<AccordionItem value="item-2">
<AccordionTrigger>No, I don't want to use Docker.</AccordionTrigger>
<AccordionContent>
<Tabs defaultValue="linux" className="w-full">
<TabsList>
<TabsTrigger value="linux">Linux</TabsTrigger>
<TabsTrigger value="mac">MacOS</TabsTrigger>
<TabsTrigger value="windows">Windows</TabsTrigger>
</TabsList>
<TabsContent value="linux">

<Steps>
### Download the Redis stack
<Tabs defaultValue="ubuntu20" className="w-full mt-3 bg-inherit">
<TabsList>
<TabsTrigger value="ubuntu20">Ubuntu 20.04</TabsTrigger>
<TabsTrigger value="ubuntu22">Ubuntu 22.04</TabsTrigger>
<TabsTrigger value="mac">Mac OS</TabsTrigger>
</TabsList>
<TabsContent value="ubuntu20">
```bash
curl -fsSL https://packages.redis.io/redis-stack/redis-stack-server-7.2.0-v10.focal.x86_64.tar.gz -o redis-stack-server.tar.gz
tar -xvzf redis-stack-server.tar.gz
export PATH=$(pwd)/redis-stack-server-7.2.0-v10/bin:$PATH
```
</TabsContent>
<TabsContent value="ubuntu22">
```bash
curl -fsSL https://packages.redis.io/redis-stack/redis-stack-server-7.2.0-v10.focal.x86_64.tar.gz -o redis-stack-server.tar.gz
tar -xvzf redis-stack-server.tar.gz
export PATH=$(pwd)/redis-stack-server-7.2.0-v10/bin:$PATH
wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.22_amd64.deb
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.22_amd64.deb
```
</TabsContent>
<TabsContent value="mac">
```bash
brew tap redis-stack/redis-stack
brew install redis-stack
```
</TabsContent>
</Tabs>
```bash
# if you are using Ubunutu 20.04
curl -fsSL https://packages.redis.io/redis-stack/redis-stack-server-7.2.0-v10.focal.x86_64.tar.gz -o redis-stack-server.tar.gz
tar -xvzf redis-stack-server.tar.gz
export PATH=$(pwd)/redis-stack-server-7.2.0-v10/bin:$PATH
# if you are using Ubunutu 22.04, please do an extra step
wget http://nz2.archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.22_amd64.deb
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.22_amd64.deb
```

### Start the server
```bash
./redis-stack-server-7.2.0-v10/bin/redis-stack-server --daemonize yes
```



### The `REDIS_OM_URL` need to be set before loading and saving agents:
```bash
conda env config vars set REDIS_OM_URL="redis://user:password@host:port"
```
If you are using the default settings, you can set the `REDIS_OM_URL` to `redis://localhost:6379`.
</Steps>
</TabsContent>
<TabsContent value="mac">
<Steps>
### Download the Redis stack
```bash
brew tap redis-stack/redis-stack
brew install redis-stack
```

### Start the server
```bash
Expand All @@ -150,6 +174,11 @@ Redis stack is a required dependency for using Sotopia. There are two ways to se
```
If you are using the default settings, you can set the `REDIS_OM_URL` to `redis://localhost:6379`.
</Steps>
</TabsContent>
<TabsContent value="windows">
For Windows, unfortunately only docker is supported. Check the [official documentation](https://redis.io/docs/latest/operate/oss_and_stack/install/install-stack/windows/).
</TabsContent>
</Tabs>
</AccordionContent>
</AccordionItem>
</Accordion>
Expand Down
Binary file added docs/public/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 6 additions & 13 deletions docs/public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const config = {
'./app/**/*.{ts,tsx}',
'./src/**/*.{ts,tsx}',
],
safelist: ['dark'],
prefix: "",
safelist: ["dark"],
theme: {
container: {
center: true,
Expand Down
2 changes: 2 additions & 0 deletions examples/generate_scenarios.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
from sotopia.database.persistent_profile import RelationshipType
from sotopia.generation_utils import (
LLM_Name,
)
from .generate_specific_envs import ( # type:ignore[import-untyped]
generate_craigslist_bargains_envs,
generate_mutual_friend_envs,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
Here are the datasets we have so far:
1. Mutual-Friend (https://huggingface.co/datasets/mutual_friends)
2. Craigslist-Bargains (https://huggingface.co/datasets/craigslist_bargains)
You will have to install the datasets library to use this file.
"""

import names
import numpy as np
from datasets import DatasetDict, load_dataset

from .generate import StrOutputParser, generate
from sotopia.generation_utils.generate import StrOutputParser, generate


async def generate_mutual_friend_envs() -> tuple[str, list[str]]:
Expand Down
Empty file removed lmlib/__init__.py
Empty file.
Empty file removed lmlib/api_service/__init__.py
Empty file.
Loading

0 comments on commit e753eb1

Please sign in to comment.