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 using your own OpenAI API Key.
Installation
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
asyncio.run(main())
Output
Production
In case you want to deploy to production you can use the CodeBox API for easy scaling. Please contact me if you want to use the CodeBox API in production. Its currently in early development and not everything is automated yet.
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
Contact
You can contact me at pleurae-berets.0u@icloud.com Sorry for the weird email address but I don't want to get spammed so I can deactivate it if necessary. But you can also contact me on Twitter or Discord.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for codeinterpreterapi-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0673d082a1edfd9e78c9338a9743378caa8e8e904812c394f7c8846d71890795 |
|
MD5 | 97b7edbefc78fe9459e378e3bce95913 |
|
BLAKE2b-256 | e2c8e9749da7cb8b3c40a23e90d85aa66357fdaf4ba7f9042a094709b7fa2db3 |