intercode-bench


Nameintercode-bench JSON
Version 0.1.22 PyPI version JSON
download
home_pagehttp://github.com/intercode-benchmark/intercode-benchmark
SummaryThe official InterCode benchmark package - a framework for interactive code tasks
upload_time2023-06-30 06:35:22
maintainer
docs_urlNone
authorJohn Yang
requires_python>=3.8
license
keywords nlp benchmark interaction code rl decision making
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 🤖💻 Intercode
Build interactive code environments for training, testing, and augmenting code and decision making agents

<p>
    <a href="https://badge.fury.io/py/intercode-bench">
        <img src="https://badge.fury.io/py/intercode-bench.svg">
    </a>
    <a href="https://www.python.org/">
        <img alt="Build" src="https://img.shields.io/badge/Python-3.8+-1f425f.svg?color=purple">
    </a>
    <a href="https://copyright.princeton.edu/policy">
        <img alt="License" src="https://img.shields.io/badge/License-MIT-blue">
    </a>
</p>

## 👋 Overview
InterCode is a **lightweight, flexible, and easy-to-use framework** for designing interactive code environments. Following the popular [`gym`](https://gymnasium.farama.org/) interface definition, InterCode makes it easy to quickly define a code environment and deploy an agent to operate in code within the context of the environment.

For an overview of InterCode, building interactive code tasks with InterCode, and evaluating agents on InterCode environments, please check out our [wiki](https://github.com/princeton-nlp/intercode/wiki), [website](https://intercode-benchmark.github.io/) and the original paper:

**[InterCode: Standardizing and Benchmarking Interactive Coding with Execution Feedback](https://arxiv.org/abs/2306.14898)**  

## 🛠️ Installation
> **Note**
> InterCode requires the following installations to run:
> * `python` >= 3.8
> * `docker`: Learn more [here](https://docs.docker.com/get-docker/) to install.

```
pip install intercode-bench
```

## 🚀 Quick Start

Before running the below code, make sure the Docker daemon/application is running locally.

### Bash
Create a python file and copy + paste the following code to interact with the InterCode Bash environment.
```python
import readline
from intercode.assets import bash_build_docker, bash_image_name, bash_test_data
from intercode.envs import BashEnv

if __name__ == '__main__':
    bash_build_docker()
    env = BashEnv(bash_image_name, data_path=bash_test_data, traj_dir="logs/", verbose=True)

    try:
        for idx in range(3):
            env.reset()
            obs, done = env.observation, False
            while not done:
                action = input('> ')
                obs, reward, done, info = env.step(action)
    except KeyboardInterrupt:
        print("Keyboard interrupt detected")
    finally:
        env.close()
```
If InterCode was installed successfully, the InterCode Bash environment should be started successfully and a CLI interpreter should appear, allowing you to enter `bash` commands to interact with the task setting's file system. You can `^c` at any to time to exit the environment.

### SQL
Create a python file and copy + paste the following code to interact with the InterCode SQL environment.
```python
import readline
from intercode.assets import sql_build_docker, sql_image_name, sql_test_data
from intercode.envs import SqlEnv

from typing import Dict
def preprocess(record: Dict) -> str:
    db = record["extra"]["db"]
    return f"use {db}"

if __name__ == '__main__':
    sql_build_docker()
    env = SqlEnv(sql_image_name, data_path=sql_test_data, preprocess=preprocess, traj_dir="logs/", verbose=True)

    try:
        for idx in range(3):
            env.reset()
            obs, done = env.observation, False
            while not done:
                action = input('> ')
                obs, reward, done, info = env.step(action)
    except KeyboardInterrupt:
        print("Keyboard interrupt detected")
    finally:
        env.close()
```
If InterCode was installed successfully, the InterCode SQL environment should be started successfully and a CLI interpreter should appear, allowing you to enter `SQL` commands to interact with the task setting's MySQL database. You can `^c` at any to time to exit the environment.

## 🔎 Learn More
To learn more about the InterCode framework, please check out the [website](https://intercode-benchmark.github.io/) and GitHub [repository](https://github.com/princeton-nlp/intercode)

## 🪪 License
Check `LICENSE.md`

            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/intercode-benchmark/intercode-benchmark",
    "name": "intercode-bench",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "nlp,benchmark,interaction,code,rl,decision making",
    "author": "John Yang",
    "author_email": "byjohnyang@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/18/02/8d99e54630c8d8bd9c827ae9f80a52def3c0806eb31ee9681226fc8b3fbe/intercode-bench-0.1.22.tar.gz",
    "platform": null,
    "description": "# \ud83e\udd16\ud83d\udcbb Intercode\nBuild interactive code environments for training, testing, and augmenting code and decision making agents\n\n<p>\n    <a href=\"https://badge.fury.io/py/intercode-bench\">\n        <img src=\"https://badge.fury.io/py/intercode-bench.svg\">\n    </a>\n    <a href=\"https://www.python.org/\">\n        <img alt=\"Build\" src=\"https://img.shields.io/badge/Python-3.8+-1f425f.svg?color=purple\">\n    </a>\n    <a href=\"https://copyright.princeton.edu/policy\">\n        <img alt=\"License\" src=\"https://img.shields.io/badge/License-MIT-blue\">\n    </a>\n</p>\n\n## \ud83d\udc4b Overview\nInterCode is a **lightweight, flexible, and easy-to-use framework** for designing interactive code environments. Following the popular [`gym`](https://gymnasium.farama.org/) interface definition, InterCode makes it easy to quickly define a code environment and deploy an agent to operate in code within the context of the environment.\n\nFor an overview of InterCode, building interactive code tasks with InterCode, and evaluating agents on InterCode environments, please check out our [wiki](https://github.com/princeton-nlp/intercode/wiki), [website](https://intercode-benchmark.github.io/) and the original paper:\n\n**[InterCode: Standardizing and Benchmarking Interactive Coding with Execution Feedback](https://arxiv.org/abs/2306.14898)**  \n\n## \ud83d\udee0\ufe0f Installation\n> **Note**\n> InterCode requires the following installations to run:\n> * `python` >= 3.8\n> * `docker`: Learn more [here](https://docs.docker.com/get-docker/) to install.\n\n```\npip install intercode-bench\n```\n\n## \ud83d\ude80 Quick Start\n\nBefore running the below code, make sure the Docker daemon/application is running locally.\n\n### Bash\nCreate a python file and copy + paste the following code to interact with the InterCode Bash environment.\n```python\nimport readline\nfrom intercode.assets import bash_build_docker, bash_image_name, bash_test_data\nfrom intercode.envs import BashEnv\n\nif __name__ == '__main__':\n    bash_build_docker()\n    env = BashEnv(bash_image_name, data_path=bash_test_data, traj_dir=\"logs/\", verbose=True)\n\n    try:\n        for idx in range(3):\n            env.reset()\n            obs, done = env.observation, False\n            while not done:\n                action = input('> ')\n                obs, reward, done, info = env.step(action)\n    except KeyboardInterrupt:\n        print(\"Keyboard interrupt detected\")\n    finally:\n        env.close()\n```\nIf InterCode was installed successfully, the InterCode Bash environment should be started successfully and a CLI interpreter should appear, allowing you to enter `bash` commands to interact with the task setting's file system. You can `^c` at any to time to exit the environment.\n\n### SQL\nCreate a python file and copy + paste the following code to interact with the InterCode SQL environment.\n```python\nimport readline\nfrom intercode.assets import sql_build_docker, sql_image_name, sql_test_data\nfrom intercode.envs import SqlEnv\n\nfrom typing import Dict\ndef preprocess(record: Dict) -> str:\n    db = record[\"extra\"][\"db\"]\n    return f\"use {db}\"\n\nif __name__ == '__main__':\n    sql_build_docker()\n    env = SqlEnv(sql_image_name, data_path=sql_test_data, preprocess=preprocess, traj_dir=\"logs/\", verbose=True)\n\n    try:\n        for idx in range(3):\n            env.reset()\n            obs, done = env.observation, False\n            while not done:\n                action = input('> ')\n                obs, reward, done, info = env.step(action)\n    except KeyboardInterrupt:\n        print(\"Keyboard interrupt detected\")\n    finally:\n        env.close()\n```\nIf InterCode was installed successfully, the InterCode SQL environment should be started successfully and a CLI interpreter should appear, allowing you to enter `SQL` commands to interact with the task setting's MySQL database. You can `^c` at any to time to exit the environment.\n\n## \ud83d\udd0e Learn More\nTo learn more about the InterCode framework, please check out the [website](https://intercode-benchmark.github.io/) and GitHub [repository](https://github.com/princeton-nlp/intercode)\n\n## \ud83e\udeaa License\nCheck `LICENSE.md`\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "The official InterCode benchmark package - a framework for interactive code tasks",
    "version": "0.1.22",
    "project_urls": {
        "Bug Reports": "https://github.com/intercode-benchmark/intercode-benchmark/issues",
        "Documentation": "https://github.com/intercode-benchmark/intercode-benchmark",
        "Homepage": "http://github.com/intercode-benchmark/intercode-benchmark",
        "Source Code": "https://github.com/intercode-benchmark/intercode-benchmark",
        "Website": "https://intercode-benchmark.github.io/"
    },
    "split_keywords": [
        "nlp",
        "benchmark",
        "interaction",
        "code",
        "rl",
        "decision making"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e23d2539ef4f919bbb601c4a92eaf27ef66d85f72af4d4ac5f0c1d048389f10f",
                "md5": "87e00348f437315601ad07d2d92636ec",
                "sha256": "3cecd6796bdb70276a5915ca1db725b5e419291638a34383b16747530d95b8cc"
            },
            "downloads": -1,
            "filename": "intercode_bench-0.1.22-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "87e00348f437315601ad07d2d92636ec",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 143624,
            "upload_time": "2023-06-30T06:35:21",
            "upload_time_iso_8601": "2023-06-30T06:35:21.232724Z",
            "url": "https://files.pythonhosted.org/packages/e2/3d/2539ef4f919bbb601c4a92eaf27ef66d85f72af4d4ac5f0c1d048389f10f/intercode_bench-0.1.22-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "18028d99e54630c8d8bd9c827ae9f80a52def3c0806eb31ee9681226fc8b3fbe",
                "md5": "ee54a64961ed94bbd2d889e3a99a8631",
                "sha256": "3cbceb06febaf2a1de1c981757d4bd154ec44fe4a344995b6305a3d1d2717e2a"
            },
            "downloads": -1,
            "filename": "intercode-bench-0.1.22.tar.gz",
            "has_sig": false,
            "md5_digest": "ee54a64961ed94bbd2d889e3a99a8631",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 141453,
            "upload_time": "2023-06-30T06:35:22",
            "upload_time_iso_8601": "2023-06-30T06:35:22.937844Z",
            "url": "https://files.pythonhosted.org/packages/18/02/8d99e54630c8d8bd9c827ae9f80a52def3c0806eb31ee9681226fc8b3fbe/intercode-bench-0.1.22.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-30 06:35:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "intercode-benchmark",
    "github_project": "intercode-benchmark",
    "github_not_found": true,
    "lcname": "intercode-bench"
}
        
Elapsed time: 0.15869s