Skip to main content

[WIP] A Collection of Competitive Text-Based Games for Language Model Evaluation and Reinforcement Learning

Project description

PyPI version Discord Website

TextArena  

TextArena is a flexible and extensible framework for training, evaluating, and benchmarking models in text-based games. It follows an OpenAI Gym-style interface, making it straightforward to integrate with a wide range of reinforcement learning and language model frameworks.


Example

Installation

Install TextArena directly from PyPI:

pip install textarena

Install enchant on ubuntu:

apt install enchant2

Play Offline

import textarena as ta

# Initialize agents
agents = {
    0: ta.agents.OpenRouterAgent(model_name="GPT-4o-mini"),
    1: ta.agents.OpenRouterAgent(model_name="anthropic/claude-3.5-haiku"),
}

# Initialize environment from subset and wrap it
env = ta.make(env_id="BalancedSubset-v0")
env = ta.wrappers.LLMObservationWrapper(env=env)
env = ta.wrappers.SimpleRenderWrapper(
    env=env,
    player_names={0: "GPT-4o-mini", 1: "claude-3.5-haiku"},
)

env.reset()
done = False
while not done:
    player_id, observation = env.get_observation()
    action = agents[player_id](observation)
    done, info = env.step(action=action)
rewards = env.close()

Implementation Status

Single-Player Games

Game Name Offline Play Online Play Documentation
CarPuzzle
Chess
ConnectFour
Crosswords link
FifteenPuzzle link
GuessTheNumber link
GuessWho link
Hangman link
LogicPuzzle link
MathProof
Minesweeper link
Sudoku link
TowerOfHanoi link
TwentyQuestions link
WordLadder link
WordSearch link

Two-Player Games

Game Name Offline Play Online Play Documentation
Battleship link
Brass
CarPuzzle
Chess link
ConnectFour link
Debate link
DontSayIt link
IteratedPrisonersDilemma link
Jaipur
LetterAuction
LiarsDice link
Mastermind link
MathProof
MemoryGame
Negotiation link
Poker link
ScenarioPlanning
SpellingBee link
SpiteAndMalice link
Stratego link
Taboo
Tak link
UltimateTicTacToe link
TruthAndDeception link
WordChains link

Multi-Player Games

Game Name Offline Play Players Online Play Documentation
Diplomacy 3+
7 Wonders 3+
Bohnanza 3+
Codenames 4+
Negotiation 3+
Poker 3+
Risk 3+
SettlersOfCatan 3-4
TerraformingMars 1-5
Werewolf 5+

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

textarena-0.4.9.tar.gz (210.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

TextArena-0.4.9-py3-none-any.whl (253.0 kB view details)

Uploaded Python 3

File details

Details for the file textarena-0.4.9.tar.gz.

File metadata

  • Download URL: textarena-0.4.9.tar.gz
  • Upload date:
  • Size: 210.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for textarena-0.4.9.tar.gz
Algorithm Hash digest
SHA256 2d78bbc2accd07e05d7142c34b687cb192ecc00ca36fa8e1c0f7910956f2d657
MD5 022225a325ee8d0afcc503bb59a5a043
BLAKE2b-256 de06ebe18ac786fceae0afb2740e280d36f3d33ea56925015c2cd9e68fe3f0c4

See more details on using hashes here.

File details

Details for the file TextArena-0.4.9-py3-none-any.whl.

File metadata

  • Download URL: TextArena-0.4.9-py3-none-any.whl
  • Upload date:
  • Size: 253.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for TextArena-0.4.9-py3-none-any.whl
Algorithm Hash digest
SHA256 9b5b34276d9aaaf1eba38d0b417a767db210d20b87e113d734e086287e1cc862
MD5 6020d0ecc2ddd66027af08d13c3d2ed2
BLAKE2b-256 0a2f170140e4149e7a704c631b4d13b788d1f24d48c46f5dcde6915f4485d4b8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page