Skip to main content

CodeInterpreterAPI is an unofficial and open source python interface for the ChatGPT CodeInterpreter.

Project description

Code Interpreter API

A LangChain implementation of the ChatGPT Code Interpreter. Using CodeBoxes as backend for sandboxed python code execution. CodeBox 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
  • Run everything local except the OpenAI API (OpenOrca or others coming soon)
  • Use CodeBox API for easy scaling in production (coming soon)

Installation

Get your OpenAI API Key here and install the package.

pip install codeinterpreterapi

Usage

from codeinterpreterapi import CodeInterpreterSession


async def main():
    # start a session
    session = CodeInterpreterSession()
    await session.astart()

    # generate a response based on user input
    output = await session.generate_response(
        "Plot the bitcoin chart of 2023 YTD"
    )
    # show output image in default image viewer
    file = output.files[0]
    file.show_image()

    # show output text
    print("AI: ", output.content)

    # terminate the session
    await session.astop()
    

if __name__ == "__main__":
    import asyncio, os
    os.environ["OPENAI_API_KEY"] = "sk-*********"  # or .env file

    asyncio.run(main())

Output

Bitcoin YTD

Production

In case you want to deploy to production you can use the CodeBox API for easy scaling.

Please contact me if you interested in this, because it's still in early development.

Contributing

There are some TODOs left 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 pull request and I will review it.

Also please submit any bugs you find as an issue with a minimal code example or screenshot. This helps me a lot to improve the code.

Thanks!

License

MIT

Contact

You can contact me at contact@shroominic.com. But I prefer to use Twitter or Discord DMs.

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

codeinterpreterapi-0.0.5.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

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

codeinterpreterapi-0.0.5-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file codeinterpreterapi-0.0.5.tar.gz.

File metadata

  • Download URL: codeinterpreterapi-0.0.5.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.6 Darwin/22.3.0

File hashes

Hashes for codeinterpreterapi-0.0.5.tar.gz
Algorithm Hash digest
SHA256 63b95526e2f2e8cbd4f325d03d68bbf096def3efbe3443fa2bcfac1749887629
MD5 c4cab0423b737ca8468c87917a20bdfd
BLAKE2b-256 9ada7ecd83f0a1ec6520fe6703bcf02dd3cb36cd308e3d334634038c9f31c5b2

See more details on using hashes here.

File details

Details for the file codeinterpreterapi-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: codeinterpreterapi-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.5.1 CPython/3.10.6 Darwin/22.3.0

File hashes

Hashes for codeinterpreterapi-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c9e2111e102fdb29e52bd0b16477914c2f088116edbcf5c262ee60f4efa27c3c
MD5 80d73fc2f4a876b23042664e2103e561
BLAKE2b-256 82c72bde2c070d63a4ef78a81f7e81e6becf2db0baf76a4bddb0e62ae17edac6

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