codeinterpreterapi


Namecodeinterpreterapi JSON
Version 0.1.20 PyPI version JSON
download
home_pageNone
SummaryCodeInterpreterAPI is an (unofficial) open source python interface for the ChatGPT CodeInterpreter.
upload_time2024-11-07 03:28:47
maintainerNone
docs_urlNone
authorNone
requires_python<3.13,>=3.9.7
license# MIT License Copyright (c) 2023 Dominic Bäumer Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords api chatgpt codeboxapi codeinterpreter codeinterpreterapi langchain
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 👾 Code Interpreter API

[![Version](https://badge.fury.io/py/codeinterpreterapi.svg)](https://badge.fury.io/py/codeinterpreterapi)
![Downloads](https://img.shields.io/pypi/dm/codeinterpreterapi)
![License](https://img.shields.io/pypi/l/codeinterpreterapi)
![PyVersion](https://img.shields.io/pypi/pyversions/codeinterpreterapi)

A [LangChain](https://github.com/langchain-ai/langchain) implementation of the ChatGPT Code Interpreter.
Using CodeBoxes as backend for sandboxed python code execution.
[CodeBox](https://github.com/shroominic/codebox-api/tree/main) is the simplest cloud infrastructure for your LLM Apps.
You can run everything local except the LLM using your own OpenAI API Key.

## Features

- Dataset Analysis, Stock Charting, Image Manipulation, ....
- Internet access and auto Python package installation
- Input `text + files` -> Receive `text + files`
- Conversation Memory: respond based on previous inputs
- Run everything local except the OpenAI API (OpenOrca or others maybe soon)
- Use CodeBox API for easy scaling in production

## Docs

Checkout the [documentation](https://shroominic.github.io/codeinterpreter-api/) for more information.

## Installation

Get your OpenAI API Key [here](https://platform.openai.com/account/api-keys) and install the package.

```bash
pip install "codeinterpreterapi[all]"
```

Everything for local experiments are installed with the `all` extra.
For deployments, you can use `pip install codeinterpreterapi` instead which does not install the additional dependencies.

## Usage

To configure OpenAI and Azure OpenAI, ensure that you set the appropriate environment variables (or use a .env file):

For OpenAI, set the OPENAI_API_KEY environment variable:

```bash
export OPENAI_API_KEY=sk-**********
```

```python
from codeinterpreterapi import CodeInterpreterSession, settings


# create a session and close it automatically
with CodeInterpreterSession() as session:
    # generate a response based on user input
    response = session.generate_response(
        "Plot the bitcoin chart of year 2023"
    )
    # output the response
    response.show()
```

![Bitcoin YTD](https://github.com/shroominic/codeinterpreter-api/blob/main/examples/assets/bitcoin_chart.png?raw=true)
Bitcoin YTD Chart Output

## Dataset Analysis

```python
from codeinterpreterapi import CodeInterpreterSession, File

# this example uses async but normal sync like above works too
async def main():
    # context manager for auto start/stop of the session
    async with CodeInterpreterSession() as session:
        # define the user request
        user_request = "Analyze this dataset and plot something interesting about it."
        files = [
            # attach files to the request
            File.from_path("examples/assets/iris.csv"),
        ]

        # generate the response
        response = await session.generate_response(
            user_request, files=files
        )

        # output to the user
        print("AI: ", response.content)
        for file in response.files:
            # iterate over the files (display if image)
            file.show_image()


if __name__ == "__main__":
    import asyncio

    asyncio.run(main())
```

![Iris Dataset Analysis](https://github.com/shroominic/codeinterpreter-api/blob/main/examples/assets/iris_analysis.png?raw=true)
Iris Dataset Analysis Output

## Production

In case you want to deploy to production, you can utilize the CodeBox API for seamless scalability.

Please contact me if you are interested in this, as it is still in the early stages of development.

## Contributing

There are some remaining TODOs in the code.
So, if you want to contribute, feel free to do so.
You can also suggest new features. Code refactoring is also welcome.
Just open an issue or pull request and I will review it.

Please also submit any bugs you find as an issue with a minimal code example or screenshot.
This helps me a lot in improving the code.

## Contact

You can contact me at [contact@shroominic.com](mailto:contact@shroominic.com).
But I prefer to use [Twitter](https://twitter.com/shroominic) or [Discord](https://discord.gg/Vaq25XJvvW) DMs.

## Support this project

If you would like to help this project with a donation, you can [click here](https://ko-fi.com/shroominic).
Thanks, this helps a lot! ❤️

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "codeinterpreterapi",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.13,>=3.9.7",
    "maintainer_email": null,
    "keywords": "api, chatgpt, codeboxapi, codeinterpreter, codeinterpreterapi, langchain",
    "author": null,
    "author_email": "Shroominic <contact@shroominic.com>",
    "download_url": "https://files.pythonhosted.org/packages/76/30/85b14ebfc782d88e049577fa38cf6064bf55afcea352ac921f02bb5a356b/codeinterpreterapi-0.1.20.tar.gz",
    "platform": null,
    "description": "# \ud83d\udc7e Code Interpreter API\n\n[![Version](https://badge.fury.io/py/codeinterpreterapi.svg)](https://badge.fury.io/py/codeinterpreterapi)\n![Downloads](https://img.shields.io/pypi/dm/codeinterpreterapi)\n![License](https://img.shields.io/pypi/l/codeinterpreterapi)\n![PyVersion](https://img.shields.io/pypi/pyversions/codeinterpreterapi)\n\nA [LangChain](https://github.com/langchain-ai/langchain) implementation of the ChatGPT Code Interpreter.\nUsing CodeBoxes as backend for sandboxed python code execution.\n[CodeBox](https://github.com/shroominic/codebox-api/tree/main) is the simplest cloud infrastructure for your LLM Apps.\nYou can run everything local except the LLM using your own OpenAI API Key.\n\n## Features\n\n- Dataset Analysis, Stock Charting, Image Manipulation, ....\n- Internet access and auto Python package installation\n- Input `text + files` -> Receive `text + files`\n- Conversation Memory: respond based on previous inputs\n- Run everything local except the OpenAI API (OpenOrca or others maybe soon)\n- Use CodeBox API for easy scaling in production\n\n## Docs\n\nCheckout the [documentation](https://shroominic.github.io/codeinterpreter-api/) for more information.\n\n## Installation\n\nGet your OpenAI API Key [here](https://platform.openai.com/account/api-keys) and install the package.\n\n```bash\npip install \"codeinterpreterapi[all]\"\n```\n\nEverything for local experiments are installed with the `all` extra.\nFor deployments, you can use `pip install codeinterpreterapi` instead which does not install the additional dependencies.\n\n## Usage\n\nTo configure OpenAI and Azure OpenAI, ensure that you set the appropriate environment variables (or use a .env file):\n\nFor OpenAI, set the OPENAI_API_KEY environment variable:\n\n```bash\nexport OPENAI_API_KEY=sk-**********\n```\n\n```python\nfrom codeinterpreterapi import CodeInterpreterSession, settings\n\n\n# create a session and close it automatically\nwith CodeInterpreterSession() as session:\n    # generate a response based on user input\n    response = session.generate_response(\n        \"Plot the bitcoin chart of year 2023\"\n    )\n    # output the response\n    response.show()\n```\n\n![Bitcoin YTD](https://github.com/shroominic/codeinterpreter-api/blob/main/examples/assets/bitcoin_chart.png?raw=true)\nBitcoin YTD Chart Output\n\n## Dataset Analysis\n\n```python\nfrom codeinterpreterapi import CodeInterpreterSession, File\n\n# this example uses async but normal sync like above works too\nasync def main():\n    # context manager for auto start/stop of the session\n    async with CodeInterpreterSession() as session:\n        # define the user request\n        user_request = \"Analyze this dataset and plot something interesting about it.\"\n        files = [\n            # attach files to the request\n            File.from_path(\"examples/assets/iris.csv\"),\n        ]\n\n        # generate the response\n        response = await session.generate_response(\n            user_request, files=files\n        )\n\n        # output to the user\n        print(\"AI: \", response.content)\n        for file in response.files:\n            # iterate over the files (display if image)\n            file.show_image()\n\n\nif __name__ == \"__main__\":\n    import asyncio\n\n    asyncio.run(main())\n```\n\n![Iris Dataset Analysis](https://github.com/shroominic/codeinterpreter-api/blob/main/examples/assets/iris_analysis.png?raw=true)\nIris Dataset Analysis Output\n\n## Production\n\nIn case you want to deploy to production, you can utilize the CodeBox API for seamless scalability.\n\nPlease contact me if you are interested in this, as it is still in the early stages of development.\n\n## Contributing\n\nThere are some remaining TODOs in the code.\nSo, if you want to contribute, feel free to do so.\nYou can also suggest new features. Code refactoring is also welcome.\nJust open an issue or pull request and I will review it.\n\nPlease also submit any bugs you find as an issue with a minimal code example or screenshot.\nThis helps me a lot in improving the code.\n\n## Contact\n\nYou can contact me at [contact@shroominic.com](mailto:contact@shroominic.com).\nBut I prefer to use [Twitter](https://twitter.com/shroominic) or [Discord](https://discord.gg/Vaq25XJvvW) DMs.\n\n## Support this project\n\nIf you would like to help this project with a donation, you can [click here](https://ko-fi.com/shroominic).\nThanks, this helps a lot! \u2764\ufe0f\n",
    "bugtrack_url": null,
    "license": "# MIT License  Copyright (c) 2023 Dominic B\u00e4umer  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "CodeInterpreterAPI is an (unofficial) open source python interface for the ChatGPT CodeInterpreter.",
    "version": "0.1.20",
    "project_urls": {
        "Code": "https://github.com/shroominic/codeinterpreter-api",
        "Docs": "https://shroominic.github.io/codeinterpreter-api"
    },
    "split_keywords": [
        "api",
        " chatgpt",
        " codeboxapi",
        " codeinterpreter",
        " codeinterpreterapi",
        " langchain"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "794bd7f69fc48578627be15791447585176385f38ca86314ae27b1f3f31c6777",
                "md5": "119f5ce5d435624e9f1ac1c16a85f4e1",
                "sha256": "cf6d81c4ce821ca47816b069ec8473accd8695d40197aa15b9f644c910c1e905"
            },
            "downloads": -1,
            "filename": "codeinterpreterapi-0.1.20-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "119f5ce5d435624e9f1ac1c16a85f4e1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.13,>=3.9.7",
            "size": 19249,
            "upload_time": "2024-11-07T03:28:45",
            "upload_time_iso_8601": "2024-11-07T03:28:45.721906Z",
            "url": "https://files.pythonhosted.org/packages/79/4b/d7f69fc48578627be15791447585176385f38ca86314ae27b1f3f31c6777/codeinterpreterapi-0.1.20-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "763085b14ebfc782d88e049577fa38cf6064bf55afcea352ac921f02bb5a356b",
                "md5": "901face56f2e4bc2d04c61a94287453b",
                "sha256": "8e5ebfbde218e82c4be8af94add0ed851d0eaa9f6deb71e973d89fc3af317d37"
            },
            "downloads": -1,
            "filename": "codeinterpreterapi-0.1.20.tar.gz",
            "has_sig": false,
            "md5_digest": "901face56f2e4bc2d04c61a94287453b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.13,>=3.9.7",
            "size": 224691,
            "upload_time": "2024-11-07T03:28:47",
            "upload_time_iso_8601": "2024-11-07T03:28:47.270724Z",
            "url": "https://files.pythonhosted.org/packages/76/30/85b14ebfc782d88e049577fa38cf6064bf55afcea352ac921f02bb5a356b/codeinterpreterapi-0.1.20.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-07 03:28:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "shroominic",
    "github_project": "codeinterpreter-api",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "codeinterpreterapi"
}
        
Elapsed time: 0.50318s